在我的应用程序中,我读取了一些添加到数据库中的值,并将它们插入到微调器中。我想删除我想要的任何值,但错误消息表示没有具有该名称的列。即使我的微调器充满了值。错误信息:
android.database.sqlite.SQLiteException: no such column: bmw (code 1), while compiling: DELETE FROM MyCars WHERE MyCarsBrand=bmw at android.database.sqlite.SQLiteConnection.nativePrepareStatement
这是我的代码:
if (db.deleteTitle(deleteSpinner.getSelectedItem().toString()))
Toast.makeText(DeleteCarActivity.this,
"Delete successful.", Toast.LENGTH_LONG).show();
else
Toast.makeText(DeleteCarActivity.this, "Delete failed.",
Toast.LENGTH_LONG).show();
db.close();
其他类
public boolean deleteTitle(String rowId)
{
return db.delete(MY_CARS_TABLE, MY_CARS_BRAND_COLUMN +
"=" + rowId, null) > 1;
}