Jump to content
Gary

How to test FDConnection with SQLite

Recommended Posts

Hello all,

 

How do you test if a FDConnection using SQLite is connected to an actual Database? 

If I drop a FDConnection on a form, set it's DriverName SQLite, leave the Params->Database property empty and connect there is no error. This code shows the "Connected' Message

procedure TForm1.Button1Click(Sender: TObject);
begin
  if FDConnection1.Connected then
    ShowMessage('Connected');
end;

 

Share this post


Link to post
Posted (edited)

Check the Params TStrings property to check for the database name and other properties.

 

procedure TForm1.Button1Click(Sender: TObject);
begin
  if FDConnection1.Params.Values['Database'] <> '' then
    ShowMessage('Database name is ' + FDConnection1.Params.Values['Database']);
end;

 

Edited by Navid Madani

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×