I am trying to execute INSERT
sqlite statements into my database using a method as follows:
public void insertBluetoothPath(String path, String build) {
String[] ColumnName = new String[1];
ColumnName[0] = "path";
SQLiteDatabase myDB = null;
myDB = this.openOrCreateDatabase(DB_PATH, MODE_PRIVATE, null);
myDB.execSQL("INSERT INTO phones VALUES(" + build + ", " + path + ");");
myDB.close();
}
and I m calling the method using
insertBluetoothPath(finalPath, phoneBuild);
with variables
String phoneBuild = Build.MODEL;
and String finalPath = "/mnt/sdcard"
然而,I m 发现一个yn错的例外
sqlite returned: error code = 1, msg = near "/": syntax error
Failure 1 (near "/": syntax error) on 0x2b3ca8 when preparing INSERT INTO phones VALUES(sdk, /mnt/sdcard); .
我如何在数据库中插入斜线? 提前感谢。