📄 kh_th_find_unit.pas
字号:
unit kh_th_find_unit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, ComCtrls, StdCtrls, Buttons;
type
Tkh_th_find_form = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
Edit1: TEdit;
StatusBar1: TStatusBar;
DBGrid1: TDBGrid;
procedure SpeedButton1Click(Sender: TObject);
procedure DBGrid1DblClick(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
kh_th_find_form: Tkh_th_find_form;
implementation
uses data_unit, khth_unit, khzl_unit;
{$R *.dfm}
procedure Tkh_th_find_form.SpeedButton1Click(Sender: TObject);
begin
with database do
begin
adoq3.Connection :=adoc;
adoq3.SQL.Clear;
case combobox1.ItemIndex of
0:
begin
case combobox2.ItemIndex of
0:
begin
adoq3.SQL.Add('select * from khzl where 客户编码=:ygbm');
adoq3.Parameters.ParamByName('ygbm').Value :=edit1.Text;
end;
1:
begin
adoq3.SQL.Add('select * from khzl where 客户编码 like :ygbm2');
adoq3.Parameters.ParamByName('ygbm2').Value :=edit1.Text+'%';
end;
end;
end;
1:
begin
case combobox2.ItemIndex of
0:
begin
adoq3.SQL.Add('select * from khzl where 客户名称=:ygmc');
adoq3.Parameters.ParamByName('ygmc').Value :=edit1.Text;
end;
1:
begin
adoq3.SQL.Add('select * from khzl where 客户名称 like :ygmc2');
adoq3.Parameters.ParamByName('ygmc2').Value :=edit1.Text+'%';
end;
end;
end;
2:
begin
case combobox2.ItemIndex of
0:
begin
adoq3.SQL.Add('select * from khzl where 拼音简码=:ygjm');
adoq3.Parameters.ParamByName('ygjm').Value :=edit1.Text;
end;
1:
begin
adoq3.SQL.Add('select * from khzl where 拼音简码 like :ygjm2');
adoq3.Parameters.ParamByName('ygjm2').Value :=edit1.Text+'%';
end;
end;
end
else
begin
adoq3.SQL.Clear ;
adoq3.SQL.Add('select * from khzl order by 客户编码');
end;
end;
adoq3.Active :=true;
if adoq3.Recordset.RecordCount >0 then
if adoq3.Recordset.RecordCount <2 then
begin
datas2.DataSet :=nil;
datas2.DataSet :=adoq3;
self.Hide ;
//yg_form.DBGrid1.DataSource:=datas2;
//yg_form.statusbar1.Panels[1].Text :=inttostr(adoq3.Recordset.RecordCount);
end
else
showmessage('请正确选择记录!');
end;
end;
procedure Tkh_th_find_form.DBGrid1DblClick(Sender: TObject);
begin
if dbgrid1.DataSource.DataSet.RecordCount>0 then
begin
khth_form.Edit3.Text:=dbgrid1.DataSource.DataSet.FieldValues['客户名称'];
khth_form.edit4.SetFocus ;
self.Hide ;
end
else
showmessage('无此记录!');
end;
procedure Tkh_th_find_form.SpeedButton2Click(Sender: TObject);
begin
close;
end;
procedure Tkh_th_find_form.SpeedButton3Click(Sender: TObject);
begin
khzl_form:=Tkhzl_form.Create(application);
khzl_form.Show;
end;
procedure Tkh_th_find_form.FormCreate(Sender: TObject);
begin
self.Top :=150;
self.Left :=30;
self.Height :=300;
self.Width :=703;
self.DBGrid1.Visible :=true;
with database do
begin
adoq1.Connection :=adoc;
adoq1.SQL.Clear ;
adoq1.SQL.Add('select * from khzl ');
adoq1.active:=true;
statusbar1.Panels[1].Text :=inttostr(adoq1.Recordset.RecordCount);
datas1.DataSet :=adoq1;
dbgrid1.DataSource:=datas1;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -