我的数据表里面有两个字段 Name 和 Age
代码如下:
void CConnecttDlg::OnBtnOk()
{
// TODO: Add your control notification handler code here
CString strsql;
_variant_t strQuery;
UpdateData(TRUE);
if(m_strLoginName.IsEmpty())
{
AfxMessageBox("请输入用户名:");
return ;
}
strQuery="SELECT * FROM table WHERE Name='"+m_strLoginName+"'AND Age='"+m_strPasswd+"'";
theApp.ADOExecute(theApp.m_pRs,strQuery);
int iCount = theApp.m_pRs->GetRecordCount();
if(0 == iCount)
{
AfxMessageBox("用户名错误");
m_strLoginName="";
m_strPasswd="";
UpdateData(false);
}
else
{
Name = m_strLoginName;
::Sleep(300);
OnOK();
CMainDlg dlg;
dlg.DoModal();
}
}
void CConnecttDlg::OnBtnCal()
{
// TODO: Add your control notification handler code here
OnCancel();
}
报错是0\MSDev98\MyProjects\connectt\connecttDlg.cpp(202) : error C2065: 'Name' : undeclared identifier
D:\My Documents\VC6.0\MSDev98\MyProjects\connectt\connecttDlg.cpp(202) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class CString' (or there is no acceptable conversion)
Error executing cl.exe.
大家帮我看一下怎么改 谢谢了啊 去掉Name = m_strLoginName; 虽然不报错了 但是不能正常运行