delphi7登录窗口时的错误
请大虾指点迷津,我是初学者,看不出错误。代码如下:
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,adodb, StdCtrls, jpeg, ExtCtrls;
type
Tlogin = class(TForm)
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
login: Tlogin;
u_name,u_safe:string;
implementation
{$R *.dfm}
procedure Tlogin.Button1Click(Sender: TObject);
begin
dm.Adslogin.close;
dm.'select * from admin where uname='+
#39+edit1.text+#39+' and pwd='+ #39+edit2.text+#39;
dm.Adslogin.open;
u_name:=dm.ADSlogin.Fields[0].AsString;
u_safe:=dm.ADSlogin.Fields[2].AsString;
//定义字符串全局变量u_name和u_safe
If dm.adslogin.recordcount=1 then
begin
application.MessageBox('欢迎登录本系统!','系统登录',mb_ok+mb_iconinformation+mb_applmodal);
Close;
End
else
Begin
application.MessageBox('您所输入的用户名或密码错误,请重新输入!','系统登录',mb_ok+mb_iconerror+mb_applmodal);
i:=i+1; //这是一个全局变量,用来统计输入错误的次数。
If i>=3 then
application.Terminate; //中止程序的运行。
End;
end;
end.
错误如下:
[错误] loginFrm.pas(35): Undeclared identifier: 'dm'
[错误] loginFrm.pas(35): Missing operator or semicolon
[错误] loginFrm.pas(36): Missing operator or semicolon
[错误] loginFrm.pas(38): Missing operator or semicolon
[错误] loginFrm.pas(39): Missing operator or semicolon
[错误] loginFrm.pas(39): Missing operator or semicolon
[错误] loginFrm.pas(40): Missing operator or semicolon
[错误] loginFrm.pas(40): Missing operator or semicolon
[错误] loginFrm.pas(42): 'THEN' expected but identifier 'adslogin' found
[致命错误] Project1.dpr(7): Could not compile used unit 'loginFrm.pas'
[ 本帖最后由 陈俊佳 于 2011-6-15 23:49 编辑 ]