On 06.10.2010 01:40, Luc Comeau wrote: > My program was working great until I added a thread to it. This > thread is passed the TDISQLite3Database variable that is used in the > main part of the program. When I start the thread where it is > accessing the SQL database, and the main part of the program is also > accessing the SQL database, I get "error 21 - Library routine called > out of sequence". > > I understood that I should be able to use the same TDISQLite3Database > connection in multiple threads. > > Any solutions to this error? This is hared for me to tell unless I'd see your code and debug it. Error 21 usually occurs if you reuse a statement which has not yet been finalized or reset. It is best to use the a single statement per thread. Then Make sure to call sqlite3_finalize() when done or sqlite3_reset() before you reuse it. Ralf _______________________________________________ Delphi Inspiration mailing list yunqa@xxxxxxxxxxxxx //www.freelists.org/list/yunqa