| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 607 人关注过本帖
标题:ACCESS 中SQL语句问题
只看楼主 加入收藏
bluegone
Rank: 2
等 级:论坛游民
帖 子:12
专家分:20
注 册:2007-7-3
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:3 
ACCESS 中SQL语句问题
系统使用ADO与ACCESS连接,以下代码,在ACCESS的查询视图中无记录显示,没关系,在ADO连接时,可以显示记录
SELECT linezc.linezcid, linezc.Proname,linezc.inputdate, linezc.barcodes,COUNT (linezcinfo.linezcinfiid) AS usednum, linezc.wzdm,wzbom.wzname, wzbom.wztype, linezc.facid, factory.factory,linezc.tjng,linezc.ngdemo, linezc.ngnum, linezc.checkdate, linezc.checkpro, linezc.zcstatus, linezc.zcdemo FROM ((linezc LEFT JOIN wzbom ON wzbom.wzdm = linezc.wzdm) LEFT JOIN factory ON factory.facid = linezc.facid) LEFT JOIN linezcinfo ON linezcinfo.barcodes = linezc.barcodes where (wztype like '%hs350%' ) GROUP BY linezc.linezcid,linezc.Proname,linezc.inputdate, linezc.barcodes,linezc.wzdm, wzbom.wzname, wzbom.wztype, linezc.facid, factory.factory, linezc.tjng,linezc.ngdemo, linezc.ngnum, linezc.checkdate, linezc.checkpro, linezc.zcstatus, linezc.zcdemo ORDER BY linezc.inputdate desc

但是如何,红色部分改成
SELECT linezc.linezcid, linezc.Proname,linezc.inputdate, linezc.barcodes,COUNT (linezcinfo.linezcinfiid) AS usednum, linezc.wzdm,wzbom.wzname, wzbom.wztype, linezc.facid, factory.factory,linezc.tjng,linezc.ngdemo, linezc.ngnum, linezc.checkdate, linezc.checkpro, linezc.zcstatus, linezc.zcdemo FROM ((linezc LEFT JOIN wzbom ON wzbom.wzdm = linezc.wzdm) LEFT JOIN factory ON factory.facid = linezc.facid) LEFT JOIN linezcinfo ON linezcinfo.barcodes = linezc.barcodes where (wzname like '%电源%' ) GROUP BY linezc.linezcid,linezc.Proname,linezc.inputdate, linezc.barcodes,linezc.wzdm, wzbom.wzname, wzbom.wztype, linezc.facid, factory.factory, linezc.tjng,linezc.ngdemo, linezc.ngnum, linezc.checkdate, linezc.checkpro, linezc.zcstatus, linezc.zcdemo ORDER BY linezc.inputdate desc
无记录显示

唯一的区分是中文和英文的区别

考虑到时否是编码的问题,在客户端用encodeURI(ds.lastOptions.params.query)编码;
服务器端query = URLDecode(request("query"))

函数如下(网上复制的):
function URLDecode(enStr)
    dim deStr, strSpecial
    dim c, i, v
    deStr = ""
    strSpecial = "!""#$%&'()*+,.-_/:;<=>?@[\]^`{|}~%"
    for i = 1 to Len(enStr)
        c = Mid(enStr, i, 1)
        if c = "%" then
            v = eval("&h" + Mid(enStr, i + 1, 2))
            if inStr(strSpecial, chr(v)) > 0 then
                deStr = deStr & chr(v)
                i = i + 2
            else
                v = eval("&h" + Mid(enStr, i+1, 2) + Mid(enStr, i+4, 2))
                deStr = deStr & chr(v)
                i = i + 5
            end if
        else
            if c = "+" then
                deStr = deStr & " "
            else
                deStr = deStr & c
            end if
        end if
    next
   
    URLDecode = deStr
end Function

跟上面一样效果,查询值为中文,不能显示记录

Set rs88 = server.CreateObject("adodb.recordset")
rs88.Open sql1, conn, 1, 1
mycount = CInt(rs88.recordcount)
'response.write(mycount)
rs88.Close
Set rs88 = Nothing

response.write mycount
response.End
中文显示为0 ,英文有记录数
搜索更多相关主题的帖子: SQL ACCESS 语句 
2010-12-02 17:53
bluegone
Rank: 2
等 级:论坛游民
帖 子:12
专家分:20
注 册:2007-7-3
收藏
得分:0 
继续寻求帮助
2010-12-03 17:11
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
收藏
得分:14 
用server.Urlencode转换下看看。

QQ:63572063
2010-12-03 18:16
bluegone
Rank: 2
等 级:论坛游民
帖 子:12
专家分:20
注 册:2007-7-3
收藏
得分:0 
用server.Urlencode转换下看看。  
没有什么效果


自己解决
2010-12-09 17:53
快速回复:ACCESS 中SQL语句问题
数据加载中...
 
   



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

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