已經知道是知道是標記處有問題,但不知道問題的原因,m_pConnection是theApp的全局變量,並且這句在同一個類下的其他函數中沒有問題,高手指教解决办法
已經知道是知道是標記處有問題,但不知道問題的原因,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是什么类型?
如果不是文本类型不用加单引号
------解决方案--------------------
点上面的"管理帖子"
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是什么类型?
如果不是文本类型不用加单引号
------解决方案--------------------
点上面的"管理帖子"