0

我正在尝试使用 where 子句选择成员 ID 和密码来验证用户凭据。但据说这个专栏不存在...我尝试在互联网上搜索各种方法但没有帮助...请帮助我..这是我的代码

public boolean memberlogin(String member_id,String password)throws SQLException{
String[] result=new String[]{member_id,password};
String whereclause="member_id=? AND password=?";
Cursor cur=sdb.query(DB_TABLE, result, whereclause, null, null, null, null);
if(cur!=null)
{
    if(cur.getCount()>0)
    {
        return true;
    }
}
return false;

}
4

1 回答 1

3

Well you seem to be using the the arguments in wrong place
Try This,

  String[] columns =new String[]{ COLUMN_ID_NAME ,COLUMN_PASSWORD_NAME};
  String[] result=new String[]{member_id,password};
  String whereclause="member_id=? AND password=?";
  Cursor cur=sdb.query(DB_TABLE, columns , whereclause, result, null, null, null);
于 2012-07-22T11:28:40.963 回答