回复 2楼 筱晓绾
用的是ACCESS的。就是加了goodsid="&goodsid&"后就出错了。是传值出错吗?
如果没有加这个的就没错
if goodsid="" then
sql= "select g.goodsname,dd.sf from goods g,(select sum(allfees) as sf,goodsid from declarations where tag1=1 and tag2=1 and sendaddressid like '%"&customerid&"%' and reptime between #"&starttime&"# and #"&endtime&"# group by goodsid) dd where dd.goodsid=g.goodsid "
else
sql= "select g.goodsname,dd.sf from goods g,(select sum(allfees) as sf,goodsid from declarations where tag1=1 and tag2=1 and sendaddressid like '%"&customerid&"%' and reptime between #"&starttime&"# and #"&endtime&"# and goodsid="&goodsid&" group by goodsid)dd where dd.goodsid=g.goodsid "
end if
grs.open sql,conn,1,1
if 里面的没错。但是else的就有错了!
也不知道是不是传值传不过来~
可是下面这段没有错,那是否证明传值是正确的?
if goodsid="" then
sql= "select sum(allfees) as sf from declarations where tag1=1 and tag2=1 and sendaddressid like '%"&customerid&"%' and reptime between #"&starttime&"# and #"&endtime&"# "
else
sql= "select sum(allfees) as sf from declarations where tag1=1 and tag2=1 and sendaddressid like '%"&customerid&"%' and reptime between #"&starttime&"# and #"&endtime&"# and goodsid="&goodsid
end if