我想用Android的SQLiteDatabase类的原生update-method更新我的SQL lite数据库.
ContentValues dataToInsert = new ContentValues();
dataToInsert.put("name", "flo");
dataToInsert.put("location", "flotown");
String where = "id" + "=" + id;
try{
db.update(DATABASE_TABLE, dataToInsert, where, null);
}
catch (Exception e){
String error = e.getMessage().toString();
}
但我有以下错误:
android.database ase.sqlite.SQLiteException:Near"15":语法错误:, 编译时:更新MyTable集合位置=?,名称=?哪里 ID=2010-09-21 15:05:36.995
我不知道应该是什么问题.不知怎的,这些值没有到达SQL语句中.我用insert方法做了几乎相同的事情,效果非常好.