Data.DB.TCustomConnection.OnLogin
Delphi
property OnLogin: TLoginEvent read FOnLogin write FOnLogin;
C++
__property Data::Dbcommontypes::TLoginEvent OnLogin = {read=FOnLogin, write=FOnLogin};
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
event | public | Data.DB.pas Data.DB.hpp |
Data.DB | TCustomConnection |
Description
Occurs when a communication channel opens to the server.
OnLogin occurs when connections are opened if the LoginPrompt property is true.
For DataSnap connection components, the following sequence of events occurs when opening a connection to an application server:
- An OnGetUsername event occurs, where the application can supply an initial user name for the login dialog.
- The login dialog appears, where the user can supply a user name and password.
- A BeforeConnect event occurs, the connection is opened, and an AfterConnect event occurs.
- The OnLogin event occurs, where you can write code to log in to the application server using the username and password that were provided in the remote login dialog.
Note: Do not use the OnLogin event if the connection component provides a different scheme for logging in. For example, TWebConnection uses the Username and Password properties instead.
For ADO connection components, the following sequence of events occurs when opening a connection to an application server:
- A BeforeConnect event occurs.
- An OnWillConnect event occurs, where the application can supply an initial user name and password for the login dialog, as well as the connection options and status.
- The login dialog appears, where the user can supply a user name and password.
- The OnLogin event occurs, where you can write code to respond to the user-supplied values. (For example, you could convert an application-specific user name and password to database user name and password).
- The connection is opened, and an AfterConnect event occurs.
Note: Some connection components that do not connect to an application server in a multitiered database application replace the OnLogin event defined in TCustomConnection with a different event that occurs before a connection is established.