At 18:15 22.03.2010, Todd Cary wrote: >Attached is a test application that contains enough of the application code so >that it is similar to my actual application. When the Test button is pressed, >a check is done to see if a table exists. The DISQLiteDatabase is closed >before the check is done to make sure it is not in use. There are two problems in your code. In a nutshell, it looks like this: 01 var 02 DB: TDISQLite3Database; 03 begin 04 DB := TDISQLite3Database.Create(nil); 05 DB.DatabaseName := 'test.db3'; 06 try 07 DB.Open; 08 except 09 DB.CreateDatabase; 10 end; 11 DB.Close; // For testing 12 13 Sqlite3_Exists_Table(Pointer(DB), 'Cards_Tmp'); 1. sqlite3_exists_table expectes a sqlite3_ptr handle, but you are passing to it an instance of TDISQLite3Database (line 13). Because the latter is rejected by the compiler, you are casting it to Pointer. It now compiles, but does not make sense and does not work. The solution is to call sqlite3_exists_table (DB.Handle). Read the DISQLite3 version 2.2.0 change log entry for for the recently enforced compiler type checking. 2. In line 11 you are closing the database. Database operations do not work on closed databases. The solution is to keep the database open until all operations are finished. The following piece of code corrects the above errors: var DB: TDISQLite3Database; begin DB := TDISQLite3Database.Create(nil); try DB.DatabaseName := 'test.db3'; try DB.Open; except DB.CreateDatabase; end; Sqlite3_Exists_Table(DB.Handle, 'Cards_Tmp'); DB.Close; finally DB.Free; end; end; Ralf _______________________________________________ Delphi Inspiration mailing list yunqa@xxxxxxxxxxxxx //www.freelists.org/list/yunqa