What's the actual code output from your program? i.e. which sqlite3_close() is it failing on?
Can you call sqlite3_errmsg() when sqlite3_open() failed to initialise the db struct? I would have thought "db" would be invalid at that point. Try setting db to NULL when declaring it, as otherwise you may be calling sqlite3_errmsg() with a non-null invalid pointer (it'll be some random memory address if it's not nullified by sqlite3_open() on open failure), which sqlite3 attempts to use but fails, resulting in your "library routine called out of sequence" error? Nick. -----Original Message----- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of John Sent: 23 February 2010 10:17 To: sqlite-users@sqlite.org Subject: [sqlite] sqlite3_close ==> " library routine called out of sequence" Hi All, The very simple C-code below returns error message " library routine called out of sequence" . I really don't understand why ? I'm using SQLite 3.6.22 under Windows XP Any idea/suggestion would be really appreciated ! ------------------------------------------------------------------------ ------------- sqlite3 *db; sqlite3_stmt *statement; wxString TMPstring; if( sqlite3_open( "Test3.db", &db) ) { TMPstring << "Failed opening databse file:\n" << sqlite3_errmsg(db); wxMessageBox( TMPstring ); sqlite3_close(db); return; } if( sqlite3_close( db ) != SQLITE_OK ); { wxMessageBox( wxString("Database can not be closed properly !\n\n") << sqlite3_errmsg( db ) ); return( -1 ); } ----------------------------------------------------------------- Thanx for your help, John _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users