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 ;
請高手解決........

解决方案 »

  1.   

    adoquery1.SQL.Add('select * as aa from dbo.[user] where use_id = :ps_userid and pwd = :ps_pwd ') ;
    这一句是否错误?
      

  2.   

    adoquery1.SQL.Add('select * as aa from dbo.[user] where use_id = :ps_userid and pwd = :ps_pwd ') ;
    改成
    adoquery1.SQL.Add('select * from dbo.[user] where use_id = :ps_userid and pwd = :ps_pwd ') ;同时谢谢楼主,现在两个三角。
      

  3.   

    adoquery1.SQL.Add('select * as aa from dbo.[user] where use_id = :ps_userid and pwd = :ps_pwd ') ;
      

  4.   

    是不是应该改为
    adoquery1.sql.add('select use_id as aa,pwd as bb from dbo.user where use_id=:a and pwd=:b')??
      

  5.   

    adoquery1.SQL.Add('select * as aa from dbo.[user] where use_id = :ps_userid and pwd = :ps_pwd ') ;只有这一句SQL字符串中有个as,但也没有问题啊。看看报错的是哪一行,有没有什么“as”
      

  6.   

    不好意思,看错了,应该是你SQL语句的问题:),“as aa”是什么 as aa 呢
      

  7.   

    多謝﹗
    我本想寫成count(*) as aa 的,結果去掉時忘了﹐多謝各位﹗