我在做一个系统,其中登陆窗体有问题。运行后有错误提示,如下:project project_salary.exe raised exception class EDatabaseError with message'Q_login:field'COUNT'not found',process stopped.点ok后光标停在了if
Q_login['COUNT']=1 then 这一行。
Q_login的SQL属性是:select count(id)
from person
where id=:user
and passwd=:passwd
and authority='5'
登陆窗体的源程序如下:
unit u_login;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls, Buttons;type
TF_login = class(TForm)
Panel1: TPanel;
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
i_user: TEdit;
i_passwd: TEdit;
B_login: TBitBtn;
B_cancel: TBitBtn;
procedure B_loginClick(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
F_login: TF_login;implementation
uses salary, u_datamodule, crypt;{$R *.dfm}procedure TF_login.B_loginClick(Sender: TObject);
var
passwd:String;
begin
With DM_main do
begin
Database.Connected:=True;
passwd:=i_passwd.Text;
passwd:=Copy(passwd+passwd,1,10);
passwd:=Encrypt(passwd,123);
Q_login.Params.ParamValues['USER']:=i_user.Text;
Q_login.Params.ParamValues['PASSWD']:=passwd;
Q_login.Open;
if Q_login['COUNT']=1 then
begin
Q_login.Close;
Close;
end
else
begin //认证失败
Application.MessageBox('请确认用户名和密码,注意大小写!', '认证失败',MB_OK);
Database.Connected:=False;
end;
end;
end;
procedure TF_login.FormShow(Sender: TObject);
begin
DM_main.Database.Connected:=False;
i_passwd.Text:='';
end;
end.
Q_login['COUNT']=1 then 这一行。
Q_login的SQL属性是:select count(id)
from person
where id=:user
and passwd=:passwd
and authority='5'
登陆窗体的源程序如下:
unit u_login;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls, Buttons;type
TF_login = class(TForm)
Panel1: TPanel;
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
i_user: TEdit;
i_passwd: TEdit;
B_login: TBitBtn;
B_cancel: TBitBtn;
procedure B_loginClick(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
F_login: TF_login;implementation
uses salary, u_datamodule, crypt;{$R *.dfm}procedure TF_login.B_loginClick(Sender: TObject);
var
passwd:String;
begin
With DM_main do
begin
Database.Connected:=True;
passwd:=i_passwd.Text;
passwd:=Copy(passwd+passwd,1,10);
passwd:=Encrypt(passwd,123);
Q_login.Params.ParamValues['USER']:=i_user.Text;
Q_login.Params.ParamValues['PASSWD']:=passwd;
Q_login.Open;
if Q_login['COUNT']=1 then
begin
Q_login.Close;
Close;
end
else
begin //认证失败
Application.MessageBox('请确认用户名和密码,注意大小写!', '认证失败',MB_OK);
Database.Connected:=False;
end;
end;
end;
procedure TF_login.FormShow(Sender: TObject);
begin
DM_main.Database.Connected:=False;
i_passwd.Text:='';
end;
end.
解决方案 »
- 求一Delphi正则表达式,过滤出网页中的域名,在线等
- 请教关于table.locata的用法
- 小调查:有多少朋友在使用CnWizards中的“代码输入助手”?感觉如何?
- 急、急、急:TTreeView的节点中能不能邦定多个属性?
- 怎么将EXCEL里面的数据导入到数据表中去
- 高手帮帮忙 关于ChecklistBox !
- 请问分辨率问题
- 请教在datamodule里用BDE的database和query,为什么append一条数据就死机?用table就可以?在线等
- 请教一下,控件toolbar2000的皮肤TBSkin怎么安装啊 忍痛送100分
- 关于 TFileStream
- 关于ADO...
- 如何截获某一个端口的数据包?并加以分析?
from person
where id=:user
and passwd=:passwd
and authority='5'
from person
where id=:user
and passwd=:passwd
and authority='5'
....
if Q_login['recoCOUNT']=1 then
begin
Q_login.Close;
Close;
end
还有一个问题,请高手看看这句SQL语句是否有问题,谢谢!
.....
where department like:depart