嘿所有我是一个新手安卓,并希望对此有所帮助?
android.database.sqlite.sqliteException:没有这样的列:asd :,编译时:DELETE FROM标签WHERE name = asd
这是DBhelper中的方法:
/** * Delete a label table * */ public void deleteLabel(String label) { sqliteDatabase db = this.getWritableDatabase(); // ContentValues values = new ContentValues(); // values.remove(label); // Deleting Row db.delete(TABLE_LABELS,KEY_NAME + "=" + label,null); db.close(); // Closing database connection }
// for spinner onItemListener // and here is what label is final String label = parent.getItemAtPosition(position).toString(); Button dialogDeletelButton = (Button) dialog .findViewById(R.id.deleteButton); dialogDeletelButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // database handler DatabaseHandler db = new DatabaseHandler( getApplicationContext()); // inserting new label into database db.deleteLabel(label); // Hiding the keyboard InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(inputLabel.getWindowToken(),0); // loading spinner without the deleted data loadSpinnerData(); } });