📄 unit2.pas
字号:
//program JourneyReferee;
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB, ColorGrd, ExtDlgs, ExtCtrls, Buttons,inifiles;
type
TForm2 = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
ColorGrid1: TColorGrid;
BitBtnCancel: TBitBtn;
BitBtnFirm: TBitBtn;
Image1: TImage;
procedure BitBtnCancelClick(Sender: TObject);
procedure BitBtnFirmClick(Sender: TObject);
procedure OnKeyDownEdit(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure OnCreateForm2(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
uses
Unit1, Unit3;
{$R *.dfm}
procedure TForm2.BitBtnCancelClick(Sender: TObject);
begin
close;
end;
procedure TForm2.BitBtnFirmClick(Sender: TObject);
var
strSQL: string;
begin
Form2.Visible := false;
strSQL := 'select * from userID where userID =' + QuotedStr(edit1.Text) + ' and Password =' + QuotedStr(edit2.Text);
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.add(strSQL);
ADOQuery1.Open;
if(ADOQuery1.Eof) then
begin
MessageBox(Application.Handle, '用户名或者密码错误,不能登录', '错误', MB_OK);
Close;
end;
ADOQuery1.close;
Unit3.Form3.StatusBar1.Panels[3].Text:=' 当前用户:'+ edit1.text;
strSQL := 'select * from userID,role where userID.userID =' + QuotedStr(edit1.Text) + ' and userID.type=role.type';
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.add(strSQL);
ADOQuery1.Open;
if ADOQuery1.FieldByName('Manage_deal').AsBoolean=false then
begin
form3.TreeView1.Items.Item[21].Destroy;
form3.N4.Enabled :=false;
end;
if ADOQuery1.FieldByName('statistics_deal').AsBoolean=false then
begin
form3.TreeView1.Items.Item[15].Destroy;
form3.N3.Enabled :=false;
end;
if ADOQuery1.FieldByName('Select_deal').AsBoolean=false then
begin
form3.TreeView1.Items.Item[8].Destroy;
form3.N2.Enabled :=false;
end;
if ADOQuery1.FieldByName('Input_deal').AsBoolean=false then
begin
form3.TreeView1.Items.Item[0].Destroy;
form3.N1.Enabled :=false;
end;
Unit3.Form3.ShowModal();
Close;
end;
procedure TForm2.OnKeyDownEdit(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key=13 then
Form2.BitBtnFirmClick(sender);
end;
procedure TForm2.OnCreateForm2(Sender: TObject);
var myini:tinifile;
filename:string;
begin
Filename:=ExtractFilePath(Paramstr(0))+'info.ini';
myini:=Tinifile.create(filename);
adoconnection1.ConnectionString:=myini.ReadString('adoconnect','string','45');
myini.Free;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -