Hi! I have made a project which was connected with database. Database was connected succesfully:
m_mydb.setDatabaseName( "D:/Programming/Programming_soft/SQLite/DB/EmployeeInfo.db" );
if( !m_mydb.open() )
ui->label->setText( "Failed to open the database" );
else
ui->label->setText( "Connected..." );
m_mydb = QSqlDatabase::addDatabase( "QSQLITE" );
m_mydb.setDatabaseName( "D:/Programming/Programming_soft/SQLite/DB/EmployeeInfo.db" );
if( !m_mydb.open() )
ui->label->setText( "Failed to open the database" );
else
ui->label->setText( "Connected..." );
To copy to clipboard, switch view to plain text mode
But I can't to make a query. I used method QSqlQuery::exec() and he returns false, when it must to return true!
qWarning() << qry.exec( "SELECT name FROM employee" );
QSqlQuery qry;
qWarning() << qry.exec( "SELECT name FROM employee" );
To copy to clipboard, switch view to plain text mode
I tried to make the same query in SQLiteManager without any problems... What can you promt to me?
Added after 9 minutes:
Sorry, guys! It was miserable mistake, problem was in extension of file. It was .sqlite, but I wrote .db and was created a file without any data))
Bookmarks