你是用query吧。可能是你的query要用只读方式打开。或你改成存储过程或视图。

解决方案 »

  1.   

    你是用query吧。可能是你的query要用只读方式打开。或你改成存储过程或视图。
      

  2.   

    你是用query吧。可能是你的query要用只读方式打开。或你改成存储过程或视图。
      

  3.   

    放在程序中就显示 "tem 附近有语法错误" ?
    程序中写错了吧?请示代码。
      

  4.   

    m = "select 序号,车号,发货单位,货物名称,毛重,皮重,净重,isnull(水分,0) 水分,isnull(杂质,0) 杂质,isnull(密度,0) 密度,净重*(1-isnull(水分-杂质,1)) 纯油"
    m = m & "from (select 序号,车号,发货单位,货物名称,sum(毛重)毛重 ,sum(皮重)皮重,sum(净重)净重,avg(case when [水分]>0 then [水分] end) 水分,"m = m & " avg(case when [杂质]>0 then [杂质] end) 杂质,avg(case when [密度]>0 then [密度] end) 密度 from chengzhongjilubiao group by 序号,车号,发货单位,货物名称) tem union all "
     m = m & "select '合计','','','',sum(毛重),sum(皮重),sum(净重),avg(case when [水分]>0 then [水分] end),avg(case when [杂质]>0 then"
    m = m & " [杂质] end),avg(case when [密度]>0 then [密度] end) 密度,sum(净重) *(1-avg(case when [水分]>0 then [水分] end)/100-avg(case when [杂质]>0 then [杂质] end)/100)   ww"
     m = m & " From chengzhongjilubiao"
     
     
      rs.Open m, cnn, adOpenStatic, adLockReadOnly
    以上是程序的有关代码