?? main.~pas
字號:
unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, QuickRpt, StdCtrls, Buttons, QRCtrls, DB, ADODB;
type
TForm1 = class(TForm)
QuickRep1: TQuickRep;
GroupBox2: TGroupBox;
Label1: TLabel;
Label2: TLabel;
BitBtn2: TBitBtn;
BitBtn1: TBitBtn;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
QRBand4: TQRBand;
QRBand3: TQRBand;
QRLabel19: TQRLabel;
QRSysData3: TQRSysData;
QRLabel20: TQRLabel;
QRLabel22: TQRLabel;
QRLabel18: TQRLabel;
QRSysData1: TQRSysData;
QRBand2: TQRBand;
QRLabel8: TQRLabel;
ADOConnection1: TADOConnection;
ADOTable1: TADOTable;
ADOQuery1: TADOQuery;
QRDBText1: TQRDBText;
QRDBText2: TQRDBText;
QRDBText3: TQRDBText;
QRDBText4: TQRDBText;
QRDBText5: TQRDBText;
QRDBText6: TQRDBText;
QRDBText7: TQRDBText;
QRDBText8: TQRDBText;
QRDBText9: TQRDBText;
QRLabel9: TQRLabel;
QRLabel10: TQRLabel;
QRLabel11: TQRLabel;
QRLabel12: TQRLabel;
QRLabel13: TQRLabel;
QRLabel14: TQRLabel;
QRLabel15: TQRLabel;
QRLabel16: TQRLabel;
QRLabel17: TQRLabel;
QRExpr1: TQRExpr;
QRExpr2: TQRExpr;
QRExpr3: TQRExpr;
QRBand1: TQRBand;
QRLabel1: TQRLabel;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
QRLabel4: TQRLabel;
QRLabel5: TQRLabel;
QRLabel6: TQRLabel;
QRLabel7: TQRLabel;
QRBand5: TQRBand;
QRLabel31: TQRLabel;
QRExpr4: TQRExpr;
QRExpr5: TQRExpr;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ComboBox1Select(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
//設置報表顯示信息
procedure TForm1.FormShow(Sender: TObject);
begin
ComboBox1.Text:=ComboBox1.Items[0];
QRLabel3.Caption:='旭陽軟件技術公司';
QRLabel4.Caption:=FormatDateTime('yyyy-mm',now);
QRLabel8.Caption:='李小陽';
end;
//按查詢條件輸出報表
procedure TForm1.BitBtn1Click(Sender: TObject);
var
stemp:string;
begin
if Trim(ComboBox1.Text)='' then
begin
MessageDlg(' 請輸入------查詢條件!',mtInformation,[mbYes],0);
ComboBox1.SetFocus;
Exit;
end;
if Trim(ComboBox2.Text)='' then
begin
MessageDlg(' 請輸入------查詢結果!',mtInformation,[mbYes],0);
ComboBox2.SetFocus;
Exit;
end;
//操作數據表(userlogin)
if ComboBox1.Text='全部' then
stemp:='select * from userlogin'
else if ComboBox1.Text='用戶名稱' then
stemp:='select * from userlogin where username='''+Trim(ComboBox2.text)+''''
else if ComboBox1.Text='登陸日期' then
stemp:='select * from userlogin where logindate='''+Trim(ComboBox2.text)+''''
else if ComboBox1.Text='登陸時間' then
stemp:='select * from userlogin where logintime='''+Trim(ComboBox2.text)+''''
else if ComboBox1.Text='退出時間' then
stemp:='select * from userlogin where quittime='''+Trim(ComboBox2.text)+'''';
//模糊查詢
with ADOQuery1 do
begin
Close;
SQL.Clear;
SQL.Add(stemp);
Open;
end;
if ADOQuery1.RecordCount=0 then
begin
MessageDlg('數據庫沒有你要查詢的數據記錄!',mtInformation,[mbYes],0);
ComboBox2.SetFocus;
Exit;
end;
QuickRep1.Preview;
end;
//設置列表選項
procedure TForm1.ComboBox1Select(Sender: TObject);
begin
if ComboBox1.Text='全部' then ComboBox2.Text:='全部';
end;
//退出
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
Close;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -