using sqlite database with qt
Posted
by
Lakshan Perera
on Stack Overflow
See other posts from Stack Overflow
or by Lakshan Perera
Published on 2012-12-18T16:18:58Z
Indexed on
2012/12/18
17:03 UTC
Read the original article
Hit count: 280
here is my code, it dont seems enything wrong,
QSqlDatabase db=QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("thedata.sqlite");
db.open();
QSqlQuery quary;
quary.prepare("SELECT lastname FROM people where firstname='?' ");
quary.bindValue(0,lineEdit->text());
bool x=quary.exec();
if(x){
//......
}
else {
QSqlError err;
err=quary.lastError();
QMessageBox::about(this,"error",err.text() );
}
when the program is working always it gives the error parameter count mismatch
im using qt 4.8 and its own headers for using sqlite.
I would be very thankful for eny advice, though I searched in google i see many posts in this issue but nothing helped me.
thank you.
© Stack Overflow or respective owner