how to insert an ' in a database
hi,
i have an application which stores string that contain the character <'>.
this is also the delimiter of an value in a insert statement. so how can
i add a string which contains a ' in a access database?
example:
insert <R'w>:
INSERT INTO table1 (header1, header2) VALUES ('abc', 'R'w')
any hint?
best regards,
jh
Re: how to insert an ' in a database
It might depend on database, but in PostgreSQL you can use '' or \'.
BTW. In Qt there is QSqlQuery::bindValue() which handles this automatically.
Re: how to insert an ' in a database
it is an MS Access database using ODBC.
bindValue has some problems adding strings to a column of type memo
which are longer than 128 characters.
jh
Re: how to insert an ' in a database
In SQL, use an extra ['][\] to escape your ['] char, that is:
I 'm a boy. => I ''m a boy.
or
I 'm a boy. => I \'m a boy.