时间:2021-07-01 10:21:17 帮助过:4人阅读
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, DB, ADODB, StdCtrls;
type
TForm1 = class(TForm)
DataSource1: TDataSource;
ADOTable1: TADOTable;
DBGrid1: TDBGrid;
Button1: TButton;
procedure DBGrid1DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
// var
DataSet : TDataSet
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.DBGrid1DblClick(Sender: TObject);
//var
//DataSet : TDataSet
begin
DataSet := DBGrid1.DataSource.DataSet;
with TForm2.Create(nil) do begin
edit1.text :=DataSet.FieldByName(‘客户‘).Asstring;
ShowModal;
Free;
end;
end;
end.
连上面
procedure TForm2.Button1Click(Sender: TObject);
begin
with adoquery1 do
begin
close;
sql.clear;
sql.add(‘select * from 销售表 where 客户=‘‘‘+trim(edit1.text)+‘‘‘‘);
open;
end;
end;
delphi 双击dbgrid 调用另一窗体的例子
标签:rms sse data begin window controls source private ant