user1497684
user1497684

Reputation:

Cant update a row in sqlite table in android

I am trying to update a row which was already in sqlite table

using

    private void updateData(String Bid,String Bname1,String Bauthor1,String Bdesc1, byte[] image1, String Brating1, String Bprice1,String Bupdate1) 
            {
                   SQLiteDatabase db = placeData.getWritableDatabase();

                   ContentValues value;
                           value = new ContentValues();
                           value.put("id", Bid);
                           value.put("name", Bname1);
                           value.put("author", Bauthor1);
                           value.put("desc", Bdesc1);
                           value.put("url", image1);
                           value.put("rating",Brating1);
                           value.put("price",Bprice1);
                           value.put("updated_at",Bupdate1);
                           Log.w("Update yyy","yyy");
                           Log.i(Bid, Bid);
                           Log.i(Bname1, Bname1);
                           Log.e("Updating in sqlite",Bupdate1);
                         db.update("bcuk_book", value, "id"+"=?",new String []{String.valueOf(Bid)}); 
            }

But i cant able to update row into sqlite even i able to get all logs.Could any one suggest me correct approach for updating a row.Problem is the row is not updating into sqlite

Upvotes: 1

Views: 492

Answers (1)

Mehul Ranpara
Mehul Ranpara

Reputation: 4255

use this..

myDataBase.update("bcuk_book", value,"id="+Bid,null);

Upvotes: 1

Related Questions