📄 unit2.pas
字号:
unit unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, RzEdit, Buttons, jpeg, ExtCtrls;
type
TForm2 = class(TForm)
img1: TImage;
btn1: TSpeedButton;
btn2: TSpeedButton;
edt1: TEdit;
edt2: TEdit;
procedure btn1Click(Sender: TObject);
procedure btn2Click(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
strname:string='';
strpass:string='';
icount:integer;
implementation
uses hkgl, Unit1;
{$R *.dfm}
procedure TForm2.btn1Click(Sender: TObject);
begin
strname:=edt1.Text;
strpass:=edt2.Text;
if icount<4 then
begin
if (strname<>'')and(strpass<>'')then
begin
with dm.ADODataSet1 do
begin
//验证登陆用户合法性
close;
CommandText:='select * from hk_user where hkemployee='''+strname+''' and hkpw='''+strpass+''' ';
open;
if isempty then
begin
icount:= icount+1;
application.MessageBox('对不起,数据库中没有您的信息。请与管理员联系!!','错误',mb_iconhand+mb_yesno);
edt1.Clear;
edt2.Clear;
edt1.SetFocus;
close;
end
else
begin
form2.Hide;
Form1.ShowModal;
form2.Close;
Close
end
end //with datamodule2.adodataset1 do
end //if (strname<>'')and(strpass<>'')then
else
begin
icount:=icount+1;
application.MessageBox('姓名和密码不能为空!!','错误',mb_iconhand+mb_yesno);
edt1.SetFocus;
end
end //if icount<4 then
else
begin
application.MessageBox('您没有权限操作本系统!!!!','错误',mb_iconhand+mb_yesno);
form2.Close;
end //if icount<4 then
end;
procedure TForm2.btn2Click(Sender: TObject);
begin
close
end;
procedure TForm2.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key=vk_return then
btn1.OnClick(Sender);
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
// DM.con1.Connected:=false;
//dm.con1.ConnectionString :=
// 'Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initi' +
// 'al Catalog=hkgl';
//DM.con1.Provider := 'SQLOLEDB.1';
// DM.con1.Connected:=True;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -