MYsql exec() query probleme
my qt project isn't adding anything to database , he can remove , display and edit all the date in my mysqlDatabase except adding without giving me any error ... and he can also add in onther tab in the same database
You would have to show your code for this behaviour....
i am sorry ```
QSqlQuery qry ;
qry.prepare("INSERT INTO flight arrive VALUES(:arrive')");
return true ;
return false ;
is table name really "flight arrive" ?
If it really have a space, i think you need to quote it. please check mysql docs.
Also syntax looks a bit odd ?
QSqlQuery query; query.prepare("INSERT INTO employee (id, name, salary) " "VALUES (:id, :name, :salary)"); query.bindValue(":id", 1001); ...
qry.prepare("INSERT INTO flight (arrive) VALUES(:arrive')");
And doesn't your current code show an error message rather than
no tbale name is only flight and all i want to do is add a something in arrive coloum
@gdaboy So have you tried what I wrote above?
Unless it's a typo here you have a
arrivethat shouldn't be there.
@SGaist ...which is why it would be so helpful if people posted code in fixed/monospace font here...
yes i've tried that also
I know from other SQLs that
INSERT INTO <table> (<column1>, <column2>, ...) VALUES (<value1>, <value2>, ...), i.e. columns must be inside
()as well as values. I don't know whether MySQL accepts the column list without
(), so you may or may not need that also. Personally, I think it's clearer anyway to parenthesize them.
You should also post the error message returned for your query.
Also, what version of Qt are you using ?
thanks guy for helping
the probleme was in mysql engine !!! you have to add innobd engine to your table in mysql