📄 unit_enterprise_search.~pas
字号:
unit Unit_enterprise_Search;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, XPMenu, StdCtrls, CheckLst, ExtCtrls;
type
TForm_enterprise_search = class(TForm)
Bevel1: TBevel;
Label1: TLabel;
Label2: TLabel;
OKBtn: TButton;
CancelBtn: TButton;
Edit1: TEdit;
CheckListBox1: TCheckListBox;
XPMenu1: TXPMenu;
procedure OKBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form_enterprise_search: TForm_enterprise_search;
implementation
uses Unit_DM;
{$R *.dfm}
procedure TForm_enterprise_search.OKBtnClick(Sender: TObject);
var
sql,whereStr,fieldstr:String;
i:integer;
begin
if length(edit1.Text)<1 then
begin
application.MessageBox('请输入搜索内容.','提示',MB_OK);
edit1.SetFocus;
exit;
end;
sql:='select * from enterprise';
whereStr:='';
fieldstr:='';
for i:=0 to checklistbox1.Items.Count-1 do
begin
if checklistbox1.Checked[i] then
begin
if checklistbox1.Items.Strings[i]='用户名' then fieldstr:='vUserName';
if checklistbox1.Items.Strings[i]='企业名称' then fieldstr:='vName';
if checklistbox1.Items.Strings[i]='负责人' then fieldstr:='vPrin';
if checklistbox1.Items.Strings[i]='电话' then fieldstr:='vPhone';
if checklistbox1.Items.Strings[i]='地址' then fieldstr:='vAddress';
if checklistbox1.Items.Strings[i]='Email' then fieldstr:='vEmail';
if length(whereStr)<1 then
whereStr:=fieldstr+' like ''%'+edit1.text+'%'''
else
whereStr:=whereStr+' or '+fieldstr+' like ''%'+edit1.text+'%''';
end;
end;
if length(whereStr)<1 then
begin
application.MessageBox('请输入搜索范围.','提示',MB_OK);
checklistbox1.SetFocus;
exit;
end;
with dm.adsEnterprise do
begin
close;
commandtext:=sql+' where '+wherestr;
open;
end;
close;
end;
procedure TForm_enterprise_search.FormCreate(Sender: TObject);
begin
Self.Left:= Round(Screen.Width/2-Width/2);
Self.Top :=Round(Screen.Height/2-Height/2);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -