Make sure the Cursor is initialized correctly before accessing data from it.
2013-11-07 19:23
621 查看
详细错误是:java.lang.IllegalStateException: Couldn't read row 0, col 2 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
出现这个原因是因为我在获取Cursor中的字段时,获取了一个不存在的字段,例如,我原本要获取数据库book表中的bookId字段,结果获取的时候写成了bookiD,
注意:Android是区分大小写的,所以我们在获取的时候也要严格按照数据库表字段的大小写来获取数据;
出现这个原因是因为我在获取Cursor中的字段时,获取了一个不存在的字段,例如,我原本要获取数据库book表中的bookId字段,结果获取的时候写成了bookiD,
while (cursor.moveToNext()) { int bookId = cursor.getInt(cursor.getColumnIndex("bookiD")); }
注意:Android是区分大小写的,所以我们在获取的时候也要严格按照数据库表字段的大小写来获取数据;
相关文章推荐
- 程序基石系列之类的声明Class declaration
- apt-get install-路径
- Stephen P. Boyd convex lecture notes
- LeetCode Path Sum II路径和II
- CKEditor和FCKEditor的使用记录
- UVa 11332 Summing Digits (water ver.)
- Redhat/CentOS6.2 x86系统KVM虚拟机网络配置(二)—Bridge方式
- 韩国vieworks
- Redhat/CentOS6.2 x86系统KVM虚拟机网络配置(一)—NAT方式
- Linux分区
- Linux下调试段错误的方法[Segmentation Fault]
- 五个小球完全弹性碰撞
- 增加难度的抽签问题(最内层使用二分法)
- What does grep stand for in Linux operating system?
- hdu 1544 水题
- php应用数据库连接中的单例模式
- 【Android】菜单功能的实现:使用Java代码
- 将java源码打成jar包的两种方法
- WordPress Think Responsive Themes ‘upload_settings_image.php’任意文件上传漏洞
- DELL-linux-风扇