unit12.pas
来自「本系统是一个房屋出租方面的管理系统」· PAS 代码 · 共 81 行
PAS
81 行
unit Unit12;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Grids, DBGrids, ExtCtrls;
type
TFormCZXXCX = class(TForm)
Panel1: TPanel;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
ComboBox1: TComboBox;
Edit1: TEdit;
BitBtn1: TBitBtn;
Panel2: TPanel;
DBGrid1: TDBGrid;
procedure FormShow(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormCZXXCX: TFormCZXXCX;
implementation
uses unit3;
{$R *.dfm}
procedure TFormCZXXCX.FormShow(Sender: TObject);
begin
dbgrid1.DataSource:=database.DataSource3;
combobox1.ItemIndex:=0;
edit1.Clear;
end;
procedure TFormCZXXCX.BitBtn1Click(Sender: TObject);
begin
if (trim(combobox1.Text)<>'') and (trim(edit1.Text)<>'') then
begin
try
database.ADO_CZXXCX.Connection:=database.ADOConnection1;
database.ADO_CZXXCX.Close;
database.ADO_CZXXCX.SQL.Clear;
database.ADO_CZXXCX.SQL.Add('select * from 出租信息表 where');
database.ADO_CZXXCX.SQL.Add(trim(combobox1.Text));
database.ADO_CZXXCX.SQL.Add('=');
database.ADO_CZXXCX.SQL.Add(':a');
database.ADO_CZXXCX.Parameters.ParamByName('a').Value:=edit1.Text;
database.ADO_CZXXCX.Open;
except
MessageDlg('系统出错!',mtWarning,[MbOK],64);
FormCZXXCX.Close;
end;
if database.ADO_CZXXCX.RecordCount = 0 then
begin
application.MessageBox('数据库中没有相关记录!','提示',64);
edit1.Clear;
edit1.SetFocus
end;
application.MessageBox('查询成功!','提示',64);
dbgrid1.DataSource:=database.DataSource5;
end
else
begin
application.MessageBox('查询条件不能为空!','提示',64);
edit1.SetFocus;
end;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?