ssql3:='select count(*) as qq from tab_stafftrain where sta_id='''+EdtSta_id.Text+''' and cur_id='''+EdtCur_id.Text+''' ';
这一句,如果sta_id、cur_id为整型的话,此句改成
ssql3:='select count(*) as qq from tab_stafftrain where sta_id='+EdtSta_id.Text+' and cur_id='+EdtCur_id.Text+';showmessage(inttostr(datamodule1.CDS_Total.FieldByName ('qq').asinteger));  改成: 
showmessage(datamodule1.CDS_Total.FieldByName ('qq').asstring);

解决方案 »

  1.   

    是不是qq的值太大,越界了?
    试一下换成
    showmessage(datamodule1.CDS_Total['qq']);
      

  2.   

    在datamodule1的组件CDS_Total中加入呀, type為 integer
      field type 為 calculated 
      

  3.   

    to:  fyje(冬原)  
       不對.
    to :  snakeguo(枫) 
       count(*)值為1,不可能越界.
      

  4.   

    我相信,如果您要是在SQL Server里执行这句应该是对的,但是,如果在一个固定的数据集里执行的话,如果您又没有给这个数据集ADD列的话,那么肯定是错的了;
      

  5.   

    to  ihihonline(小小->充电中……) :
      两层结构的程序没有问题,三层结构的程序为何就出错呢  ?