Jump to content
Registration disabled at the moment Read more... ×
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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×