数据库类如何从android中的光标检索对应于特定字段的数据?
public boolean Permissions(String modulename) {
int createable, updateable;
Cursor cursor = db.rawQuery("select * from " + "moduleDesc" + " where "
+ "name" + "='" + modulename + "'", null);
if (cursor.getCount() > 0);
{
createable = cursor.getInt(cursor.getColumnIndex("createable"));
updateable = cursor.getInt(cursor.getColumnIndex("updateable"));
cursor.close();
}
if ((createable == 1) && (updateable == 1)) {
return true;
} else {
return false;
}
}
是我得到的错误是可创建cursor.getInt(cursor.getColumnIndex("createable"));
cursorindexoutofbounds虽然光标是有一些价值还是它给这个错误! thanx提前
在取数据之前,您需要先移动光标到第一条记录。 – 2012-07-27 12:27:14