Reputation: 13165
I am getting the value from webservice. I am storing in sqlite. While storing in sqlite, I am getting an error. even I replaced single quote with "\'". Which characters are not supported in sqlite?
My error is:
03-26 13:22:22.478: WARN/System.err(311): android.database.sqlite.SQLiteException: near "s": syntax error:
My insert statement is:
myDB.execSQL("INSERT INTO "+TableName
+"("+fieldname+")"
+" VALUES ('"+(homevalue)+"');");
Can anybody tell what to do or give an example?
Upvotes: 0
Views: 486
Reputation: 1522
there is a name which is like "name's" i.e this single quote is problem
Upvotes: 1
Reputation: 219
I am just a beginner, but i think you should write it like this:
"INSERT INTO " + tableName + "(" + feildName + ") VALUES ('" + homeValue + "');"
you put () around the homeValue
Upvotes: 0
Reputation: 992
Maybe one of your string TableName, fieldname or homevalue contains some quotation. print out the query first and see.
Upvotes: 0