| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1003 人关注过本帖
标题:求助关于from 子句语法错误~
取消只看楼主 加入收藏
chfshe
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2010-11-1
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:5 
求助关于from 子句语法错误~
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 "

请教一下大家这个语句哪里错了?我在ACCESS里面测试是正确的
麻烦大家了!
搜索更多相关主题的帖子: 子句 语法 
2010-12-20 11:31
chfshe
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2010-11-1
收藏
得分:0 
回复 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
2010-12-20 12:01
chfshe
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2010-11-1
收藏
得分:0 
回复 5楼 yms123
我就是在ACCESS里面查询时是没有错误的!
2010-12-20 14:36
chfshe
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2010-11-1
收藏
得分:0 
回复 4楼 dzt0001
谢谢你,还是你比较细心!确实是你说的那里出错,改了就没事啦!
2010-12-20 14:39
chfshe
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2010-11-1
收藏
得分:0 
回复 9楼 yms123
我也不知道怎么说,总之现在改了dzt0001说的地方就显示正确了!
2010-12-20 14:46
chfshe
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2010-11-1
收藏
得分:0 
回复 11楼 kira007
可以的啊,怎么不可以!
2010-12-21 08:13
快速回复:求助关于from 子句语法错误~
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026315 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved