翻譯|使用教程|編輯:楊鵬連|2021-07-15 09:49:15.570|閱讀 268 次
概述:我們創(chuàng)建 FDatabase:TIBDatabase 對(duì)象,然后定義我們希望設(shè)計(jì)者擁有的屬性。為每個(gè)屬性編寫(xiě)了“Get”和“Set”方法。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
FastReport VCL是用于 Delphi、C++ Builder、RAD Studio 和 Lazarus 的報(bào)告和文檔創(chuàng)建 VCL 庫(kù)。它提供了可視化模板設(shè)計(jì)器,可以訪問(wèn) 30 多種格式,并可以部署到云、網(wǎng)站、電子郵件和打印中。
立即點(diǎn)擊下載FastReport VCL v6.9最新版
以下組件是TfrxIBXDatabase其中之一。它代表了一個(gè)包裝器TIBDatabase。
TfrxIBXDatabase = class(TfrxCustomDatabase) private FDatabase: TIBDatabase; FTransaction: TIBTransaction; function GetSQLDialect: Integer; procedure SetSQLDialect(const Value: Integer); protected procedure SetConnected(Value: Boolean); override; procedure SetDatabaseName(const Value: String); override; procedure SetLoginPrompt(Value: Boolean); override; procedure SetParams(Value: TStrings); override; function GetConnected: Boolean; override; function GetDatabaseName: String; override; function GetLoginPrompt: Boolean; override; function GetParams: TStrings; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; class function GetDescription: String; override; procedure SetLogin(const Login, Password: String); override; property Database: TIBDatabase read FDatabase; published { list TIBDatabase properties. Note – some properties are already exist in base class } property DatabaseName; property LoginPrompt; property Params; property SQLDialect: Integer read GetSQLDialect write SetSQLDialect; { Connected property should be placed last! } property Connected; end; constructor TfrxIBXDatabase.Create(AOwner: TComponent); begin inherited; { create component – connection } FDatabase := TIBDatabase.Create(nil); { create component - transaction (specificity of IBX) } FTransaction := TIBTransaction.Create(nil); FDatabase.DefaultTransaction := FTransaction; { do not forget this line! } Component := FDatabase; end; destructor TfrxIBXDatabase.Destroy; begin { delete transaction } FTransaction.Free; { connection will be deleted automatically in parent class } inherited; end; { component description will be displayed next to icon in objects toolbar } class function TfrxIBXDatabase.GetDescription: String; begin Result := 'IBX Database'; end; { redirect component properties to cover properties and vice versa } function TfrxIBXDatabase.GetConnected: Boolean; begin Result := FDatabase.Connected; end; function TfrxIBXDatabase.GetDatabaseName: String; begin Result := FDatabase.DatabaseName; end; function TfrxIBXDatabase.GetLoginPrompt: Boolean; begin Result := FDatabase.LoginPrompt; end; function TfrxIBXDatabase.GetParams: TStrings; begin Result := FDatabase.Params; end; function TfrxIBXDatabase.GetSQLDialect: Integer; begin Result := FDatabase.SQLDialect; end; procedure TfrxIBXDatabase.SetConnected(Value: Boolean); begin FDatabase.Connected := Value; FTransaction.Active := Value; end; procedure TfrxIBXDatabase.SetDatabaseName(const Value: String); begin FDatabase.DatabaseName := Value; end; procedure TfrxIBXDatabase.SetLoginPrompt(Value: Boolean); begin FDatabase.LoginPrompt := Value; end; procedure TfrxIBXDatabase.SetParams(Value: TStrings); begin FDatabase.Params := Value; end; procedure TfrxIBXDatabase.SetSQLDialect(const Value: Integer); begin FDatabase.SQLDialect := Value; end; { this method is used by DB connection wizard } procedure TfrxIBXDatabase.SetLogin(const Login, Password: String); begin Params.Text := 'user_name=' + Login + #13#10 + 'password=' + Password; end;如您所見(jiàn),這并沒(méi)有那么復(fù)雜。我們創(chuàng)建 FDatabase:TIBDatabase 對(duì)象,然后定義我們希望設(shè)計(jì)者擁有的屬性。為每個(gè)屬性編寫(xiě)了“Get”和“Set”方法。
如果您對(duì) FastReport 感興趣,歡迎加入 FastReport QQ 交流群:702295239
還想要更多嗎?您可以點(diǎn)擊閱讀【FastReport報(bào)表2021最新資源盤點(diǎn)】,查找需要的教程資源。上是FastReport .NET慧正在網(wǎng)火熱銷售中!>>查看價(jià)格詳情
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自: