ODAC 6 最新版的﹐網上找了好久才找到﹐不太好找啊﹐大家一起共享
源代码在线查看: myconnectform.pas
unit MyConnectForm;
interface
uses
{$IFDEF LINUX}
SysUtils, Types, Classes, QGraphics, QControls, QForms, QDialogs, QStdCtrls,
QComCtrls, QExtCtrls, QGrids, QDBGrids, OdacClx, QButtons, QMask,
{$ELSE}
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, Mask, Buttons, OdacVcl,
{$ENDIF}
Ora, OraError;
type
TfmMyConnect = class(TForm)
Panel: TPanel;
lbUsername: TLabel;
lbPassword: TLabel;
lbServer: TLabel;
edUsername: TEdit;
edPassword: TMaskEdit;
edServer: TComboBox;
btConnect: TBitBtn;
btCancel: TBitBtn;
Bevel1: TBevel;
procedure btConnectClick(Sender: TObject);
private
FConnectDialog: TConnectDialog;
FRetries: integer;
FRetry: boolean;
procedure SetConnectDialog(Value:TConnectDialog);
protected
procedure DoInit; virtual;
procedure DoConnect; virtual;
public
published
property ConnectDialog:TConnectDialog read FConnectDialog write SetConnectDialog;
end;
var
fmMyConnect: TfmMyConnect;
implementation
{$IFDEF CLR}
{$R *.nfm}
{$ENDIF}
{$IFDEF WIN32}
{$R *.dfm}
{$ENDIF}
{$IFDEF LINUX}
{$R *.xfm}
{$ENDIF}
procedure TfmMyConnect.DoInit;
begin
FRetry := False;
FRetries := FConnectDialog.Retries;
Caption := FConnectDialog.Caption;
lbUsername.Caption := FConnectDialog.UsernameLabel;
lbPassword.Caption := FConnectDialog.PasswordLabel;
lbServer.Caption := FConnectDialog.ServerLabel;
btConnect.Caption := FConnectDialog.ConnectButton;
btCancel.Caption := FConnectDialog.CancelButton;
FConnectDialog.GetServerList(edServer.Items);
edUsername.Text := FConnectDialog.Session.Username;
edPassword.Text := FConnectDialog.Session.Password;
edServer.Text := FConnectDialog.Session.Server;
if (edUsername.Text '') and (edPassword.Text = '') then
ActiveControl := edPassword;
end;
procedure TfmMyConnect.DoConnect;
begin
FConnectDialog.Session.Password := edPassword.Text;
FConnectDialog.Session.Server := edServer.Text;
FConnectDialog.Session.UserName := edUsername.Text;
try
FConnectDialog.Connection.PerformConnect(FRetry);
ModalResult := mrOk;
except
on E:EOraError do begin
Dec(FRetries);
FRetry := True;
if FRetries = 0 then
ModalResult := mrCancel;
case E.ErrorCode of
1005: ActiveControl := edPassword;
1017: if ActiveControl edUsername then ActiveControl := edPassword;
12203,12154: ActiveControl := edServer;
end;
raise;
end
else
raise;
end;
end;
procedure TfmMyConnect.SetConnectDialog(Value:TConnectDialog);
begin
FConnectDialog := Value;
DoInit;
end;
procedure TfmMyConnect.btConnectClick(Sender: TObject);
begin
DoConnect;
end;
initialization
if GetClass('TfmMyConnect') = nil then
Classes.RegisterClass(TfmMyConnect);
end.
|
相关资源 |
|
-
ODAC 6 最新版的﹐網上找了好久才找到﹐不太好找啊﹐大家一起共享
-
12点阵和16点阵的文件字库,找了好久才找到的
-
这是《JSP案例开发》的源代码,我找了好久才找到的,分享给大家
-
计算机图形学的试卷复习题,我找了好久才找到的,请珍惜啊!
-
这是一个在网上找了好久才找到,希望能与大家分享哈,站长就帮我开通了吧,我很需要其他的源代码的
-
万能Asp防SQL注入代码
我找了好久才找到的万能代码~直接复制使用即可~
-
这是一本经典的VC++书籍,我找了好久才找到,现在分享给大家,不用谢哦
-
t102 驱动AU 7 屏的OSD原代码,我找了好久才找到的,有一定的参考价值.
|