Yaq*_*mad 10 sqlite android cursor illegalstateexception
在Android中使用SQLiteCursor时,我发现getColumnIndex()的行为区分大小写,例如:
例:
Column Name in DB was: Rules
cursor.getColumnIndex("Rules") //workes fine
cursor.getColumnIndex("rules") //throws error, see the error detail
Run Code Online (Sandbox Code Playgroud)
文档没有说明这一点,详情 请看这个.
LogCat说:
java.lang.IllegalStateException:无法从CursorWindow读取第0行col -1.在从中访问数据之前,请确保正确初始化Cursor
我对SQLiteCursor的这种行为感到困惑,有人可以帮助我这是真的还是我做错了什么?如果需要,我可以提供代码.
谢谢.
getColumnIndex()区分大小写:
DB中的列名称为:规则
cursor.getColumnIndex(“ Rules ”) //工作正常
cursor.getColumnIndex(“ rules ”)//引发错误,请参见错误详细信息
| 归档时间: |
|
| 查看次数: |
7995 次 |
| 最近记录: |