Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
CodeDatabaseDelphiRAD Studio

Learn How To Create A Database Login Dialog In Delphi With The FireDAC.TFDGUIxLoginDialog Sample

This sample describes how to use TFDGUIxLoginDialog in FireDAC GUI applications to allow users to enter their database credentials to connect to a DBMS. The same component also allows users to manage their passwords.

The sample connects to a database using a TFDConnection.


You can find the TFDGUIxLoginDialog sample project at:

  • Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to:
    • Object Pascal\DataBase\FireDAC\Samples\Comp Layer\TFDGUIxLoginDialog\Main.
  • Subversion Repository:
    • You can find Delphi code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.


This sample uses the Use Connection Definition drop-down menu to select a connection definition. If the database requires login credentials and the Login prompt check-box is selected, the FireDAC Login window appears where the user can input the User namePassword and other optional parameters. The set of parameters depends on the database type. The Profile combo-box allows choosing one of the previously successfully used credentials.

How to Use the Sample

  1. Navigate to the location given above and open:
    • Delphi: LoginDialog.dproj
  2. Press F9 or choose Run > Run.
  3. Select a connection definition from the Use Connection Definition drop-down menu.
  4. Click Connect to connect to the database.
  5. The FireDAC Login appears, allowing to input the login credentials.
  6. Click Disconnect to disconnect from the database.


This project uses the dmMainComp unit where the TFDGUIxLoginDialog component is placed.

Use Connection Definition

The menu shows all the connections defined on the file at C:\Users\Public\Documents\Embarcadero\Studio\FireDAC\FDConnectionsDefs.ini.

The connection to the database is established using a TFDConnection component placed at the dmMainComp unit. It uses the LoginDialog property from the TFDConnection to select the TFDGUIxLoginDialog component.

If the Login prompt of the main form is checked then it checks the LoginPrompt option from the TFDConnection to show the FireDAC Login window when trying to connect to the database.

When selecting the connection, it updates the TFDGUIxLoginDialog properties with the values selected for the options on the FireDAC Login Dialog properties TPanel.


It updates the TFDGUIxLoginDialog properties with the values selected for the options on the FireDAC Login Dialog properties TPanel.

Opens the connection to the database by setting to True the Connected property for the TFDConnection.


Closes the connection to the database by setting to False the Connected property for the TFDConnection.

FireDAC Login Dialog properties

Values by default for the TFDGUIxLoginDialog properties:


  • It allows the user to change an expired password.


  • It allows the login history storage.


  • It allows the password storage in the login history.


  • Specifies the number of allowed login tries for the user. An exception is raised when the defined number is reached.

VisibleItemsDatabase, User_Name and Password

  • Specifies the fields shown on the FireDAC Login window. You can also set the name to be shown. For example Database = My Database Connection .

If you want to ti visit the original Embarcadero post, refer to the link below:


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.