论文首页哲学论文经济论文法学论文教育论文文学论文历史论文理学论文工学论文医学论文管理论文艺术论文 |
var
frmLogIn: TfrmLogIn;
LogTimes:Integer=0;
DeptName:string;
LogInTime:TDateTime;
UserName:string;
implementation
uses Umain, MyData, UtodayWork;
{$R *.dfm}
procedure TfrmLogIn.bbtnCancelClick(Sender: TObject);
begin
Application.Terminate;
end;
procedure TfrmLogIn.ComboBox1DropDown(Sender: TObject);
begin
ComboBox1.Items.Clear;
with dm.AQDept do
begin
close;
sql.Clear;
sql.Add('select distinct department from Users');
open;
first;
while not dm.AQDept.Eof do
begin
ComboBox1.Items.Add(dm.AQDept.FieldValues['department']);
dm.AQDept.Next;
end;
end;
end;
procedure TfrmLogIn.bbtnOKClick(Sender: TObject);
begin
if Edit2.Text='' then
begin
ShowMessage('用户密码不能为空!');
Exit;
end;
with dm.AQDept do
begin
close;
sql.Clear;
sql.Add('select * from Users where Department='''+Trim(ComboBox1.Text)+'''and UserName='''+Trim(ComboBox2.Text)+''' and PWD='''+frmMain.Encrypt(Trim(Edit2.Text))+''''); 本文来自中国科教评价网
open;
end;
if dm.AQDept.Eof then
begin
LogTimes:=LogTimes+1;
if LogTimes<3 then
begin
MessageBox(handle,pchar('密码第'+IntToStr(LogTimes)+'次错误,请重新输入!'),'密码错误',MB_OK OR MB_ICONERROR);
Edit2.Text:='';
Edit2.SetFocus;
end
else
begin
MessageBox(handle,'密码错误三次程序将关闭!','密码错误',MB_ICONERROR);
Application.Terminate;
end;
end
else if dm.AQDept.RecordCount<>0 then
begin
DeptName:=Trim(ComboBox1.Text);
UserName:=Trim(ComboBox2.Text);
&