Delphi 开发的一个问题。。我在一个登入窗口中写了一个用户验证的函数﹐没有参数﹐
但我调用该函数后﹐运行系统﹐总是出现下例的报错窗口﹐不知为何﹗Incorrect syntax near the keyword ‘as’ process stoped ,部分代码如下﹕
按钮click 代码﹕
if canpass then
begin
mainform :=tmainform.Create(application);
mainform.ShowModal ;
frm_login.Close ;
end ;
函数代码﹕
function Tfrm_login.canpass():boolean ;
var
ls_pwd :string ;
ls_message :array[1..4] of string ;
begin
result :=false ;
ls_message[1]:='用户名不能为空!' ;
ls_message[2]:='密码不能为空!' ;
ls_message[3]:='用户名称或密码不正确!' ;
gs_userid :=combobox1.Text ;
ls_pwd :=edit1.Text ;
if gs_userid = '' then
begin
showmessage(ls_message[1]) ;
exit ;
end
else if ls_pwd = '' then
begin
showmessage(ls_message[2]) ;
exit ;
end;
{检测用户与密码}
adoquery1.Close ;
adoquery1.SQL.Clear ;
adoquery1.SQL.Add('select * as aa from dbo.[user] where use_id = :ps_userid and pwd = :ps_pwd ') ;
adoquery1.Parameters.ParamByName('ps_userid').Value :=gs_userid ;
adoquery1.Parameters.ParamByName('ps_pwd').Value :=ls_pwd ;
adoquery1.Open ;
if adoquery1.RecordCount>0 then
begin
result :=true ;
end
else
begin
result :=false ;
showmessage(ls_message[3]) ;
end;
end ;
請高手解決........
但我调用该函数后﹐运行系统﹐总是出现下例的报错窗口﹐不知为何﹗Incorrect syntax near the keyword ‘as’ process stoped ,部分代码如下﹕
按钮click 代码﹕
if canpass then
begin
mainform :=tmainform.Create(application);
mainform.ShowModal ;
frm_login.Close ;
end ;
函数代码﹕
function Tfrm_login.canpass():boolean ;
var
ls_pwd :string ;
ls_message :array[1..4] of string ;
begin
result :=false ;
ls_message[1]:='用户名不能为空!' ;
ls_message[2]:='密码不能为空!' ;
ls_message[3]:='用户名称或密码不正确!' ;
gs_userid :=combobox1.Text ;
ls_pwd :=edit1.Text ;
if gs_userid = '' then
begin
showmessage(ls_message[1]) ;
exit ;
end
else if ls_pwd = '' then
begin
showmessage(ls_message[2]) ;
exit ;
end;
{检测用户与密码}
adoquery1.Close ;
adoquery1.SQL.Clear ;
adoquery1.SQL.Add('select * as aa from dbo.[user] where use_id = :ps_userid and pwd = :ps_pwd ') ;
adoquery1.Parameters.ParamByName('ps_userid').Value :=gs_userid ;
adoquery1.Parameters.ParamByName('ps_pwd').Value :=ls_pwd ;
adoquery1.Open ;
if adoquery1.RecordCount>0 then
begin
result :=true ;
end
else
begin
result :=false ;
showmessage(ls_message[3]) ;
end;
end ;
請高手解決........
解决方案 »
- TbsSkinCheckListBox 的使用问题
- Application.ProcessMessages;反而卡死掉进程.
- 一个关于d6中打开form窗口的问题
- 为什么我不能在IntraWeb下引用DataModule1,有详细的操作步骤!!!!这个问题已经困扰多时了 :-<帮帮我吧
- 请教高手(使用locate方法时出现的问题)您的回音,我的企盼~—~
- BDE 下的TQuery支持返回多个数据集的查询吗?
- RMB或高分求多表头的listview控件
- nmpop3怎么知道哪些是新邮件,哪些是已看过的邮件呢?
- 关于在TClientDataSet的OnReconcileError的一点问题,请帮忙!
- 千金求救!如何使EXCEL工作簿保存得快点?
- 关于stringgrid的默认选中问题!
- 模拟键盘按键是对于激活的窗口,能不能让模拟按键用于指定的窗口
这一句是否错误?
改成
adoquery1.SQL.Add('select * from dbo.[user] where use_id = :ps_userid and pwd = :ps_pwd ') ;同时谢谢楼主,现在两个三角。
adoquery1.sql.add('select use_id as aa,pwd as bb from dbo.user where use_id=:a and pwd=:b')??
我本想寫成count(*) as aa 的,結果去掉時忘了﹐多謝各位﹗