Skip to content Skip to sidebar Skip to footer

Updating Sql Table Data In Android Applcation

I'm trying to update my local android app database data , I used the update query: public void addQTY(String changedQTY, String changedPNAme) { String addQuery = 'UPDATE' + SQL

Solution 1:

Give space after WHERE and UPDATE cause

String addQuery = "UPDATE " + SQLITE_TABLE + 
        " SET "+ qty+"='"+ changedQTY +"'" +
        " WHERE " +PRODUCT_NAME + "='" + changedPNAme + "';

OR

ContentValues values = new ContentValues();
values.put("qty", changedQTY);
mDb.update(SQLITE_TABLE , values, PRODUCT_NAME + "='" + changedPNAme + "'", null);

Post a Comment for "Updating Sql Table Data In Android Applcation"