数据库是BDE连接的,Query+DBGridEh
月份   人数   金额
  1     14   ¥16.50
  2     10   ¥9.50
  3     53   ¥87.50
  4     22          ¥98.00
......想在DBGridEh的Foot处加一个合计,如下:月份   人数   金额
  1     14   ¥16.50
  2     10   ¥9.50
  3     53   ¥87.50
  4     22           ¥98.00
....
合计    99           ¥211.5
应该怎样做,好像用Query连接时,DBGridEh不能双击添加Columns
Ehlib中的那个例子也没看明白是怎么实现,请高手指教,谢谢

解决方案 »

  1.   

    DBGridEh1.FooterRowCount:=1;   
      DBGridEh1.SumList.Active:=True;   
        
      增加DBGridEh1列   
        
      编辑某列的Footers属性,加入footer   
        
      选择这个footer的valuetype属性:fvtCount、fvtAvg、fvtFieldValue、fvtSum、fvtStaticText、fvtNon
      

  2.   

    设置dbgrideh1的footrowcount=1,sumlist的active=true
    再在query的afteropen事件
          yourform.DBGridEh1.Columns[2].Footer.ValueType:=fvtSum;
          yourform.DBGridEh1.Columns[1].Footer.valuetype:= fvtcount;
      

  3.   

    问题是我根本没办法在DBGridEh上添加一列啊,怎么办???
    我双击DBGridEh1时根本没反应,点击Columns属性时也没反应
      

  4.   

    樓主,到這里看:
    http://www.delphibbs.com/keylife/iblog_show.asp?xid=5161
      

  5.   

    是不是BDE方式连接的话,DBGridEh的Cloumns属性就没有用啊????