lundi 15 juin 2015

select data according to Row in Sqlite

image i want to get the whole row i am using this code to get my desired data but its giving me null pointer exception at temp_address1 here is the code

String selectQuery = 
"SELECT * FROM notesDb WHERE PhoneNumber =?";
    Cursor c = mDbHelper.rawQuery(selectQuery, new String[] { value },      null);
    if (c.moveToFirst()) {
        String temp_address = c.getString(0);
        String temp_address1 = c.getString(1);
        System.out.println(temp_address);
        System.out.println(temp_address1);
    }

as in mentioned image i want to get the whole row matching phone number. how can i achive that result? phone number is the primary key here

Aucun commentaire:

Enregistrer un commentaire