📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls, Buttons, ADODB, DB;
type
TForm1 = class(TForm)
Image1: TImage;
StaticText1: TStaticText;
StaticText2: TStaticText;
Edit1: TEdit;
Edit2: TEdit;
GroupBox1: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
GroupBox2: TGroupBox;
ComboBox1: TComboBox;
ADOQuery1: TADOQuery;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure Button2Click(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public Edit1 declarations }
public
{ public Edit2}
public
{ public BitBtn1}
end;
var
Form1: TForm1;
implementation
uses Unit2, Unit3, Unit5,Unit4;
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
begin
form3.Show;
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
if ComboBox1.Text='管理员登录' then
begin
RadioButton1.Enabled:=False;
RadioButton2.Enabled:=False;
end
else
begin
RadioButton1.Enabled:=True;
RadioButton2.Enabled:=True;
end
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
if ComboBox1.Text='管理员登录' then
begin
if edit1.Text=''then
application.MessageBox('请输入用户名','提示',64)
else
if edit2.Text=''then
application.MessageBox('请输入密码','提示',64)
else
begin ADOQuery1.Close; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Add('select * from 管理员图书馆帐号表 where 帐号='''+edit1.Text+'''and 密码='''+Edit2.Text+''''); ADOQuery1.Open; if ADOQuery1.Recordset.RecordCount=0 then application.MessageBox('用户或密码错误','提示',64) else begin form2.Show; end end
end
else
begin
if RadioButton1.Checked then
begin
if edit1.Text=''then
application.MessageBox('请输入用户名','提示',64)
else
if edit2.Text=''then
application.MessageBox('请输入密码','提示',64)
else
begin ADOQuery1.Close; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Add('select * from 教师图书馆帐号表 where 帐号='''+edit1.Text+'''and 密码='''+Edit2.Text+''''); ADOQuery1.Open; if ADOQuery1.Recordset.RecordCount=0 then application.MessageBox('用户或密码错误','提示',64) else form3.Show; end
end
else
begin
if RadioButton2.Checked then
begin
if edit1.Text=''then
application.MessageBox('请输入用户名','提示',64)
else
if edit2.Text=''then
application.MessageBox('请输入密码','提示',64)
else
begin ADOQuery1.Close; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Add('select * from 学生图书馆帐号表 where 帐号='''+edit1.Text+'''and 密码='''+Edit2.Text+''''); ADOQuery1.Open; if ADOQuery1.Recordset.RecordCount=0 then application.MessageBox('用户或密码错误','提示',64) else form4.Show; end
end
else
begin
application.MessageBox('请选择用户','提示',64)
end
end
end
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
form5.Show;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -