我想對我的Android應用程序的sqlite數據庫進行更新,但在更新方法中出現錯誤。如何更新sqlite數據庫?
我的代碼:
public void addInfo(View view){
EditText et = (EditText)findViewById(R.id.txtContacto);
String TAG = ((TextView)findViewById(R.id.textView2)).getText().toString();
String FACH = ((TextView)findViewById(R.id.textView1)).getText().toString();
ContentValues werte = new ContentValues();
werte.put("info",et.getText().toString());
mDatenbank.update(TAG, werte, "name="+FACH, null);
Toast.makeText(this,
getResources().getString(R.string.db_info_add),
Toast.LENGTH_SHORT).show();
}
TAG是我的tablename FACH是一列
表佈局:
ID(INT)|名稱(文本)| info(文本)
請出示logcat的和你database.java類 – Opiatefuchs
「我得到一個錯誤」是指絕對沒有除非你告訴我們**錯誤是什麼**。我們無法閱讀您的想法或從我們的位置看到您的屏幕,也無法看到logcat。如果您沒有提供任何信息,我們無法幫助您解決問題。 –