Reputation: 67
I am new to Android and Window Azure.I have created a database in Azure and some Tables.now I successfully inserted data to the table but now I want to delete a row from that table.I have tried the following code but its not working and the amulater gets hing .Please help me to solve this problem
//code use for delete.
del.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final MobileServiceTable<Test> mtest;
mtest=mClient.getTable(Test.class);
try {
final MobileServiceList<Test>res=mtest.where().field("fullname").eq("hanan").execute().get();
mtest.delete("res");
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}
});
In the above code I just tried to delete the row whose fullname field =="hanan"
Upvotes: 1
Views: 415
Reputation: 13918
If you are using Moblie Service with SQL database as a backend server, there are 2 ways to delete an item form table referred on official guide
A, mTable.delete(item)
B, mTable.delete(IDString)
However, in your code:
mtest.delete("res");
you used a string in delete function, Azure will delete the row with id field equl “res”.
Upvotes: 1