📄 u_form_login.~pas
字号:
unit U_Form_Login;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls, ButtonExCtl, ExtCtrls,uAdoSet,uCheckValidate,uString;
type
TForm_Login = class(TForm)
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label5: TLabel;
edit: TButtonExCtl;
exit: TButtonExCtl;
Label6: TLabel;
Edit2: TEdit;
ComboBox1: TComboBox;
ADOQuery1: TADOQuery;
ADOQuery2: TADOQuery;
procedure FormCreate(Sender: TObject);
procedure exitClick(Sender: TObject);
procedure editClick(Sender: TObject);
procedure Edit2KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
_Adosale:TuAdoSet;
_AdoNewproduce:TuAdoSet;
_Check:TCheckValidate;
_str:TuString;
public
{ Public declarations }
end;
var
Form_Login: TForm_Login;
implementation
{$R *.dfm}
uses uGlobal, U_Form_MainMenu;
procedure TForm_Login.FormCreate(Sender: TObject);
var
param:TStringList;
strsql:string;
begin
_Adosale:=TuAdoSet.Create('newsale',1);
_AdoNewproduce:=TuAdoSet.Create('newproduce',1);
_Check:=TCheckValidate.create;
_str:=TuString.Create;
_str.ShowPloyForm(image1.Picture.Bitmap,handle);
param:=TStringList.Create;
param.clear;
param.Add(_whichstore);
strsql:='select realName from userTable where whichStore=:s1';
_AdoNewproduce.FillControl(combobox1,strsql,param,'realName');
end;
procedure TForm_Login.exitClick(Sender: TObject);
begin
Close;
end;
procedure TForm_Login.editClick(Sender: TObject);
var
param:TStringList;
strsql:string;
begin
param:=TStringList.Create;
param.clear;
param.Add(trim(combobox1.text));
param.Add(trim(edit2.text));
param.Add(_whichStore);
strsql:='select * from userTable where realName=:s1 and password=:s2 and whichStore=:s3';
if _AdoNewProduce.getRecordCount(strsql,param)>0 then
begin
_loginName:=trim(combobox1.text);
_StoreMan:=trim(combobox1.text);
_LoginTime:=formatDateTime('yyyymmdd hh:mm:ss',now);
Application.CreateForm(TForm_mainMenu,Form_MainMenu);
end
else
begin
showmessage('输入的密码或名称不对...');
end;
end;
procedure TForm_Login.Edit2KeyPress(Sender: TObject; var Key: Char);
var
param:TStringList;
strsql:string;
begin
if key=#13 then
begin
param:=TStringList.Create;
param.clear;
param.Add(trim(combobox1.text));
param.Add(trim(edit2.text));
param.Add(_whichStore);
strsql:='select * from userTable where realName=:s1 and password=:s2 and whichStore=:s3';
if _AdoNewProduce.getRecordCount(strsql,param)>0 then
begin
_loginName:=trim(combobox1.text);
_StoreMan:=trim(combobox1.text);
_LoginTime:=formatDateTime('yyyymmdd hh:mm:ss',now);
Application.CreateForm(TForm_mainMenu,Form_MainMenu);
end
else
begin
showmessage('输入的密码或名称不对...');
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -