кусок кода для обновления БД raw:
private EditText et;
//...
private void updateRecipe(){
SQLiteDatabase db=recipes.getWritableDatabase();
ContentValues values=new ContentValues();
values.put(RECIPE, et.getText().toString());
db.update(RECIPES_TABLE, values, "id=?", new String[]{id});
}
При запуске возникает ошибка:
Error updating recipe=Efrerer using UPDATE recipes SET recipe=? WHERE id=?
android.database.sqlite.SQLiteException: no such column: id: , while compiling: UPDATE recipes SET recipe=? WHERE id=?
Это мои SQL-запросы:
@Override
public void onCreate(SQLiteDatabase db){
db.execSQL("CREATE TABLE "+CATEGORY_TABLE+" ("+_ID+" INTEGER PRIMARY KEY AUTOINCREMENT, "+
CATEGORY_NAME+" TEXT NOT NULL);");
db.execSQL("CREATE TABLE "+RECIPES_TABLE+" ("+_ID+" INTEGER PRIMARY KEY AUTOINCREMENT, "+
RECIPE_NAME+" TEXT NOT NULL, "+CATEGORY_ID+" INTEGER, "+ RECIPE+" TEXT NOT NULL);");
}
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion){
db.execSQL("DROP TABLE IF EXISTS "+CATEGORY_TABLE);
db.execSQL("DROP TABLE IF EXISTS " +RECIPES_TABLE);
}