请高手帮忙指点一下,多值传递的问题,我用了数组,想把多个USERNAME 通过数组arrTmp传递给变量session("aaaa"),再传到另一个页面使用,下面有错误吗?

frankrenping 2009-03-09 09:09:18

<!--#include file="conn.asp"-->
<%
Dim arrTmp()
Redim arrTmp(100)
Gender1=request.Form("Gender")
age1=request.Form("age1")
age2=request.Form("age2")
country=request.Form("which country")
set rs=server.createobject("adodb.recordset")
sql="select Username,Gender,age,Country from customer1 where Gender='"&Gender1&"'and(age BETWEEN '"&age1&"' and '"&age2&"')and Country ='"&country&"'"
rs.open sql,conn,1,1
if rs.eof and rs.bof then '记录不存在,说明email输入错误
response.Write("email is wrong!")

else'否则执行下面语句
do while not rs.eof
response.Write(""&rs("Username")&"")=arrTmp
arrTmp=session("aaaa")
rs.MoveNext
loop
end if
rs.close
conn.close

Set rs = Nothing
Set Conn = Nothing
%>
...全文
58 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
搬运工865 2009-03-10
  • 打赏
  • 举报
回复
<!--#include file="conn.asp"--> 
<%
Dim arrTmp()
Redim arrTmp(100)
Gender1=request.Form("Gender")
age1=request.Form("age1")
age2=request.Form("age2")
country=request.Form("which country")
set rs=server.createobject("adodb.recordset")
sql="select Username,Gender,age,Country from customer1 where Gender='"&Gender1&"'and(age BETWEEN '"&age1&"' and '"&age2&"')and Country ='"&country&"'"
rs.open sql,conn,1,1
if rs.eof and rs.bof then '记录不存在,说明email输入错误
response.Write("email is wrong!")

else'否则执行下面语句
for (i=0 to rs.recordcount)
'response.Write(""&rs("Username")&"")=arrTmp
arrTmp(i)=rs("Username")
rs.MoveNext
next
end if
rs.close
conn.close
session("aaaa")=arrTmp
Set rs = Nothing
Set Conn = Nothing
%>



确定在101条以内?
frankrenping 2009-03-10
  • 打赏
  • 举报
回复
应该是定义错误的问题,RS(“USERNAME”)是字符串,而不是数字,那字符串有如何申明呢?
frankrenping 2009-03-10
  • 打赏
  • 举报
回复
1楼的程序运行后会出现错误提示:arrTmp(i)=rs("Username") 下标i越界
不知那里错了?请指教。

28,404

社区成员

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

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