2017-11-10 14 views
0

異なる値を入力してテーブルのすべての行を更新したいとします。お願い助けて。私のコードデータベース値が異なるすべてのテーブルを更新する

public boolean updateData(String id,String name, String number_phone, String about, Integer price, String color){ 
    SQLiteDatabase db = this.getWritableDatabase(); 
    ContentValues contentValues = new ContentValues(); 
    contentValues.put(COL_1, id); 
    contentValues.put(COL_2, name); 
    contentValues.put(COL_3, number_phone); 
    contentValues.put(COL_4, about); 
    contentValues.put(COL_5, price); 
    contentValues.put(COL_6, color); 

    db.update(TABLE_NAME, contentValues, "ID = " + id, null); 
    return true; 
} 

答えて

0

変更あなたのdb.update声明

db.update(TABLE_NAME, //table 
      contentValues, // column/value 
      "ID = ?", // selections 
      id); 
私はIDを書き込むことはできません
+0

、プログラムは私にエラーを通知しますが、私は新しいString [] {ID}プログラムを書くとき私にエラーを教えてくれませんが、それは私の問題を解決しません – Djj

関連する問題