从SQLite中检索数据

时间:2014-05-01 11:07:52

标签: android sqlite

我正在从数据库中检索数据,但它在Cursor中返回null,我的代码是

public Cursor getData() {
    // TODO Auto-generated method stub
    String [] s;
    String[] columns = new String[]{KEY_ROWID, KEY_QUESTION, KEY_COption, KEY_OPTION2,
            KEY_OPTION3,KEY_OPTION4,KEY_SUBJECT };
    Cursor c = myDb.query(QUIZ_TABLE, columns, KEY_SUBJECT + " = " + category , null, null, null, null);
    if(c != null)
    {
        return c;
    }
    else
    {
        return null;
    }
}

这里KEY_SUBJECT是一个具有整数值的列,category是一个Integer变量。但它在Cursor中返回null。

0 个答案:

没有答案
相关问题