QT bindValue(class QSqlQuery) + Mysql problem
-
Hi friends, could you lying your hand on my problem:
I am trying to work with insert data through the qt query by using lineEdit and bind it. But Tt works on my pc, database connection also run,and the data also inserted after button clicked (the data take out from lineEdit by binding).
But the problem starting up appear when I transfers my source code and database to the my laptop. the database connection is working properly but sad to say that the mysql can not get the data, there is no error and everything is ok, the only problem is the data which inserted through lineEdit can not execute to the mysql table.
both of my machine is 64 bit window 7 os. my pc is pro and my laptop is home(is it problem?)
and if i use to a normal query like direct insert without binding:QSqlQuery query;
query.exec("INSERT INTO employee (id, name, salary) "
"VALUES (234234, 'hery', 300)");it works and the data will be inserted to the mysql table. but if i used to binding process by using lineEdit the data is fail to execute:
QSqlQuery query;
query.prepare("INSERT INTO employee (id, name, salary) "
"VALUES (:id, :name, :salary)");
query.bindValue(":id", line1->text().toInt());
query.bindValue(":name", line2->text());
query.bindValue(":salary",line3->text().toInt());
query.exec();and THE WEIRD IS ON MY ANOTHER COMPUTER IS WORK..ONLY AT MY LAPTOP GOT PROBLEM. mysql version is same,my qt library version also same, the different only my windows 7 version. pro and home.
could you help me friends what the hell about this?thanks so much
-
Nice code trapping Mr Qxoz: and here is the result, so strange:
last Error QSqlError(2036, "QMYSQL3: Unable to bind value", "Using unsupported buffer type: -842150451 (parameter: 1)")
there is something weird about: "Using unsupported buffer type"
is it because of there is 2 sql installed on my machine? but another mysql is disabled already.again sir your help is on demand..I don't have any idea about this kind of error
-
I allocated the libmysql.dll to my binary aplication. but still can not, the most disturbing my feeling is why when I run the programon my computer, that program run smoothly and the data can be fetched/inserted properly otherwise in my laptop got problem such what I explained
-
I had similar problem. I develop application using SQLite and then move to MySQL. My bug was that I was using constructor
@
QSqlQuery query("SELECT .... ID=:id")
@
instead of
@
query.prepare("SELECT .... ID=:id")
@
On QSLite contructor warks ok, but not in MySQL. -
Sounds like you've got conflicting versions of MySQL. Make sure you're using the right dll on the non-working system.
See here: http://lists.mysql.com/mysql/215915