【发布时间】:2013-01-24 14:15:06
【问题描述】:
我想更新我的 android 应用程序的 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 是我的表名 FACH 是一列
表格布局:
id (int) |名称(文本) |信息(文本)
【问题讨论】:
-
请显示 logcat 和您的 database.java 类
-
“我得到一个错误”绝对没有任何意义,除非你告诉我们错误是什么。我们无法读取您的想法或从我们所在的位置查看您的屏幕,我们也无法看到 logcat。如果您不向我们提供任何信息,我们将无法帮助您解决问题。
标签: android database sqlite sql-update