读书人

已知道是知道是有但不知

发布时间: 2012-01-12 22:11:58 作者: rapoo

已知道是知道是有,但不知道的原因,m_pConnection是theApp的全局量,且句在同一下的其他函中有,高手指教
UpdateData(true);
if(m_logid.IsEmpty()||m_pwd.IsEmpty())
{
AfxMessageBox("用名或密");
return;
}
else
{
CString sql="SELECT * FROM USERS where LOGINID='"+m_logid+"' and PSD='"+m_pwd+"''";


try
{

m_pRecordset.CreateInstance("ADODB.Recordset");

有//m_pRecordset->Open((_variant_t)sql,
_variant_t((IDispatch)theApp.m_pConnection,true),
adOpenStatic,
adLockOptimistic,
adCmdText
)

if(m_pRecordset->adoEOF)

MessageBox("不成功");

else
{

theApp.name=(LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("NAME");
theApp.pwd=m_pwd;
CDialog::OnOK();
return;
}
m_pRecordset->Close();
}
catch(_com_error e)
{
CString temp;
temp.Format("常原因",e.ErrorMessage());
AfxMessageBox(temp);
return;
}
}

}

[解决办法]
异常信息是什么?
m_pRecordset.CreateInstance( _uuidof(Recordset));

[解决办法]
你的LOGINID和PSD是什么类型?
如果不是文本类型不用加单引号
[解决办法]
点上面的"管理帖子"

读书人网 >VC/MFC

热点推荐