lundi 25 janvier 2016

Android SQLite Select Where statement Returning Null

I have a block of code in my DBHelper class to execute sqlite where statement but no matter what i do, it still returns NULL. the value to be used for the where clause is in this format

2016-01-14

below is the code in the dbhelper class.

public Cursor getSpecificEvents(String value){
    //String buildSQL = "SELECT * FROM event WHERE eventdate='"+value.toString().trim()+"' ";

    String[] columns = new String[] {"_id","event","eventdate","description"};
    String[] args=new String[]{value.trim()};
    Cursor c=database.query("events", columns, "eventdate = ?", args, null, null,  "_id DESC");
    return c;   //return database.rawQuery(buildSQL, null);

}

Please what am I doing wrong and how do i correct it? thanks in advance

Aucun commentaire:

Enregistrer un commentaire