B
bjwdxs
Unregistered / Unconfirmed
GUEST, unregistred user!
unit1 主程序
//动态创建登陆窗口
TLogintDlg *LogintDlg;
LogintDlg = new TLogintDlg(Application);
LogintDlg->ShowModal();
delete LogintDlg;
//在LogintDlg 的代码
void __fastcall TLogintDlg::OKBtnClick(TObject *Sender)
{
String sSql = "select * from usermanager ";
sSql += "where username = '"
+ Edit1->Text.Trim()+"'";
if(Edit1->Text==""
|| Edit2->Text==""
ShowMessage("文件名,密码不能为空"
else
{
ADOQuery1->Close();
ADOConnection1->Close();
ADOQuery1->SQL->Text = sSql;
ADOConnection1->Open();
ADOQuery1->Open();
if(ADOQuery1->IsEmpty())
ShowMessage("没有这个用户"
if(ADOQuery1->FieldByName("password"->AsString != Edit2->Text.Trim())
ShowMessage("密码错误"
}
}
可是在运行时,我用户名,不填,弹出“文件名,密码不能为空“
然后,LogintDlg却关了!!!
我百思不解
//动态创建登陆窗口
TLogintDlg *LogintDlg;
LogintDlg = new TLogintDlg(Application);
LogintDlg->ShowModal();
delete LogintDlg;
//在LogintDlg 的代码
void __fastcall TLogintDlg::OKBtnClick(TObject *Sender)
{
String sSql = "select * from usermanager ";
sSql += "where username = '"
+ Edit1->Text.Trim()+"'";
if(Edit1->Text==""
|| Edit2->Text==""
ShowMessage("文件名,密码不能为空"
else
{
ADOQuery1->Close();
ADOConnection1->Close();
ADOQuery1->SQL->Text = sSql;
ADOConnection1->Open();
ADOQuery1->Open();
if(ADOQuery1->IsEmpty())
ShowMessage("没有这个用户"
if(ADOQuery1->FieldByName("password"->AsString != Edit2->Text.Trim())
ShowMessage("密码错误"
}
}
可是在运行时,我用户名,不填,弹出“文件名,密码不能为空“
然后,LogintDlg却关了!!!
我百思不解