I am attempting to add a new record to a table similar to the example listed below. When I run the query I get the following error: QODBC3: Unable to bind variable. What do I need to do to correct the error?
QSqlQuery query;
query.prepare("INSERT INTO Table (id, val, time) VALUES (:id, :val, :time)");
query.bindValue(":id", 1);
query.bindValue(":val", "23");
开发者_Python百科query.bindValue(":time", QTime(8, 0));
query.exec();
I would guess it doesn't know how to bind the QTime object. Should you be using the toString method?
- turned on ODBC tracing
- Double check your parameters!
精彩评论