美拍破破歌曲:请高手帮帮忙:ASP表单提交后如何正确显示自己的页面?多谢了

来源:百度文库 编辑:高考问答 时间:2024/05/04 13:05:33
我的源程序是这样的:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>表单提交</title>
</head>

<body>
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("guestbook.mdb")
name=request.form("name")
psw=request.form("psw")
exec="insert into guest(name,psw)values('"+name+"', '"+psw+"')"
conn.execute exec
conn.close
set conn=nothing
%>
<%
response.write "您已成功参加本次活动"
%>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>

</body>

</html>
但表单提交后总是说无法显示,请指教其中的错误.另外想问一下,如果想将表单提交后引到别的页面上该如何执行?
谢谢!

首先把你这个程序的错误修改正确,程序才能正常执行下去,这样后面的代码才能执行。去掉一下代码:
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
然后转向别的页面用这个:
Response.Redirect("error.asp")
后面括号和引号中填别的页面地址。

你这个应该就是表单提交处理页面.
另一个表单提交页应有两个表单对象:"name"和"pass"
当提交方式是post是为request.form("name") ,
如果是get时应为request.querystring("name") .
估计是你的数据库程序错误,如前面没有set rs...但后面又有.
或者是你的程序中变量name或pass数据为空造成错误.

把internet选项中的 高级/显示友好http错误信息 给去掉,然后就能看到错误出现在哪里了。
你这个错误是因为rs.close这句,没有创建rs对象,无法关闭。