TomASS
22nd April 2009, 00:11
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:
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.");
The MessageBox ok - connection ok show. Now, I have a query:
select * from am_tankowania:
QSqlQuery query("SELECT * am_tankowania");
if (query.lastError().isValid()) QMessageBox::critical(0,"Error",query.lastError().text() );
I see an error:
no such table table: am_tankowania Unable to execute statement :/
What i'm doing wrong?
Thank you.
In code, I put:
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.");
The MessageBox ok - connection ok show. Now, I have a query:
select * from am_tankowania:
QSqlQuery query("SELECT * am_tankowania");
if (query.lastError().isValid()) QMessageBox::critical(0,"Error",query.lastError().text() );
I see an error:
no such table table: am_tankowania Unable to execute statement :/
What i'm doing wrong?
Thank you.