毕业设计求救!!!Runtime Error! ... abnormal program termination

来源:百度知道 编辑:UC知道 时间:2024/05/27 19:28:37
程序和数据库(SQLServer)打包上传,205KB,数据库还原到SQLServer就可以了,用户名和密码都是1,登入时就出现错误,下载地址:

请高手帮我看看哪里的问题,应该是登录界面的问题啊,尤其是:

if (pRecordset != 1)//若在Recordset对象中没有找到符合条件的记录
{
AfxMessageBox("用户或密码不正确!");//报错
m_LoginUser.Empty(); //置空
m_LoginPwd.Empty(); //置空
IfRegisted = false; //置标志位,未成功登录
}
else
IfRegisted = true; //置标志位,成功登录
下载地址:
http://www.fs2you.com/files/a7dc0717-09da-11dd-ace3-00142218fc6e/

帮你调了下,主要是登录对话框里面的OnOK函数出了问题。其实改动不大,主要是if (pRecordset != 1)//若在Recordset对象中没有找到符合条件的记录 这一句,应改为 if (pRecordset->adoEOF)

还要几处小错误,一并贴出来:
if(m_LoginUser.IsEmpty())
{
AfxMessageBox("用户不可为空!");
return;//返回重新输入,而不是继续校验用户名
}

if(m_LoginPwd.IsEmpty())
{
AfxMessageBox("密码不可为空!");
return;
}

后面的
if (pRecordset != 1)//若在Recordset对象中没有找到符合条件的记录
{
AfxMessageBox("用户或密码不正确!");
m_LoginUser.Empty();
m_LoginPwd.Empty();
IfRegisted = false;
return;//同上
}