Hello, I have a sqlite db file, it name is "tomek.sqlite". In this db I have a one table name: "am_tankowania"
In code, I put:
db.setDatabaseName("tomek.sqlite");
if(db.
open()) QMessageBox::information(0,
"Ok",
"Connection ok");
else QMessageBox::information(0,
"Error",
"some error.");
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("tomek.sqlite");
if(db.open()) QMessageBox::information(0,"Ok","Connection ok");
else QMessageBox::information(0,"Error","some error.");
To copy to clipboard, switch view to plain text mode
The MessageBox ok - connection ok show. Now, I have a query:
select * from am_tankowania:
if (query.
lastError().
isValid()) QMessageBox::critical(0,
"Error",query.
lastError().
text() );
QSqlQuery query("SELECT * am_tankowania");
if (query.lastError().isValid()) QMessageBox::critical(0,"Error",query.lastError().text() );
To copy to clipboard, switch view to plain text mode
I see an error:
no such table table: am_tankowania Unable to execute statement :/
What i'm doing wrong?
Thank you.
Bookmarks