📄 csearchform.pas
字号:
unit csearchform;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, StdCtrls;
type
Tcsearch = class(TForm)
btsearch: TButton;
DBGrid1: TDBGrid;
Label1: TLabel;
Label2: TLabel;
ComboBox1: TComboBox;
Edit1: TEdit;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure btsearchClick(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Edit1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
csearch: Tcsearch;
implementation
uses mainform, DataM;
{$R *.dfm}
procedure Tcsearch.FormClose(Sender: TObject; var Action: TCloseAction);
begin
frmmain.show;
end;
procedure Tcsearch.btsearchClick(Sender: TObject);
begin
if ComboBox1.ItemIndex=0 then
begin
Data.ADOQInOut.Close;
Data.ADOQInOut.SQL.Clear;
Data.ADOQInOut.SQL.Add('select * from inout where name="'+Edit1.Text+'"');
Data.ADOQInOut.Open;
end
else if combobox1.ItemIndex=1 then
begin
Data.ADOQInOut.Close;
Data.ADOQInOut.SQL.Clear;
Data.ADOQInOut.SQL.Add('select * from inout where findwho="'+Edit1.Text+'"');
Data.ADOQInOut.Open;
end
else if combobox1.ItemIndex=2 then
begin
Data.ADOQInOut.Close;
Data.ADOQInOut.SQL.Clear;
Data.ADOQInOut.SQL.Add('select * from inout where carno="'+Edit1.Text+'"');
Data.ADOQInOut.Open;
end
else if combobox1.ItemIndex=3 then
begin
Data.ADOQInOut.Close;
Data.ADOQInOut.SQL.Clear;
Data.ADOQInOut.SQL.Add('select * from inout where intime like "'+Edit1.Text+'%"');
Data.ADOQInOut.Open;
end
else if combobox1.ItemIndex=4 then
begin
Data.ADOQInOut.Close;
Data.ADOQInOut.SQL.Clear;
case strtoint(edit1.Text) of
1: Data.ADOQInOut.SQL.Add('select * from inout where indoorno=1');
2: Data.ADOQInOut.SQL.Add('select * from inout where indoorno=2');
3: Data.ADOQInOut.SQL.Add('select * from inout where indoorno=3');
4: Data.ADOQInOut.SQL.Add('select * from inout where indoorno=4');
5: Data.ADOQInOut.SQL.Add('select * from inout where indoorno=5');
end;
Data.ADOQInOut.Open;
end;
end;
procedure Tcsearch.ComboBox1Change(Sender: TObject);
begin
label2.Enabled:=true;
btsearch.Enabled:=false;
if ComboBox1.ItemIndex=0 then
label2.Caption:='请输入姓名';
if ComboBox1.ItemIndex=1 then
label2.Caption:='请输入姓名';
if ComboBox1.ItemIndex=2 then
label2.Caption:='请输入车牌号';
if ComboBox1.ItemIndex=4 then
label2.Caption:='请输入门牌号';
if ComboBox1.ItemIndex=3 then
label2.Caption:='请输入日期/时间';
end;
procedure Tcsearch.FormCreate(Sender: TObject);
begin
label2.Enabled:=false;
end;
procedure Tcsearch.Edit1Change(Sender: TObject);
begin
btsearch.Enabled:=true;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -