当前位置: 代码迷 >> Android >> android SQLite 查询数据时总查不到,此前是可以的,求解啊
  详细解决方案

android SQLite 查询数据时总查不到,此前是可以的,求解啊

热度:16   发布时间:2016-05-01 15:08:18.0
android SQLite 查询数据时总查不到,以前是可以的,求解啊!
// 查询的封装的方法
private Cursor select_All() {

SQLiteDatabase db = this.getReadableDatabase();

Cursor cursor = db
.query(TABLE_NAME, null, null, null, null, null, null);

db.close();
System.out.println("cursor="+cursor.getCount());
return cursor;
}

------解决方案--------------------
db.close();
为什么要close?
------解决方案--------------------
最好是将cursor中的数据遍历到集合里面,再close掉
  相关解决方案