📄 unit10.pas
字号:
unit Unit10;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, QRCtrls, jpeg, QuickRpt, DB, ADODB, ExtCtrls;
type
TForm10 = class(TForm)
QuickRep1: TQuickRep;
ADOQuery1: TADOQuery;
ADOConnection1: TADOConnection;
QRBand1: TQRBand;
QRBand2: TQRBand;
QRImage1: TQRImage;
QRLabel1: TQRLabel;
QRLabel14: TQRLabel;
QRLabel17: TQRLabel;
QRShape40: TQRShape;
QRLabel18: TQRLabel;
QRLabel2: TQRLabel;
QRLabel4: TQRLabel;
QRLabel5: TQRLabel;
QRLabel6: TQRLabel;
QRLabel7: TQRLabel;
QRLabel8: TQRLabel;
QRLabel9: TQRLabel;
QRShape1: TQRShape;
QRBand3: TQRBand;
QRDBText1: TQRDBText;
QRDBText2: TQRDBText;
QRDBText3: TQRDBText;
QRDBText4: TQRDBText;
QRDBText5: TQRDBText;
QRDBText6: TQRDBText;
QRDBText7: TQRDBText;
QRDBText8: TQRDBText;
QRShape2: TQRShape;
QRShape4: TQRShape;
QRShape5: TQRShape;
QRShape6: TQRShape;
QRShape7: TQRShape;
QRShape8: TQRShape;
QRShape9: TQRShape;
QRShape10: TQRShape;
QRShape11: TQRShape;
QRShape12: TQRShape;
QRShape13: TQRShape;
QRShape14: TQRShape;
QRShape15: TQRShape;
QRShape16: TQRShape;
QRShape17: TQRShape;
QRShape18: TQRShape;
QRShape19: TQRShape;
QRShape20: TQRShape;
QRShape21: TQRShape;
QRShape22: TQRShape;
QRLabel3: TQRLabel;
QRShape3: TQRShape;
function ConnectDataBase():boolean;
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form10: TForm10;
implementation
{$R *.dfm}
function TForm10.ConnectDataBase():boolean;
var
Constr:string;
begin
ADOConnection1.Close;
try
Constr:='Provider=Microsoft.Jet.OLEDB.4.0;Password="";User ID=admin;';
Constr:=Constr+'Data Source='+ExtractFilePath(Application.ExeName)+'database\ZD.mdb;Mode=ReadWrite';
ADOConnection1.ConnectionString := Constr;
ADOConnection1.Connected:=true;
result:=true;
except
result:=false;
application.MessageBox('连接数据库失败','提示',1);
end;
end;
procedure TForm10.FormShow(Sender: TObject);
begin
ConnectDataBase;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -