PDA

View Full Version : unable to insert into table



mohanakrishnan
4th December 2009, 10:52
hi all
im trying to insert a value into the table


QSqlDatabase db1=QSqlDatabase::database("con");

if(db1.open())
{
qDebug() << "database opened ";
QSqlQuery query;
query.prepare("insert into waitrequest (bednumber)""values(:bednumber)");
query.bindValue(":bednumber",10001);
query.exec();
db1.close();
}

but it did not insert the record rather, it shows an error,
QSqlQuery:: prepare: database not open.
i checked the connection ,and it is present!!
can any one help me ??
thanks and regards
:confused: