Skip to main content
All docs
V25.2
  • VCL Backend: How to Use SQLite

    • 3 minutes to read

    SQLite is a file-based relational database engine. You can connect TdxReport and TdxDashboardControl components to SQLite databases using the TdxBackendDatabaseSQLConnection component. The VCL Backend has built-in support for SQLite (no database provider assembly is required for application deployment).

    Test SQLite Database

    This guide uses the following SQLite database shipped with compiled VCL DevExpress demos:

    Tip

    %PUBLIC%\Documents\DevExpress VCL Demos\MegaDemos\Product Demos\ExpressReports\Data\devav.sqlite3

    Download: Compiled VCL Demos

    Configure & Build a RAD Studio App Project

    Create a new project and place TdxDashboardControl and TdxBackendDataConnectionManager components on a form.

    VCL Backend: Create a New ExpressDashboards-Powered Project

    Double-click the TdxBackendDataConnectionManager component on the form to open the Collection Editor dialog, click the Add button, and select the Database (SQL) option to create a TdxBackendDatabaseSQLConnection component:

    VCL Backend: Create an SQL Data Connection Component

    Configure the SQL Connection Component

    The previously added TdxBackendDatabaseSQLConnection component connects to the source Firebird database using a connection string. To configure this component and specify a valid connection string, add a TcxButton component to a form and handle the component’s OnClick event as demonstrated in the following code example:

    uses
      dxDashboard.Control,  // Declares the TdxDashboardControl component
      dxBackend.ConnectionString.SQL;  // Declares the TdxBackendDatabaseSQLConnection component
    // ...
    
    procedure TMyForm.cxButton1Click(Sender: TObject);
    begin
      dxBackendDatabaseSQLConnection1.Active := False;  // Terminates the current connection (if one exists)
      // Specify a user-friendly data connection name (for end-user dialogs) and a valid connection string
      dxBackendDatabaseSQLConnection1.DisplayName := 'SQLite Database Connection';
      dxBackendDatabaseSQLConnection1.ConnectionString :=
    
        'XpoProvider=SQLite;' +  // Specifies the database engine type
        'Data Source=C:\Users\Public\Documents\DevExpress VCL Demos\MegaDemos\' +
        'Product Demos\ExpressReports\Data\devav.sqlite3';
    
      dxBackendDatabaseSQLConnection1.Active := True;  // Connects to the "devav.sqlite3" database
      dxDashboardControl1.ShowDesigner;  // Displays the Dashboard Designer dialog
    end;
    

    Build & Run the Test App

    Build the project and place the WebView2Loader.dll file from the EdgeView2 SDK GetIt package into the project folder containing the built executable file.

    Run the built executable and click the previously added button to display the DevExpress Dashboard Designer dialog.

    Run App & Test Database Connection

    Run the built executable file and click the previously added button to display the DevExpress Dashboard Designer dialog. Click the hamburger button, select the Data Sources item, and click the Add link in the DATA SOURCES pane:

    VCL Backend: Dashboard Designer - Data Sources Pane

    Click the Create data source… link in the Add Data Source modal dialog:

    VCL Backend: Dashboard Designer - Add Data Source

    Select Database in the Dashboard Data Source Wizard modal dialog and click Next:

    VCL Backend: Dashboard Designer - Data Source Wizard

    The wizard displays the created data connection component using its display name defined in the following topic section: Configure the SQL Connection Component.

    VCL Backend: Dashboard Designer - The Created "SQLite Database Connection" Component

    Click Next and use the Run Query Builder… option:

    VCL Backend: Dashboard Designer - The Run Query Builder Option

    Expand the AVAILABLE TABLES AND VIEWS node to browse tables from the connected database:

    VCL Backend: Dashboard Designer - The Query Builder Populated with SQLite Database Tables

    If the AVAILABLE TABLES AND VIEWS node contains a list of tables from the sample devav.sqlite3 database, the created SQLite connection is successful.

    See Also