Sqlite rawQuery返回0行

时间:2013-10-14 20:25:45

标签: java android sqlite

我多次尝试使用rawQuery()来获取值,但是光标总是返回0行,尽管有符合条件的有效行。这是我的代码:

public Cursor getChapIdForAudit(String auditid) {
    // TODO Auto-generated method stub

    //String sql="SELECT DISTINCT  ChapterID FROM Results WHERE AuditID = "+auditid;
Cursor c=   sp.rawQuery("SELECT ChapterID FROM Results WHERE AuditID ="+auditid,null);
    c.moveToFirst();
    return c;
}

来电者代码:

protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

        Intent i= getIntent();
        String auditid=i.getExtras().getString("audit_id");

        ResultsTableManager results= new ResultsTableManager(ScoringRecordsActivity.this);
        results.open();
    Cursor chapIdCursor=null;
    chapIdCursor= results.getChapIdForAudit(auditid);

    System.out.println(chapIdCursor.getCount());



    }

0 个答案:

没有答案