lundi 3 août 2015

Cant update row in SQlite android using cursor

I have this updateID method :

 public void updateID1(String newID , String rowId){
    SQLiteDatabase db =helper.getWritableDatabase();

    ContentValues cv=new ContentValues();
    Cursor mCursor = db.rawQuery("select * from " + helper.TABLE_NAME + " where " + helper.UID + "='" + rowId + "'", null);
    if(mCursor.moveToFirst()) {

        long a = mCursor.getLong(mCursor.getColumnIndex(helper.UID));
        int index0=mCursor.getColumnIndex(helper.UID);
        String uid = mCursor.getString(index0);
        cv.put(helper.KEY_CARD_IN_BASE_ID,newID);
        String[] whereArgs ={uid};

        db.update(helper.TABLE_NAME, cv, helper.UID + " =? ", whereArgs);

        mCursor.close();

        }

 }

Using this method i find row by its ID(helper.UID) , now i want to update first row , which contains this ID, but nothing happend. I check in logs , all values are recieved correctly.Where is my mistake? I have read different manuals, but no one help

Aucun commentaire:

Enregistrer un commentaire