www.pudn.com > libraryborrowSystem.rar > Unit1.pas
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, DBTables, ExtCtrls;
type
TLoginForm = class(TForm)
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Edit2: TEdit;
Table1: TTable;
DataSource1: TDataSource;
Label1: TLabel;
Label2: TLabel;
Timer1: TTimer;
Label3: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
LoginForm: TLoginForm;
implementation
uses Unit2, Unit6;
{$R *.dfm}
procedure TLoginForm.Button1Click(Sender: TObject);
Var
aname,apassword:string;
begin
aname:=trim(Edit1.Text);
apassword:=trim(Edit2.Text);
Table1.Open;
Table1.Setkey;
Table1.Fields[0].AsString:=aname;
if not Table1.GotoKey then
application.MessageBox('不合法用户,请退出','注意',mb_ok);
if Table1.GotoKey then
if Table1.Fields[1].AsString=apassword then
if Table1.Fields[2].AsString='内部管理员' then
Begin
Table1.Close;
// LoginForm.Close;
MangeForm.show
end
else
begin
Table1.Close;
// LoginForm.close;
ServeingForm.show
end
else
Begin
application.MessageBox('不合法用户,请退出','注意',mb_ok);
//MessageDlg('不合法用户,请退出',mtInformation,[mbOk],0);
Table1.Close;
// LoginForm.hide;
end;
end;
procedure TLoginForm.Button2Click(Sender: TObject);
begin
close;
end;
procedure TLoginForm.Timer1Timer(Sender: TObject);
begin
Label3.Left:=Label3.Left-1;
if Label3.Left<-Label3.Width then
Label3.Left:=self.Width;
end;
end.