Skip to content Skip to sidebar Skip to footer

How To Update Integer Value In Sqlite Android

i am having problem with the updation part of the below code. insertion is working properly. when i added the update method for addition/subtraction of the integer stored in the da

Solution 1:

You can update any value in your table by below method:

public void updateInteger(Integer newID)
    {
        try{
            sqliteDb = appDb.getWritableDatabase();
            String rawQuery = "update <table_name> set id="+newID;
            sqliteDb.rawQuery(rawQuery, null);
            Log.v(TAG, "ID updated");
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }
    }

Post a Comment for "How To Update Integer Value In Sqlite Android"