主题:  复选框问题

文远

职务:普通成员
等级:5
金币:1.0
发贴:2441
注册:2003/3/14 14:45:04
#12003/6/25 13:47:15
如何通过表单提交的复选框来检索数据库??
我写了一个不正确 请看看为什么 谢谢了
sql="select * from carte where id in (Request.Form('check'))"
check复选框的value 和 id 关联的



ryonick

职务:普通成员
等级:2
金币:1.0
发贴:317
注册:2002/11/4 15:57:45
#22003/6/25 15:23:28
id=trim(request.form("check"))
if id<>"" then
sql="select * from carte where id in ("&id&")"
set rs=cn.execute(sql)
end if
或者也可以使用
将check的名字定为check<%=rs("id")%>

if len(request.form("check"&rs("id")))>0 then
sqlstr="select* from database where id="&rs("id")
不过建议使用第一种



文远

职务:普通成员
等级:5
金币:1.0
发贴:2441
注册:2003/3/14 14:45:04
#32003/6/25 16:46:29
set rs=cn.execute(sql)报错了
不知道为什么 ...............



{ 在指尖上绽放的花朵 }

职务:普通成员
等级:5
金币:14.0
发贴:3209
注册:2002/7/25 21:24:11
#42003/6/25 19:00:11
不知道你的connection是怎样命名的呢?

不知道的话,试试conn.execute?