Unit1.pas
资源名称:xiaobai.rar [点击查看]
上传用户:autowell
上传日期:2022-06-21
资源大小:16754k
文件大小:2k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, DB, ADODB, StdCtrls, ExtCtrls;
- type
- TForm1 = class(TForm)
- RadioGroup1: TRadioGroup;
- RadioButton1: TRadioButton;
- RadioButton2: TRadioButton;
- Label1: TLabel;
- Label2: TLabel;
- Edit1: TEdit;
- Label3: TLabel;
- Edit2: TEdit;
- DataSource1: TDataSource;
- Button1: TButton;
- Button2: TButton;
- ADOQuery1: TADOQuery;
- ADOQuery2: TADOQuery;
- DataSource2: TDataSource;
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- uses unit4;
- {$R *.dfm}
- procedure TForm1.Button1Click(Sender: TObject);
- var
- adminName,adminPsw:String;
- begin
- if not(RadioButton1.Checked) and not(RadioButton2.Checked) then
- MessageDlg('请选择用户类型!!',mtWarning,[mbok],0)
- else if RadioButton1.Checked=true then
- begin
- if (edit1.Text='') and (edit2.Text='') then
- MessageDlg('用户名或密码不能为空!!',mtWarning,[mbok],0);
- adminName:=edit1.Text;
- adminPsw:=edit2.Text;
- with ADOQuery1 do
- begin
- close;
- sql.Clear;
- sql.Add('select * from manager');
- sql.Add('where') ;
- sql.Add('用户名='+ quotedstr(edit1.Text));
- open;
- active:=true;
- end;
- if ADOQuery1.RecordCount=0 then
- MessageDlg('用户不存在!!',mtWarning,[mbok],0)
- else
- begin
- if edit2.Text=ADOQuery1.Fields[2].Value then
- begin
- MessageDlg('您已经成功登录系统!!',mtInformation,[mbok],0);
- form4.show;
- form1.Edit1.Text:='';
- form1.Edit2.Text:='';
- end
- else
- MessageDlg('密码有误!!',mtWarning,[mbok],0);
- end;
- end;
- end;
- end.