0

I am developing a app in android and here i want to fetch data from table according to rowId and subjectId but I am getting this error,

The method query(boolean, String, String[], String, String[], String, String, String, String) in the type SQLiteDatabase is not applicable for the arguments 
(boolean, String, String[], String, String, null, null, null, null)

And the here's that query,

public Cursor getText(long rowId, long subId) throws SQLException 
{
Cursor mCursor = db.query(true, DATABASE_TABLE, new String[] {
        KEY_id, KEY_ques,KEY_correctans,KEY_wrongans1,KEY_wrongans2,KEY_wrongans3,KEY_subject,KEY_subjectid }, KEY_id + "="
        + rowId, KEY_subjectid + "=" + subId,null,null, null,null);
if (mCursor != null) 
{
    mCursor.moveToFirst();
}
return mCursor;
}

I want to fetch table data as where subId = KEY_subjectid and rowId = KEY_id

If any thing is not clear in this question please ask me. And if its clear please help me..

Thanks in Advance.

4

2 に答える 2

0

こうすれば

public Cursor getText(long rowId, long subId) throws SQLException 
    {
    Cursor mCursor = db.rawQuery("select * from "+DATABASE_TABLE+" where KEY_subjectid="+subId+" and KEY_id="+rowId+"",null);
    if (mCursor != null) 
    {
        mCursor.moveToFirst();
    }
    return mCursor;
    }
于 2013-09-25T06:39:49.003 に答える