delphi dm.ADOQuery1:missing SQL property
我做的是个登陆框请达人指点那里有问题interfaceusesWindows,Messages,SysUtils,Variants,Classes,Graphics,Co...
我做的是个登陆框
请达人指点那里有问题
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
GroupBox1: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
GroupBox2: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
m:integer;
czy:string;
s:boolean;
implementation
uses
Unit1;
{$R *.dfm}
procedure TForm2.Button2Click(Sender: TObject);
begin
close;
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
m:=m+1;
if edit1.Text='' then
begin
dm.ADOQuery1.close;
dm.ADOQuery1.open;
application.MessageBox('请输入用户名','提示',64);
end
else
if edit2.Text='' then
begin
dm.ADOQuery1.close;
dm.ADOQuery1.open;
application.MessageBox('请输入密码','提示',64) ;
end
else
begin
dm.ADOQuery1.Close;
dm.ADOQuery1.SQL.Clear;
dm.ADOQuery1.sql.Add('select * from cuser where username = :a and pass = :b');
dm.ADOQuery1.parameters.ParamByName('a').Value:=trim(edit1.Text);
dm.ADOQuery1.parameters.ParamByName('b').Value:=trim(edit2.Text);
dm.ADOQuery1.open;
end;
if dm.ADOQuery1.RecordCount>0 then
begin
czy:=dm.ADOQuery1.FieldByName('username').Value;
s:=true;
form2.Hide;
end
else
if m<3 then
begin
application.MessageBox('用户名或密码错误,请重新输入!','提示',64);
edit1.Clear;
edit2.Clear;
edit1.SetFocus;
end
else
begin
application.MessageBox('您无权使用本系统!','提示',64);
Application.Terminate;
end;
end;
end. 展开
请达人指点那里有问题
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
GroupBox1: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
GroupBox2: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
m:integer;
czy:string;
s:boolean;
implementation
uses
Unit1;
{$R *.dfm}
procedure TForm2.Button2Click(Sender: TObject);
begin
close;
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
m:=m+1;
if edit1.Text='' then
begin
dm.ADOQuery1.close;
dm.ADOQuery1.open;
application.MessageBox('请输入用户名','提示',64);
end
else
if edit2.Text='' then
begin
dm.ADOQuery1.close;
dm.ADOQuery1.open;
application.MessageBox('请输入密码','提示',64) ;
end
else
begin
dm.ADOQuery1.Close;
dm.ADOQuery1.SQL.Clear;
dm.ADOQuery1.sql.Add('select * from cuser where username = :a and pass = :b');
dm.ADOQuery1.parameters.ParamByName('a').Value:=trim(edit1.Text);
dm.ADOQuery1.parameters.ParamByName('b').Value:=trim(edit2.Text);
dm.ADOQuery1.open;
end;
if dm.ADOQuery1.RecordCount>0 then
begin
czy:=dm.ADOQuery1.FieldByName('username').Value;
s:=true;
form2.Hide;
end
else
if m<3 then
begin
application.MessageBox('用户名或密码错误,请重新输入!','提示',64);
edit1.Clear;
edit2.Clear;
edit1.SetFocus;
end
else
begin
application.MessageBox('您无权使用本系统!','提示',64);
Application.Terminate;
end;
end;
end. 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询