Guest User

Untitled

a guest
Aug 14th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. Include slashes in sqlite insert statements
  2. public void insertBluetoothPath(String path, String build) {
  3.  
  4. String[] ColumnName = new String[1];
  5. ColumnName[0] = "path";
  6.  
  7. SQLiteDatabase myDB = null;
  8. myDB = this.openOrCreateDatabase(DB_PATH, MODE_PRIVATE, null);
  9.  
  10. myDB.execSQL("INSERT INTO phones VALUES(" + build + ", " + path + ");");
  11. myDB.close();
  12.  
  13. }
  14.  
  15. sqlite returned: error code = 1, msg = near "/": syntax error
  16.  
  17. Failure 1 (near "/": syntax error) on 0x2b3ca8 when preparing 'INSERT INTO phones VALUES(sdk, /mnt/sdcard);'.
  18.  
  19. myDB.execSQL("INSERT INTO phones VALUES('" + build + "', '" + path + "');");
  20.  
  21. myDB.execSQL("INSERT INTO phones VALUES(" + build + ", " + "'" + path + "'" + ");");
Add Comment
Please, Sign In to add comment