📄 unit4.pas
字号:
unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DBTables, DB, StdCtrls, Buttons, ExtCtrls;
type
Tcomeinform = class(TForm)
GroupBox1: TGroupBox;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
Label1: TLabel;
Edit1: TEdit;
Label2: TLabel;
Edit2: TEdit;
Table1: TTable;
DataSource1: TDataSource;
Query1: TQuery;
SpeedButton3: TSpeedButton;
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
user:string;
end;
var
comeinform: Tcomeinform;
implementation
uses unit1,unit6;
{$R *.dfm}
procedure Tcomeinform.SpeedButton1Click(Sender: TObject);
var
pass,user:string;
begin
if edit1.text = '' then
begin
showmessage('用户名不能为空!');
edit1.SetFocus;
exit;
end;
if edit2.Text = '' then
begin
showmessage('密码不能为空!');
edit2.SetFocus;
exit;
end;
pass:=trim(edit2.Text);
user:=edit1.Text;
//query1.Prepare;
query1.Close;
query1.SQL.Clear;
query1.SQL.Text:='select 用户名,密码 from 用户表 where 用户名=:u and 密码=:p';
query1.ParamByName('u').AsString:=user;
query1.ParamByName('p').AsString:=pass;
query1.Open;
if query1.Eof then
showmessage('此号不存在!,请录入.')
else
if (query1.FieldByName('用户名').value = user) and (query1.FieldByName('密码').Value = pass) then
begin
form1:=tform1.Create(self);
form1.Show;
form1.StatusBar1.Panels[1].Text:='用户:'+user+'--'+'已登入';
comeinform.Hide;
// mainform.
end
else
begin
showmessage('密码输入不正确!');
edit2.Text :='';
end;
end;
procedure Tcomeinform.SpeedButton2Click(Sender: TObject);
begin
application.Terminate;
end;
procedure Tcomeinform.SpeedButton3Click(Sender: TObject);
var
regform:tregform;
begin
regform:=Tregform.Create(self);
comeinform.Hide;
if regform.ShowModal=mrok then
showmessage('注册成功!')
else
showmessage('注册不成功!');
comeinform.Show;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -