通过写CRecordset::m_strFilter 串实现,如我要实现登陆用户名的检测,
CString user,psw;//程序运行时,获得数据
CDrecordSet u_lgSet;
u_lgSet.m_strFilter="[用户名]=? and [密码] =?"//这条语句应该怎么写?
if(!u_lgSet.EOF)
   MessageBox("Login Sucess!");
ps:MSDN上有资料,但可能我能力有限,照着做,没调出来,还望各位帮我解决!

解决方案 »

  1.   

    void aaa(CString userName,CString passwork)
    {
    CString s;
    s.Format("SELECT * FROM tableName where [用户名]=%s and [密码] =%s",userName,password);
    _lgSet.open(s.GetBuffer());
    }
      

  2.   

    试了下,Open错误,我的_lgSet设为CRecordSet派生类实例。
      

  3.   

    s.Format("SELECT * FROM tableName where [用户名]='%s' and [密码] ='%s'",userName,password);
    字符要加单引号' '
    看懂SQL再说 
      

  4.   

    Open错误的提示是什么?GetLastError返回的错误是什么?你的recordset有createInstance吗?