摘要:
在用SQLiteDatabase的时候如果碰到说database或者cursor没有关闭,可以在使用完之后加上: if (!cursor.isClosed()) { cursor.close(); } if(db!= null) { db.close();//db是数据库对象 } 阅读全文
摘要:
Cursor cursor = db.query(true, "user", new String[]{"id","mode"}, "id=?", new String[]{"1"}, null, null, "1,2", null);cursor.moveToNext();如上,在用数据库的Cursor的moveToNext方法时,出现了题中的报错。经百度,发现这两句需要放在public方法中才行。放入public void onCreate() 方法中之后错误消失。 阅读全文
摘要:
where子句,为什么db.update("user", cva, "id=?", new String[]{"1"});如果填入2就不行,填1才行。 阅读全文