level 7
代码是:
unit Unit7;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, GridsEh, DBGridEh, StdCtrls, PrnDbgeh, DBTables,
jpeg, ExtCtrls;
type
TForm7 = class(TForm)
GroupBox2: TGroupBox;
Label1: TLabel;
Label2: TLabel;
ComboBox1: TComboBox;
Edit1: TEdit;
Button2: TButton;
PrintDBGridEh1: TPrintDBGridEh;
GroupBox1: TGroupBox;
DBGridEh1: TDBGridEh;
Button1: TButton;
Image1: TImage;
ADOConnection1: TADOConnection;
ADOTable1: TADOTable;
ADOQuery1: TADOQuery;
DataSource1: TDataSource;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form7: TForm7;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm7.FormCreate(Sender: TObject);
begin
with ADOQuery1 do
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 学生基本信息表 where 学号='''+form1.Edit1.Text+'''');
ADOQuery1.Open;
end;
end;
procedure TForm7.FormClose(Sender: TObject; var Action: TCloseAction);
begin
action:=cafree;
form7:=nil;
end;
procedure TForm7.Button2Click(Sender: TObject);
begin
with ADOQuery1 do
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('update 学生基本信息表 set '+ComboBox1.Text+'='''+edit1.Text+'''');
ADOQuery1.SQL.Add('where 学号='''+form1.Edit1.Text+'''');
ADOQuery1.ExecSQL;
form7.Close;
end;
end;
procedure TForm7.Button1Click(Sender: TObject);
begin
PrintDBGridEh1.Preview;
end;
end.
2015年01月11日 15点01分




