I have a database called "Users" and a table in that database called "contact". i want to delete a selected contact when I click a button. I want to know how to set the parameters correctly to the delete method. if somebody can gimme an answer with a little example i will be delighted .
my code goes like this
private void deleteContact(String name) {
SQLiteDatabase database=openOrCreateDatabase("Users",MODE_PRIVATE,null);
int res=database.delete("contact", "name =", name);
///
}
I call this method when I click that Button. my query is,
"delete from contact where name ='"+name+"';
Aucun commentaire:
Enregistrer un commentaire