dimanche 26 avril 2015

Android How to Update column without the key in where clause

I have a table with an auto-increment key. But in my table the couple "UserID" , "CardID" is unique. I want to update a column using only UserID and CardID in the where clause. I don't want to use the key, is it possible?.

So my table have the following column : ID( the key) | UserID | cardID | isInMazzo| . I'm try to update the column isInMazzo in the following way:

String query = "UPDATE " +  MyCardsMetaData.TABLE_MYCARDS
            + " SET " + MyCardsMetaData.ISINMAZZO + " = ? "
            + " WHERE " + MyCardsMetaData.USERID + " = ? AND " + MyCardsMetaData.CARDID + " = ?";

mDb.rawQuery(query, new String[]{isInMazzo, String.valueOf(userID), String.valueOf(cardID)});

What happens when i execute this query? i'am having a lot of problem.

Aucun commentaire:

Enregistrer un commentaire