《DELPHI 5 实务经典》中的一个错误!!!!!!!!(大家来看看)(12分)

  • 主题发起人 主题发起人 txyx
  • 开始时间 开始时间
T

txyx

Unregistered / Unconfirmed
GUEST, unregistred user!
在谈到DCOM的应用服务器时,书上给了一个例子,说是用来检测帐号密码的过程P478
procedure TruixDCOMServer.checkpassword(var username,
password: OleVariant);
begin
with adoquery_check do
begin
adoquery_check.Parameters[0].Value:=username;
adoquery_check.Parameters[1].Value:=password;
active:=true;
end;
if adoquery_check.Fields[0].AsInteger<>1 then
raise exception.Create('帐号密码错误!');
end;
我认为这个过程不正确,adoquery_check.Fields[0].AsInteger<>1 这个判断条件不对
按照它的如果username:0002,password:0002程序就会报错
可是怎么改正,希望高手指点!!!
 
大哥,你好象没有理解对吧,
他的sql语句应该是
select count(*) from XXX where nameXXX=:aaa and passwordXXX=:bbb
所以用
adoquery_check.Fields[0].AsInteger<>1
判断应该没有错误啊。
最多换成adoquery_check.Fields[0].AsInteger<1
 
哦,是我看错了
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部