mRowIdColumnIndex我需要檢查,如果已經有在我的數據庫一列的值,所以我寫了這個代碼,可以這樣做:SQLite的查詢返回-1
public Cursor getTitle(long rowId) throws SQLException {
Cursor mCursor = db.query(DATABASE_TABLE, new String[]
{KEY_TOTAL_HOURS, KEY_TOTAL_MINUTES}, KEY_ROWID +"=" + rowId, null, null, null, null);{
mCursor.moveToFirst();
return mCursor;
}
}
但光標我回來給出
android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
怎麼了?
我認爲這是這個問題的一個副本: http://stackoverflow.com/questions/5316336/cursor-index-out-of-bounds-index-0-requested-with-size-0 – Pramod