📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls,unit2;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Label3: TLabel;
Edit2: TEdit;
Button1: TButton;
ADOQuery1: TADOQuery;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses unit4;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
num,password,temp1:string;
temp2:integer;
begin
num:=Edit1.Text;
password:=Edit2.Text;
Adoquery1.Close;
Adoquery1.SQL.Clear;
Adoquery1.SQL.Text:='select 编号 from 用户信息 where( 编号='''+num+''') and (密码='''+password+''')';
Adoquery1.Open;
temp1:=adoquery1.FieldByName('编号').AsString;
if temp1<>'' then
begin
Adoquery1.Close;
Adoquery1.SQL.Clear;
Adoquery1.SQL.Text:='select 权限 from 用户信息 where( 编号='''+num+''') and (密码='''+password+''')';
Adoquery1.Open;
temp2:=adoquery1.FieldByName('权限').AsInteger;
if temp2=0 then
begin
// unit2.Form2.ComboBox1.Visible:=false;
//unit2.Form2.GroupBox1.Visible:=false;
//unit2.Form2.Label2.Visible:=false;
// unit2.Form2.Edit3.Visible:=false;
//unit1.Form1.Hide;
unit4.form4.show;
end;
if temp2=1 then
begin
//unit2.Form2.Button3.Visible:=true;
//unit2.Form2.ComboBox1.Visible:=true;
//unit2.Form2.GroupBox1.Visible:=true;
//unit2.Form2.Label2.Visible:=true;
//unit2.Form2.Edit3.Visible:=true;
//unit1.Form1.Hide;
unit2.Form2.Show;
end;
//unit2.Form2.Show;
end
else
begin
showmessage('您输入的用户名或密码错误,请重新输入!');
edit1.Text:='';
edit2.Text:='';
end;
end;
//else
//begin
// begin
// Adoquery1.Close;
// Adoquery1.SQL.Clear;
// Adoquery1.SQL.Text:='select * from 用户信息 where( 编号='''+num+''')and (密码='''+password+''')and(权限=''普通用户'')';
// Adoquery1.Open;
// temp2:=adoquery1.FieldByName('编号').AsString;
// end;
// if temp2<>'' then
// begin
// unit2.Form2.Show;
// end
// else
// begin
//showmessage('您输入的用户名或密码错误');
//edit1.Text:='';
//edit2.Text:='';
//end
//end
procedure TForm1.Button2Click(Sender: TObject);
begin
unit1.Form1.Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -