MFC的问题啊,连接access数据库,已经连接上了,我要做的是一个登陆系统,但是老是报错,大家帮忙看看
if(!m_AccessLink.Open(AFX_DB_USE_DEFAULT_TYPE,NULL))//这个函数几个参数都有缺省值{MessageBox("打开数据库...
if(!m_AccessLink.Open(AFX_DB_USE_DEFAULT_TYPE,NULL))//这个函数几个参数都有缺省值
{
MessageBox("打开数据库失败!");
}
if(!m_AccessLink.CanAppend())
{
AfxMessageBox("数据库不允许上传!");
}
m_AccessLink.AddNew();
UpdateData(true);
m_AccessLink.m_Name = m_ct1;
m_AccessLink.m_Password = m_ct3;
// bool passflag=false;
if(m_ct1==" "||m_ct3==" ")
{
AfxMessageBox("用户名或密码不能为空!");
}
m_AccessLink.MoveFirst();
while(!m_AccessLink.IsEOF())
{
if(m_AccessLink.m_Name == m_ct1 )
{
if (m_AccessLink.m_Password == m_ct3){
m_AccessLink.Close();
MessageBox("登录成功!");
}
}
else
{
m_AccessLink.MoveNext();
}
}
UpdateData(false);
m_AccessLink.Update();
m_AccessLink.Close();
}
m_ct1和m_ct3是编辑框,我一点登陆他就出现中止的错误,为什么啊??? 展开
{
MessageBox("打开数据库失败!");
}
if(!m_AccessLink.CanAppend())
{
AfxMessageBox("数据库不允许上传!");
}
m_AccessLink.AddNew();
UpdateData(true);
m_AccessLink.m_Name = m_ct1;
m_AccessLink.m_Password = m_ct3;
// bool passflag=false;
if(m_ct1==" "||m_ct3==" ")
{
AfxMessageBox("用户名或密码不能为空!");
}
m_AccessLink.MoveFirst();
while(!m_AccessLink.IsEOF())
{
if(m_AccessLink.m_Name == m_ct1 )
{
if (m_AccessLink.m_Password == m_ct3){
m_AccessLink.Close();
MessageBox("登录成功!");
}
}
else
{
m_AccessLink.MoveNext();
}
}
UpdateData(false);
m_AccessLink.Update();
m_AccessLink.Close();
}
m_ct1和m_ct3是编辑框,我一点登陆他就出现中止的错误,为什么啊??? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询