📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
strname:string='';
strpass:string='';
icount:integer;
implementation
uses Unit2, Unit3, Unit4;
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
begin
form1.Close ;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
constr:string;
begin
dm.ADOConnection1.Connected :=false;
constr := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='
+ ExtractFilePath(Application.Exename) + 'database\renshi.mdb'
+ ';Persist Security Info=False';
dm.ADOConnection1.ConnectionString := constr;
dm.ADOConnection1.Connected:=true;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
strname:=edit1.Text;
strpass:=edit2.Text;
if icount<4 then
begin
if (strname<>'')and(strpass<>'')then
begin
with dm.ADODataSet1 do
begin
//验证登陆用户合法性
close;
CommandText:='select * from yonghuxinxi where 用户id='''+strname+''' and 密码='''+strpass+''' ';
open;
if isempty then
begin
icount:= icount+1;
application.MessageBox('对不起,数据库中没有您的信息。请与管理员联系!!','错误',mb_iconhand+mb_yesno);
edit1.Clear;
edit2.Clear;
edit1.SetFocus;
close;
end
else
begin
Form3.Show;
form1.Hide;
end
end //with datamodule2.adodataset1 do
end //if (strname<>'')and(strpass<>'')then
else
begin
icount:=icount+1;
application.MessageBox('姓名和密码不能为空!!','错误',mb_iconhand+mb_yesno);
edit1.SetFocus;
end
end //if icount<4 then
else
begin
application.MessageBox('您没有权限操作本系统!!!!','错误',mb_iconhand+mb_yesno);
form1.Close;
end //if icount<4 then
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -