PDA

View Full Version : Closing correctly sqlite connection?



0xl33t
8th August 2009, 21:51
Hi,
I want to delete a sqlite database, on linux and mac i have no problems, but in windows i can't delete the sql file because "It is in use". So my question is, how do you close in the right way the database?

Is this wrong?



db->close();
db->removeDatabase("QSQLITE");

Lykurg
9th August 2009, 13:22
QSqlDatabase::removeDatabase() is static so call:


{
QSqlDatabase db;
db.setDatabaseName("somename");
//...
db->close();
}
QSqlDatabase::removeDatabase("somename");