#@_@ 求救 @_@ 用checkbox选中多项做更新操作```请大侠过来看看,非常感谢 @_@

hreoghost 2006-03-20 10:57:39
用checkbox选中多项做更新操作```

现在得的的ID是这样的```
sql1="select * from tb where sid in('7259222297,533383679058')"

现在要怎么变成
sql1="select * from tb where sid in('7259222297','533383679058')"

也就是说括号里要用单引号分开 ,不然更新不了```

<input name="checkid" type="checkbox" id="checkid" value="<%=cstr(rs("sid"))%>">

--------代码如下--------------------------------------------------------
dim id
id=trim(request("checkid")) '从上一页得到的CHECKBOX选中的项

action=request("action")
if request("action")="modify" then
sid=request("id")
pp=trim(request("pp"))
dim rs1,sql1
set rs1=server.CreateObject("adodb.recordset")
sql1="select * from tb where sid in('"&sid&"')"
rs1.open sql1,conn,1,3
response.write sql1
do while not rs1.eof
rs1("p_times")=p_times
rs1("pp")=pp
rs1.update
rs1.MoveNext
loop
response.write ("恭喜您,修改成功!!!")
end if
-----------------------------------------------------
请看看要怎么办?
...全文
119 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
hreoghost 2006-03-21
  • 打赏
  • 举报
回复
问题解决了```

在逗号二边直接多一个空格就行了``

下面是正确答案```

散分````
---------------
str2=replace(sphoneid," , ","','")

sql1="select * from prize where sphoneid in('"&str2&"')"
hreoghost 2006-03-21
  • 打赏
  • 举报
回复
上面的大侠,用这样的话可以
str2=replace(sphoneid,",","','")
sql1="select * from prize where sphoneid in('"&str2&"')"

write出这个语句
select * from prize where sphoneid in('59587259297 ',' 59183679058')

但是只能更新'59587259297 这条记录```

sql1="select * from prize where sphoneid in('59587259297','59183679058')"
我用数字调试写这样就可以更新多条``

等会,再看下``
jspadmin 2006-03-21
  • 打赏
  • 举报
回复
而且,用join的话,也要注意不是jion,是join
jspadmin 2006-03-21
  • 打赏
  • 举报
回复
str1="'7259222297,533383679058'"
str2=replace(str1,",","','")
sql1="select * from tb where sid in(str2)"
hreoghost 2006-03-21
  • 打赏
  • 举报
回复
还是有点问题````

---------------------------------------------------------------
sql1="select * from tb where sid in("&join(split(sid,","),"','")&")"
Microsoft OLE DB Provider for SQL Server (0x80040E14)
第 1 行: ',' 附近有语法错误。
---------------------------------------------------------------
sql1="select * from tb where sid in("&join(split(sid,","),"','")&")"
Microsoft OLE DB Provider for SQL Server (0x80040E14)
第 1 行: ',' 附近有语法错误。
---------------------------------------------------------------
sql1="select * from tb where sid in(‘"&jion(split(sid,","),"','")&"'"
Microsoft VBScript 运行时错误 (0x800A000D)
类型不匹配: 'jion'
---------------------------------------------------------------
zhanghongwen 2006-03-21
  • 打赏
  • 举报
回复
不错,用SPLIT()函数分开就行了.
k_lyh 2006-03-21
  • 打赏
  • 举报
回复
上面的仁兄可能是直接写出来没调试,有点小错误,在下稍做修改。

<%
sid="'7259222297,533383679058,533383679058'"

sql="select * from tb where sid in("&join(split(sid,","),"','")&")"

response.write sql
%>
daniel206 2006-03-20
  • 打赏
  • 举报
回复
这样就行了
sql="select * from tb where sid in('"&jion(split(sid,","),"','")&"'"

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧