我在一个应用程序中创建了一个函数,用于检查数据库中的用户名和密码,但我得到了那个错误
07-02 00:31:09.619: E/Cursor(345): Finalizing a Cursor that has not been deactivated or closed. database = /data/data/sbn.project.gp/databases/users, table = null, query = SELECT name,password FROM users WHERE name='khaled'and password='1234'
这是我的代码
public Boolean check(String nameS, String passwordS) {
// TODO Auto-generated method stub
Cursor c = null;
Boolean check = true;
c = ourDatabase.rawQuery("SELECT name,password FROM users WHERE name='"
+ nameS + "'" + "and password='" + passwordS + "'", null);
if (c.getCount() > 0) {
check = false;
return check;
}
c.close();
return check;
}