binary001
23rd April 2016, 16:36
Hi,
I want to save some sentences into sqlite database. These sentences contains mixed single quotes and qouble quotes.
sample sentence is:
Homer Simpson said: "Maybe, just once, someone will call me 'Sir' without adding 'you're making a scene'."
I want to assign these words to string and then insert into database.
QString str1 ="Homer Simpson said: "Maybe, just once, someone will call me 'Sir' without adding 'you're making a scene'."";
str1.replace(QString("'"),QString("\'"));
str1.replace(0x22,QString("\""));
query->exec("insert into greatquote values(" + QString::number(intNo) + ", '" + str1 + "')";
Sample sentence can't assign to str1. How can I change these words with escape special characters? Which functions I use?
Finally how to insert these into sqlite database?
Thanks
I want to save some sentences into sqlite database. These sentences contains mixed single quotes and qouble quotes.
sample sentence is:
Homer Simpson said: "Maybe, just once, someone will call me 'Sir' without adding 'you're making a scene'."
I want to assign these words to string and then insert into database.
QString str1 ="Homer Simpson said: "Maybe, just once, someone will call me 'Sir' without adding 'you're making a scene'."";
str1.replace(QString("'"),QString("\'"));
str1.replace(0x22,QString("\""));
query->exec("insert into greatquote values(" + QString::number(intNo) + ", '" + str1 + "')";
Sample sentence can't assign to str1. How can I change these words with escape special characters? Which functions I use?
Finally how to insert these into sqlite database?
Thanks