I want to write a Query to delete a row from the table. I have confused of writing the statement. I need some help in revising this.
db.delete(TABLE_NAME, "_id="+id, null);
I get my id from editText then put it into String id.
This is the way to get my id:
String id = editId.getText().toString();
If there’s not enough information to make you understand my problem, please tell me. I will add lacking parts.
I have find many data but I still cannot revise it. I would be thankful for your help.
This is my onCreate function:
public void onCreate(SQLiteDatabase db) {
final String INIT_TABLE = "CREATE TABLE " + TABLE_NAME + " (" +
_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
NAME + " CHAR, " +
TEL + " CHAR, " +
EMAIL + " CHAR);";
db.execSQL(INIT_TABLE);
}
As you said “I want to write a Query to delete a row from the table.”
you can call this function and pass id in it to delete row.