I want to insert a string into the database that contains the character
'
To Insert: Hello I'm Drac.
I tried escape sequence but isn't working. Please help me Figure it out
Here's my Code.
private void insertchathead(String message) {
String experiment=message.replace("'","\\'");
Log.e("********","Ending L: --> "+experiment);
sd.execSQL("insert into chat(message)values('"+experiment+"');");
Log.e("************","inserted");
}
The Logcat Shows Syntax error. Here's the Error
Caused By : SQL(query) error or missing database.
(near "s": syntax error (code 1): , while compiling: insert into chat(message) values('what\'s your age');)