关于spilt函数及结果处理
checkbox,Fid表单,提交后,得到" A1001,A1002,A1003,A1004 "等字符
我用sql
select * from table_name where Fbillno in(Fid)
出错,因为是字符串,不是数字
于是想到用spilt函数处理,然后再处理成 ('A1001','A1002','A1003','A1004')
结果发现处理后,合并不起来,
代码如下
dim Fid,nFid,sql,rs,oFid,a,i
Fid=request("Fid")
nFid=split(Fid,",")
For i = LBound(nFid) To UBound(nFid)
nFid(i)="'"&nFid(i)&"'"
Next
oFid=nFid(i)&","nFid(i+1)
------解决方案--------------------感觉无需用split,你Fbillno字段类型改成varchar就可以了
------解决方案--------------------fid = "A1001,A1002,A1003,A1004"
fid = "'" & Replace(fid, ",", "','") & "'"
sql = "select * from table_name where Fbillno in(" & fid & ")"
------解决方案--------------------楼上正解!你自己的代码有点眼晕!!