db.setDatabaseName(dbName);
if (db.open() && db.isOpenError()==false && db.isValid()==true)
{
// Opened
}
else
{
// Display error
}
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", "TEMP");
db.setDatabaseName(dbName);
if (db.open() && db.isOpenError()==false && db.isValid()==true)
{
// Opened
}
else
{
// Display error
}
To copy to clipboard, switch view to plain text mode
I'm letting the user pick a file on the harddrive to open as an SQLite database. But I can pick ANY file and it will always reach the opened block. How do I check that a file is a valid SQLite database file?
Thanks
Bookmarks