Android Sqliteexception: Near ",": Syntax Error: , While Compiling Insert
I'm trying to insert values into table public class DatabaseHandler extends SQLiteOpenHelper { private final static String INSERT_INTO_COUNTRIES = 'INSERT INTO ' + TABLE_COUNTR
Solution 1:
The multi-values syntax was introduced in sqlite version 3.7.11
Sqlite version 3.7.11 is only in Android 4.1 and up.
Split your inserts into separate inserts, one row at a time.
Solution 2:
It'll be easier to spot if you print out the SQL INSERT string.
But even if you fix the problem, this is still a bad way to go. You ought to be using PreparedStatement
to escape and bind variables. It'll be less error prone. You'll be safer from SQL injection attacks as an added bonus.
Post a Comment for "Android Sqliteexception: Near ",": Syntax Error: , While Compiling Insert"