jeudi 23 juillet 2015

QSqlDatabase parse db file wrong

May be some one met with such problem. I tried to read sqlite db in Qt app. And when i had performed select request i got the error 'no such table'. Then i found that QSqlDatabase not see the tables in the file. This is my code:

_dbase = QSqlDatabase::addDatabase("QSQLITE");
_dbase.setDatabaseName("C:\development\WordsMemorizing\ex1");
if (!_dbase.open())
{
    throw std::runtime_error(_dbase.lastError().text().toStdString());
}

std::cout << _dbase.tables().size() << std::endl;

std::cout print 0. File is correct and i can see my table via sqlite3 app. What can be wrong? Thanks!

Aucun commentaire:

Enregistrer un commentaire