jeudi 15 janvier 2015

SQLite query that contains special characters

I have to build SQLite database where I store some strings which has some special character, for most of the cases it is working find except this one



SELECT * FROM table1 WHERE use_id = 3B:02


It throws this errors



android.database.sqlite.SQLiteException: near ":02": syntax error (code 1):


How can I handle this when this "3B:02" is variable


Here is my query



selectQuery = "SELECT * FROM " + DataBaseHelper.TABLE_COM + " WHERE "
+ DataBaseHelper.COLUMN_USER_ID + " = " + value;

Aucun commentaire:

Enregistrer un commentaire