public Cursor selectRecords() {
Cursor mCursor = database.query("prescritions" ,new String []{"MAX(pres_no)"}, null, null, null, null,null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor; // iterate to get each value.
}
我创建了上面的查询以从 pres_no 列中读取最大值驻留在处方表中。但我收到以下错误
10-15 12:26:41.719: E/AndroidRuntime(629): java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.