tags:

views:

34

answers:

1

Hi all I create a table like that

private static final String CREATE_TABLE_PRODUCT =
 "create table prod (id integer primary key,titre text not null, desc text, is_free integer);";

i update it this way

    SQLiteDatabase db = getConnection();
    ContentValues updateEvent = new ContentValues();
    updateEvent.put("is_free", 1);

    int ok = db.update(prod, updateEvent, "id=?",
            new String[] { Long.toString(evenement.getId()) });

    db.close();

I do see the change in eclipse with DDMS questoid

but when i try to retrieve the value I get nothing ....

        Cursor c = db.query(prod, new String[] { "id",
                "titre", "desc", "is_free", }, 
                 "is_free=?", new String[] {"1"}, null, null,
                null);

I've tried some variant like

    String query = "SELECT * FROM "+EVENEMENT_TABLE+" WHERE is_free=1;";
    Cursor c = sdb.rawQuery(query, null);

with no success

is this problem come from the type (integer) of my column ? Any help

A: 

Do not use reserved keywords like desc in your queries. This probably causes query to fail. In case you don't know update will not add values to the table. Use insert instead.

cement