我触摸按钮,没有任何反应。
它只显示书面文字,我要删除的行仍保留在表格中。
public void deleteword (View view) {
db=openOrCreateDatabase("MyDB1",MODE_PRIVATE, null);
EditText deleteword=(EditText)findViewById(R.id.deleteword);
String delete = deleteword.getText().toString();
db.execSQL("DELETE FROM Word WHERE uword='"+delete+"'");
Toast toast = Toast.makeText(getApplicationContext(), delete, Toast.LENGTH_SHORT);
toast.show();
}
答案 0 :(得分:0)
试试这个
String delete = deleteword.getText().toString();
db.delete(Word, uword+"=?", new String[] (delete));
参考值; http://developer.android.com/training/basics/data-storage/databases.html#DeleteDbRow