mfc大神,求问下面这段程序定义的用户名和密码是什么格式的?
HCURSORCBooKMangerDlg::OnQueryDragIcon(){return(HCURSOR)m_hIcon;}voidCBooKMangerDlg::...
HCURSOR CBooKMangerDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CBooKMangerDlg::OnLogin()
{
CString type;
UpdateData(FALSE);
UpdateData(TRUE);
/* ExcleDatabase data;
CString sSql;
UpdateData(TRUE);*/
//char a[20]="a1";
//char b[20]="a1";
// TODO: Add your control notification handler code here
/* CRecordset recset(&data.database);
if (((CButton*)GetDlgItem(IDC_REANDER))->GetCheck())//0
{
sSql="select * from [user$] where id= '";
sSql=sSql+ m_user +"' and password ='";
sSql=sSql+m_password;
sSql=sSql+ "'and type =0";
//sSql="select * from [user$] where id='"+a+"' and password ='"+b+"'and type ='0'";
//sSql="select * from [user$] where id='a1' and password ='a1' and type =0";
recset.Open(CRecordset::forwardOnly, sSql, CRecordset::readOnly);
//if(recset.GetRecordCount()==0)*/
CString id,passwd;
m_user.GetWindowText(id);
m_passwd.GetWindowText(passwd);
if (((CButton*)GetDlgItem(IDC_REANDER))->GetCheck())//0
{
type="0";
for(int i=0;i<userlist.size();i++)
{
if(0==id.Compare(userlist[i].userid.c_str())&&
0==passwd.Compare(userlist[i].password.c_str())
&&type.Compare(userlist[i].type.c_str())==0)
{
break;
}
}
if(i>=userlist.size())
{
AfxMessageBox("用户名或密码错误 ");
return;
}
AfxMessageBox("登录成功!");
CReaderManager mydlg;
mydlg.setuser(id);
mydlg.DoModal();
}
else if (((CButton*)GetDlgItem(IDC_MANAGER))->GetCheck())//1
{
type="1";
/* sSql="select * from [user$] where id= '";
sSql=sSql+ m_user +"' and password ='";
sSql=sSql+m_password;
sSql=sSql+ "'and type =1";
//sSql="select * from [user$] where id='"+a+"' and password ='"+b+"'and type ='0'";
//sSql="select * from [user$] where id='a1' and password ='a1' and type =0";
recset.Open(CRecordset::forwardOnly, sSql, CRecordset::readOnly);
//if(recset.GetRecordCount()==0)
if(recset.IsEOF())
{
AfxMessageBox("用户名或密码错误 ");
return;
}
else
{
AfxMessageBox("登录成功!");
CManager mydlg;
mydlg.DoModal();
}
}*/
for(int i=0;i<userlist.size();i++)
{
if(0==id.Compare(userlist[i].userid.c_str())&&
0==passwd.Compare(userlist[i].password.c_str())
&&type.Compare(userlist[i].type.c_str())==0){
break;
}
}
if(i>=userlist.size())
{
AfxMessageBox("用户名或密码错误 ");
return;
}
AfxMessageBox("登录成功!");
CManager mydlg;
mydlg.DoModal();
}
} 展开
{
return (HCURSOR) m_hIcon;
}
void CBooKMangerDlg::OnLogin()
{
CString type;
UpdateData(FALSE);
UpdateData(TRUE);
/* ExcleDatabase data;
CString sSql;
UpdateData(TRUE);*/
//char a[20]="a1";
//char b[20]="a1";
// TODO: Add your control notification handler code here
/* CRecordset recset(&data.database);
if (((CButton*)GetDlgItem(IDC_REANDER))->GetCheck())//0
{
sSql="select * from [user$] where id= '";
sSql=sSql+ m_user +"' and password ='";
sSql=sSql+m_password;
sSql=sSql+ "'and type =0";
//sSql="select * from [user$] where id='"+a+"' and password ='"+b+"'and type ='0'";
//sSql="select * from [user$] where id='a1' and password ='a1' and type =0";
recset.Open(CRecordset::forwardOnly, sSql, CRecordset::readOnly);
//if(recset.GetRecordCount()==0)*/
CString id,passwd;
m_user.GetWindowText(id);
m_passwd.GetWindowText(passwd);
if (((CButton*)GetDlgItem(IDC_REANDER))->GetCheck())//0
{
type="0";
for(int i=0;i<userlist.size();i++)
{
if(0==id.Compare(userlist[i].userid.c_str())&&
0==passwd.Compare(userlist[i].password.c_str())
&&type.Compare(userlist[i].type.c_str())==0)
{
break;
}
}
if(i>=userlist.size())
{
AfxMessageBox("用户名或密码错误 ");
return;
}
AfxMessageBox("登录成功!");
CReaderManager mydlg;
mydlg.setuser(id);
mydlg.DoModal();
}
else if (((CButton*)GetDlgItem(IDC_MANAGER))->GetCheck())//1
{
type="1";
/* sSql="select * from [user$] where id= '";
sSql=sSql+ m_user +"' and password ='";
sSql=sSql+m_password;
sSql=sSql+ "'and type =1";
//sSql="select * from [user$] where id='"+a+"' and password ='"+b+"'and type ='0'";
//sSql="select * from [user$] where id='a1' and password ='a1' and type =0";
recset.Open(CRecordset::forwardOnly, sSql, CRecordset::readOnly);
//if(recset.GetRecordCount()==0)
if(recset.IsEOF())
{
AfxMessageBox("用户名或密码错误 ");
return;
}
else
{
AfxMessageBox("登录成功!");
CManager mydlg;
mydlg.DoModal();
}
}*/
for(int i=0;i<userlist.size();i++)
{
if(0==id.Compare(userlist[i].userid.c_str())&&
0==passwd.Compare(userlist[i].password.c_str())
&&type.Compare(userlist[i].type.c_str())==0){
break;
}
}
if(i>=userlist.size())
{
AfxMessageBox("用户名或密码错误 ");
return;
}
AfxMessageBox("登录成功!");
CManager mydlg;
mydlg.DoModal();
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询