unit U_SelectCompany; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, ADODB, Grids, DBGrids, bsSkinCtrls, dxExEdtr, kbmMemTable, dxTL, dxDBCtrl, dxDBGrid, dxCntner, StdCtrls; type Tfrm_SelectCompany = class(TForm) qry1: TADOQuery; bsSkinPanel2: TbsSkinPanel; bsSkinPanel3: TbsSkinPanel; bsSkinButton1: TbsSkinButton; dxDBGrid1: TdxDBGrid; DS1: TDataSource; dxDBGrid1Column1: TdxDBGridColumn; edt1: TEdit; procedure FormShow(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure dxDBGrid1DblClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_SelectCompany: Tfrm_SelectCompany; implementation uses crm_spxcompany, U_SetCompany; {$R *.dfm} procedure Tfrm_SelectCompany.FormShow(Sender: TObject); var str:widestring; begin str:=''; str:='select 客户简称,订舱系统序列号 from t_crm_client '; qry1.close; qry1.sql.clear; qry1.sql.add(str); qry1.Open; end; procedure Tfrm_SelectCompany.bsSkinButton1Click(Sender: TObject); var str:string; begin str:=''; str:='select 客户简称,订舱系统序列号 from t_crm_client where 客户简称 like ''%'+edt1.text+'%'' '; qry1.close; qry1.sql.clear; qry1.sql.add(str); qry1.Open; end; procedure Tfrm_SelectCompany.dxDBGrid1DblClick(Sender: TObject); begin frm_SetCompany.MT1.edit; frm_SetCompany.MT1['LocalName']:=qry1.fieldbyname('客户简称').AsString; frm_SetCompany.MT1.post; Close; end; end.