⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.pas

📁 sql server 2000 数据库与应用
💻 PAS
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, DB, ADODB;

type
  Tform1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    SpeedButton2: TSpeedButton;
    SpeedButton1: TSpeedButton;
    ADOTable1: TADOTable;
    ADOConnection1: TADOConnection;
    procedure SpeedButton2Click(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  form1: Tform1;

implementation

uses Unit2;

{$R *.dfm}

procedure Tform1.SpeedButton2Click(Sender: TObject);
begin
  form1.close;
end;

procedure Tform1.SpeedButton1Click(Sender: TObject);
var
  results:variant;
begin
  ADOTable1.Close;
  ADOTable1.Open;
  ADOTable1.Active;
  results:=ADOTable1.Lookup('username',edit1.text,'userpswd');{检索数据库中对应用户名的密码项}
  if edit1.Text='' then
    application.MessageBox('用户名不能为空!','提示',mb_ok)
  else if edit2.Text='' then
    application.messagebox('密码不能为空!','警告',mb_ok)
  else
    if varisnull(results) then
      application.MessageBox('用户不存在!','警告',mb_ok)
    else if trim(results)=trim(edit2.Text) then
      //用户存在且密码正确
      begin
       form2.ShowModal;
      end
    else
      application.MessageBox('密码错误!','警告',mb_ok) ;
  edit1.Text:='';
  edit2.Text:='';  
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -