Hey all Im a newbie Androidian, and would love some help with this?
android.database.sqlite.SQLiteException: no such column: asd: , while compiling: DELETE FROM labels WHERE name=asd
this is the error am facing, and here's the code:
this is the method in the 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
}
and here's the main Activity code that invoke the method:
// 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();
}
});