码迷,mamicode.com
首页 > 数据库 > 详细

delphi 双击dbgrid 调用另一窗体的例子

时间:2019-07-16 08:37:26      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:rms   sse   data   begin   window   controls   source   private   ant   

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   

原文地址:https://www.cnblogs.com/jijm123/p/11192470.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!