注册 登录
编程论坛 ASP技术论坛

关于 in() 用法请教

guanry 发布于 2009-12-01 12:26, 969 次点击
我用  in() 来查询库里多个地区[where]
where=request("where")
set rs=server.CreateObject("adodb.recordset")
sqls="select * from [tBid_article] where [fcounttime]='"&date()&"' and [where] in('" & where &"')" 就是查不出来 如果[where]是一个地区 能查出来 如果两个以上就不行

sqls="select * from [tBid_article] where [fcounttime]='"&date()&"' and [where] in('北京','上海')" 就没问题 请问我该怎么改 请大家帮下 万分感谢

我用sqls="select * from [tBid_article] where [fcounttime]='"&date()&"' and [where] in(“&where&”)" 也查不出来 请问 这个我该怎么写呢 请大家教我下 万分感谢
4 回复
#2
chenguoxing5172009-12-01 12:58
传递过来的where参数仅仅是一个字符串,你应该将其先处理为'北京','上海'这样的格式
#3
aspic2009-12-01 14:41
对,where应该是数组才可以in
#4
guanry2009-12-01 14:53
回复 2楼 chenguoxing517
对 对 这个我知道 我接过来的是 where=北京,上海  我就是不知道我该怎么弄成 where='北京','上海' 呢 我是新手程序员 着急 请大侠教教我 万分感谢
#5
aspic2009-12-01 15:43
替换一下不就得了把,替换成','然后前后再各加一个'
1