?? unit2.pas
字號(hào):
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;
type
TForm2 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
ADOConnection1: TADOConnection;
ADODataSet1: TADODataSet;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
Form2_close:Boolean;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
Form2_close:=False;
begin
//檢驗(yàn)用戶名和密碼
if ((Trim(edit1.Text)<>'') and (Trim(edit2.Text)<>'')) then
begin
Adoconnection1.Connected:=True;
AdoDataset1.Active:=False;
AdoDataset1.CommandText:='select * from Login where id='''+Trim(edit1.Text)+'''';
AdoDataset1.Active:=True;
if (Adodataset1.RecordCount<>0) then
begin
if Adodataset1.Fields[1].AsString=Trim(edit2.Text) then
begin //登陸成功
Form2_close:=True;
close;
end
else
messagedlg('密碼錯(cuò)誤!',Mtwarning,[Mbok],0);
end
else
messagedlg('用戶名錯(cuò)誤!',mtwarning,[Mbok],0);
end
else
messagedlg('請(qǐng)輸入完整的用戶名和密碼!',mtwarning,[Mbok],0);
end
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
application.Terminate;
end;
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if Form2_close then
close
else
application.Terminate;
end;
end.
//此源碼由程序太平洋收集整理發(fā)布,任何人都可自由轉(zhuǎn)載,但需保留本站信息
//╭⌒╮┅~ ¤ 歡迎光臨程序太平洋╭⌒╮
//╭⌒╭⌒╮╭⌒╮~╭⌒╮ ︶ ,︶︶
//,︶︶︶︶,''︶~~ ,''~︶︶ ,''
//╔ ╱◥███◣═╬╬╬╬╬╬╬╬╬╗
//╬ ︱田︱田 田 ︱ ╬
//╬ http://www.5ivb.net ╬
//╬ ╭○╮● ╬
//╬ /■\/■\ ╬
//╬ <| || 有希望,就有成功! ╬
//╬ ╬
//╚╬╬╬╬╬╬╬╬╬╬╗ ╔╬╬╬╬╝
//
//說(shuō)明:
//專業(yè)提供VB、.NET、Delphi、ASP、PB源碼下載
//包括:程序源碼,控件,商業(yè)源碼,系統(tǒng)方案,開(kāi)發(fā)工具,書籍教程,技術(shù)文檔
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -