BUG in MYSQL Plugin
-
wrote on 11 Dec 2014, 11:23 last edited by
Hi everyone,
I'm tryinig to execute the following SQL query:QSqlQuery query;
@
query.prepare("INSERT INTO osoby (idosoby, Imie, Nazwisko, DataUrodzenia) "
"VALUES (?, ?, ?, ?)");
QString data=this->dataUrodzenia.toString();
query.bindValue(0,999);
query.bindValue(1,this->imie);
query.bindValue(2,this->nazwisko);
query.bindValue(3,this->dataUrodzenia.toString());
query.exec();
@Correct name of table is "osoby" if i type this name in query,this doesnt execute.
If i type a name of table that doesnt exist query will execute.[edit: added missing coding tags @ SGaist]
-
wrote on 11 Dec 2014, 11:39 last edited by
If
@query.exec(); @return false, Check what return:
@query.lastError().text();@
-
wrote on 11 Dec 2014, 15:29 last edited by
Both queries return no errors.
"INSERT INTO osoby (idosoby, Imie, Nazwisko, DataUrodzenia) VALUES (?, ?, ?, ?)""INSERT INTO osoby1 (idosoby, Imie, Nazwisko, DataUrodzenia) VALUES (119, 'dsf', 'dsf', 'So sty 1 2000')"
-
wrote on 11 Dec 2014, 16:17 last edited by
I found the solution.I changed the following 2 line commands:
QSqlQuery query; query.prepare(“INSERT INTO osuob (idosoby, Imie, ########) “ “VALUES (?, ?, ?)”);
to this one:QSqlQuery query(“INSERT INTO osoby (Imie, ########, DataUrodzenia) “ “VALUES (?, ?, ?)”);
Thanks for help
1/4