一段asp的问题

来源:百度知道 编辑:UC知道 时间:2024/05/24 13:31:52
if instr(id,",")>0 then
id=replace(id," ","")
sql="Select img_b from pro where ID in (" & id & ")"
else
id=clng(id)
sql="select img_b from pro where ID=" & id
end if

这个句代码什么意思,我把他用在循环删除里面的
clng这个方法能再详细讲一下吗,有点不明白

如果id字符串中包含逗号,那么先把id中的空格去掉
比如id="12,34, 56"就变成了id="12,34,56"
sql="Select img_b from pro where ID in (12,34,56)"
否则id不含逗号的话
sql="select img_b from pro where ID=12"

if instr(id,",")>0 then '如果id变量里有逗号
id=replace(id," ","") '替换逗号为空
sql="Select img_b from pro where ID in (" & id & ")" '这个就不用我说了吧?
else '否则
id=clng(id) '把id转换成long型说白了就是取整数小于一为一
sql="select img_b from pro where ID=" & id '这个也不想多说了 如果你不懂就回炉另造再学学sql
end if

小花朵8 正解