QSQL error on insert into statement
Hi, I'm working on a program where I get user input and insert that value to my database. At the moment, I'm getting the following error:
Quote:
QSqlError(-1, "Unable to fetch row", "No query")
But I know thats its not my coding because when I try a select statement, it works fine with no problems. My INSERT INTO statement is as follows:
Code:
str = pLineEdit->text();
QString qry
= QString("INSERT INTO customer (name, phone_no, address, city) VALUES ('%%1%', NULL, NULL, NULL").
arg(str
);
Is my INSERT statement correct?
Re: QSQL error on insert into statement
Figured it out, syntax wasn't correct, all good and working now!
Re: QSQL error on insert into statement
Good, but seriously take a look at QSqlQuery::prepare() to avoid SQL-Injections.
Re: QSQL error on insert into statement