FireDAC.SQLite Desktop Sample
This sample shows the use of FireDAC database connection using SQLite.
Contents
Location
You can find the FMGettingStarted project at:
- Start | Programs | Embarcadero RAD Studio Athens | Samples and then navigate to:
- Object Pascal\Database\FireDAC\Samples\Getting Started FMX\SQLite_Desktop
- Subversion Repository:
- You can find Delphi code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.
Description
- The demo shows how to connect to a database using FireDAC and LiveBindings. Also, it shows how to use a TBindNavigator control.
Note: The default database has no password.
How to Use the Sample
- Navigate to the location given above and open FMGettingStarted.dproj.
- Press F9 or choose Run > Run.
- Click the Open button and the database's data will appear in the grid.
- Choose a database and enter your password or use the default database which has no password.
- Navigate through the data using the TBindNavigator.
Files
File | Contains |
---|---|
FMGettingStarted.dproj |
Contains the project itself. |
MainFrm.fmx |
Contains the main form code. |
MainFrm.pas |
contains the main form and the main code. |
Implementation
- The project uses a TFDConnection that establishes a connection with a database. In this case FDDemo.sdb which can be found at Samples > data > FDDemo.sdb. In order to navigate through the data, the project uses TFDQuery, TDataSource, TFDPhysSQLiteDriverLink, TFDGUIxLoginDialog, TFDGUIxWaitCursor and TBindNavigator.
- The TFDQuery executes a SELECT query against the Territories table.
- The application also uses a TStringGrid to display the database's data.
Uses
- FireDAC.Comp.Client.TFDConnection
- FireDAC.Comp.Client.TFDQuery
- FireDAC.Comp.UI.TFDGUIxLoginDialog
- FireDAC.Comp.UI.TFDGUIxWaitCursor
- FireDAC.Phys.SQLite.TFDPhysSQLiteDriverLink
- Data.DB.TDataSource
- Fmx.Bind.Navigator.TBindNavigator
- FMX.Grid.TStringGrid