SQLlite3 read databasename lazarus / 16-Databases ---------------------------------------------------------------------- SteenJorgensen · 2020-06-25 07:56 Hi I have a problem to read the database filename from a TSQLite3Connection. No problems to set it, eg. db.DataBaseName := 'c:\temp\Mydatabase.s3db' but: s := db.DataBaseName, set s to empty. Why??? ---------------------------------------------------------------------- SteenJorgensen · 2020-06-25 08:02 I can only read the name i the same procedure i have set the property. In other procedure databasename property is empty??? ---------------------------------------------------------------------- TRon · 2020-06-25 09:03 Hi SteenJorgensen, As usual this kind of thing is impossible to analyse/answer without some code to be able to look at. A simple test shows me that it works as intended, therefore your code must be doing something out of the ordinary. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program SQl_DBName; {$MODE OBJFPC}{$H+} uses  classes, sysutils, dateutils, db, sqldb, sqlite3conn; var  DBConnection  : TSQLite3Connection;  DBTransaction : TSQLTransaction;  DBQ           : TSQLQuery;   {$IFDEF LCL}  // For Lazarus Change MainForm.YourLogMem to point to a Memo on your Form  LogMemo   : TMemo absolute MainForm.YourLogMemo;    {$ENDIF}   procedure WriteLog(S:String);inline;begin{$IFDEF LCL}LogMemo.Append{$ELSE}WriteLn{$ENDIF}(S);end;  procedure WriteLog;begin WriteLog('')end;  procedure WriteLog(S:String;const a:array of const);begin WriteLog(Format(S,a));end;  procedure CreateDB(ADataBaseName: string);begin  DBConnection := TSQLite3Connection.Create(nil);   DBConnection.DatabaseName := ADataBaseName;  DBTransaction := TSQLTransaction.Create(DBConnection);  DBTransAction.Database := DBConnection;   DBQ             := TSQLQuery.Create(DBConnection);  DBQ.Database    := DBConnection;  DBQ.Transaction := DBTransaction;end; procedure DestroyDB;begin  DBConnection.Free;end;  procedure test;var  TableName: string;  TableNames: TStringList;  n : integer;begin  WriteLog('DBConnection.DatabaseName = "%s"', [DBConnection.DataBaseName]);  TableNames := TStringList.Create;  DBConnection.GetTableNames(TableNames);  n := 1;  for TableName in TableNames do   begin    WriteLog('Tablename[%d] = %s', [n, TableName]);    inc(n);  end;   TableNames.Free;end; procedure RunningMan;begin  WriteLog('begin');  CreateDB('test.s3db');  try    test;  finally    DestroyDB;  end;    WriteLog('end');end; begin  RunningMan;end.  Which produces for me: Code: [Select]$ ./SQLDB_Name begin DBConnection.DatabaseName = "test.s3db" Tablename[1] = DLG Tablename[2] = DLG_LOG end