系统参数
        @@trancount
我在DELPHI中要怎样才能获的@@trancount的值呢?showmessage(inttostr(adoquery1.Parameters.ParamByName('@@trancount').Value));
这是我的语句,运行时报错说.adoquery1找不到变量@@trancount'.

解决方案 »

  1.   

    adoquery1.sql.add(select @@trancount as Trancount)
    ....
    showmessage(inttostr(adoquery1.Fieldbyname('trancount').Asstring));
      

  2.   

    还是不行哈~~报错是
    adoquery1:field 'trancount' not found
      

  3.   

    adoquery1.Close;
    adoquery1.SQL.Clear;
    adoquery1.SQL.Add('select @@trancount as trancount');
    adoquery1.ExecSQL;
    showmessage(inttostr(adoquery1.Parameters.ParamByName('trancount').Value));
      

  4.   

    改成这样:howmessage(inttostr(adoquery1.Parameters.ParamByName(quotedstr('@@trancount')).Value));
      

  5.   

    还是不行.报错是
    adoquery1:Parameter '@@trancount' not found
    是不是我的代码哪有问题?要不写出你们的全代码来我看看.
      

  6.   

    adoquery1.Close;
    adoquery1.SQL.Clear;
    adoquery1.SQL.Add('select @@trancount as [trancount]');
    adoquery1.Open; //改成open
    showmessage(self.ADOQuery1.FieldByName('trancount').AsString);