Interface
USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
StdCtrls Dialogs, Menus, DB, Unit2, ADODB library;
Type
TForm1=class (TForm)
Edit1: TEdit;
Label1: TLabel;
Edit2: TEdit;
Label2: TLabel;
ComboBox1: TComboBox;
Label3: TLabel;
Label4: TLabel;
For: TButton;
Button2: TButton;
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
DataSource1: TDataSource;
Procedure Button1Click (Sender: TObject);
Private
{Private declarations}
FRM: TForm2;
Public
{Public declarations}
end;
Var
Form1: TForm1;
Username: string;
Implementation
{$R *. DFM}
Procedure TForm1. Button1Click (Sender: TObject);
Var role, password: string;
The begin
Try
Role:=ComboBox1. Text;
Username:=Edit1. Text;
Password:=Edit2. Text;
Adoquery1. Close;
ADOQuery1. SQL. The Clear;
ADOQuery1. SQL. The Add (' select * from caiwu. The dbo. Enter the where Role:=staff categories and Username:=work number and Password:=Password ");
ADOQuery1. The Parameters [0]. Value:=Role;
ADOQuery1. The Parameters [1]. The Value:=Username;
ADOQuery1. The Parameters [2]. The Value:=Password;
ADOQuery1. Active:=true;
If ADOQuery1. RecordCount & gt; 0 then
The begin
FRM:=TForm2. Create (Self);
Self. Hide;
FRM. ShowModel;
The Self. The Show;
End
The else
The begin
Showmessage (' password mistake! ');
end;
The finally
end;
end;
end;
End.
CodePudding user response:
The above code has errors, please great god give directionsCodePudding user response:
You still pack a cnpack showmodalCodePudding user response:
procedure TStartFrm. Button4Click (Sender: TObject);
Var T: Boolean;
SQL, S1, S2, TempName TempSN: string;
I: integer;
The begin
T:=False; S1:='; S2:=';
InputNum:=InputNum + 1;
TempName:=Trim (Edit1. Text);
TempSN:=Trim (MaskEdit1. Text);
If InputNum> 9 then
The begin
ShowMessage (' password mistake many times, you can't use this software! ');
DataModule1. SocketConnection1. Connected:=False;
DataModule1. SocketConnection1. AppServer. ClientOnOut (aPCName, aIP, OperateName, 'offline' and 'OUT');
Application. The Terminate;//exit program
end;
If TempName="' then
The begin
Edit1. SetFocus;
End
The else begin
If MaskEdit1. Text="' then the begin
MaskEdit1. SetFocus;
End
The else begin
//determine database inside have a user name and password;
SQL:='select * from administrative authority where users=' + # 39 + TempName + # 39 + 'and password=' + # 39 + TempSN + # 39;
DataModule1. ClientDataSet1. Active:=False;
DataModule1. ClientDataSet1. DataRequest (SQL);
DataModule1. ClientDataSet1. Active:=True;
T:=False;
With DataModule1. ClientDataSet1 do
The begin
If RecordCount> 0 then
The begin
S1:=Trim (FieldByName (' users'). AsString) are identical.
S2:=Trim (FieldByName (" password "). AsString) are identical.
If (S1=TempName) and (S2=TempSN) then
The begin
ImeNameS:=Trim (FieldByName (' IMENAME). AsString) are identical.
Secret:=S2;
T:=True;
OperateName:=Trim (FieldByName (' name '). AsString) are identical.
end;
end;
end;
end;
end;
If T
Then the begin
PrivateName:=Trim (Edit1. Text);
DataModule1. SocketConnection1. AppServer. ClientOnOut (aPCName, aIP, OperateName, 'login', 'IN');
DataModule1. ClientDataSet1. Active:=False;
ModalResult:=mrOK;
StartFrm. Hide;
End
The else begin
ShowMessage (' wrong password, please enter the password again: ');
end;
end;
CodePudding user response:
The code above are for reference only.CodePudding user response:
This I have code, is too long