+++++关于多行存储的问题!特急+++++

netrobinhood 2002-05-17 01:35:19
在当前页查询出几列用户信息,并在每个用户(也就是每行)自动增加了两列属性,分别为checkbox和text,初始为空白,根据需要输入后存储回表单,问怎么能够实现上述功能
特别能是实现多行信息存储?
...全文
57 12 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
saucer 2002-05-17
  • 打赏
  • 举报
回复
在POST之后才取Request("usercount")的值
netrobinhood 2002-05-17
  • 打赏
  • 举报
回复
nCount = CLNG(Request("usercount"))会Microsoft VBScript 运行时错误 ,问怎么回事?
saucer 2002-05-17
  • 打赏
  • 举报
回复
response.write "<input type=""checkbox"" name=""checkbox" & nCount & """ value=""" & rs("field1") & """>"

response.write "<input type=""text"" name=""text" & nCount & """ value=""" & rs("field2") & """>"

response.write "<input type=""hidden"" name=""usercount"" value=""" & nCount & """>"
netrobinhood 2002-05-17
  • 打赏
  • 举报
回复
用response.write怎样写
response.write"<input type="checkbox" name="checkbox<%=nCount%>" value="<%=rs("field1")%>">"
response.write"<input type="text" name="text<%=nCount%>" value="<%=rs("field2")%>">"

response.write"<input type="hidden" name="usercount" value="<%=nCount%>">"
对不对?要怎样写
saucer 2002-05-17
  • 打赏
  • 举报
回复
<%set rs = conn.execute("...")
nCount = 0
do while not rs.eof
nCount = nCount + 1
''显示数据
%>
<input type="checkbox" name="checkbox<%=nCount%>" value="<%=rs("field1")%>">
<input type="text" name="text<%=nCount%>" value="<%=rs("field2")%>">
<%
rs.MoveNext
loop
%>
<input type="hidden" name="usercount" value="<%=nCount%>">
netrobinhood 2002-05-17
  • 打赏
  • 举报
回复
... checkbox1 text1
... checkbox2 text2

<input type="checkbox" name="checkbox1">
<input type="text" name="text1">
<input type="checkbox" name="checkbox2">
<input type="text" name="text2">

.....
如果不知道会去出多少条,checkbox和text的name怎样能区分开?
saucer 2002-05-17
  • 打赏
  • 举报
回复
那是你查询的纪录数啊,如果你用
rs.open "...", conn, 1,1

则用rs.recordcount取得
nCount = rs.RecordCount

如果你用,
set rs = conn.execute("..")
则这么做:
nCount = 0
do while not rs.eof
nCount = nCount + 1
''显示数据
rs.MoveNext
loop

然后:
<input type="hidden" name="usercount" value="<%=nCount%>">
netrobinhood 2002-05-17
  • 打赏
  • 举报
回复
usercount这个变量怎样才能实现记数?我不是很明白,请指教
subunlee 2002-05-17
  • 打赏
  • 举报
回复
我建议你用上面的
<%
nCount = CLNG(Request("usercount"))
for n = 1 to nCount
chk = request("checkbox" & i)
text = request("text" & i)
'为用户i更新数据库
next

%>
saucer 2002-05-17
  • 打赏
  • 举报
回复
1.客户端
... checkbox1 text1
... checkbox2 text2

<input type="checkbox" name="checkbox1">
<input type="text" name="text1">
<input type="checkbox" name="checkbox2">
<input type="text" name="text2">

.....
记住共有几个用户
<input type="hidden" name="usercount" value="2">


2. 服务器端
<%
nCount = CLNG(Request("usercount"))
for n = 1 to nCount
chk = request("checkbox" & i)
text = request("text" & i)
'为用户i更新数据库
next

%>

28,409

社区成员

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

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