开发者

sqlite error in android

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.sqli开发者_如何学Pythonte.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?


there is a name which is like "name's" i.e this single quote is problem


Maybe one of your string TableName, fieldname or homevalue contains some quotation. print out the query first and see.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜