Reputation: 363
The following is the sql statement
QString myQuery = "UPDATE myTable SET myAttr = :myAttr WHERE ID = 1";
//m_query is a QSqlQuery object pointer
m_query->prepare(myQuery);
QString value = "some value";
m_query->bindValue(":myAttr", QVariant(value)) ;
m_query->exec();
But when I print the executedQuery, it shows the value for **myAttr = ?**
The execution doesn't incur any complain about the bindValue(). Anyone aware what's going on here? I am using QT5.2.1 MinGW_32bits Thanks in advance.
Upvotes: 1
Views: 1773
Reputation: 363
I have solved the problem using the following:
change the :myAttr to :MYATTR
and when you bind the value, follow the same format.
m_query->bindValue(":MYATTR", QVariant(value)) **strong text**
I think it is an issue for newer version of QTCreator.
Upvotes: 1