Data.DB.TCustomConnection.OnLogin

From RAD Studio API Documentation
Jump to: navigation, search

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:

  1. An OnGetUsername event occurs, where the application can supply an initial user name for the login dialog.
  2. The login dialog appears, where the user can supply a user name and password.
  3. A BeforeConnect event occurs, the connection is opened, and an AfterConnect event occurs.
  4. 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:

  1. A BeforeConnect event occurs.
  2. 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.
  3. The login dialog appears, where the user can supply a user name and password.
  4. 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).
  5. 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.

See Also