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