unit1.pas
来自「这是一个关于delphi数据库方面的源程序」· PAS 代码 · 共 65 行
PAS
65 行
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, DBTables, Unit2, Unit3;
type
TFormLogin = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Edit2: TEdit;
Label2: TLabel;
Button1: TButton;
Query1: TQuery;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormLogin: TFormLogin;
implementation
{$R *.dfm}
procedure TFormLogin.Button1Click(Sender: TObject);
var
user,pass:string;
begin
user := Edit1.Text;
pass := Edit2.Text;
Query1.SQL.Text := 'Select * From 密码.db Where 学号="' + user +'"';
Query1.Open;
if pass=Query1.FieldByName('密码').AsString then
begin
//登录成功
Query1.Close;
FormLogin.Hide;
if user='0000' then
begin
FormMaster.Init;
FormMaster.Show;
end
else
begin
FormStuMain.User := user;
FormStuMain.Init;
FormStuMain.Show;
end;
end
else
begin
//登录失败
Query1.Close;
ShowMessage('密码错误!');
end;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?