ASP传递参数大全
2007-07-04 09:56
1、链接传递
<a href=delete.asp?name=<%=Request.QueryString("name")%>>确认删除</a>
2、表单传递
<%name=Request.QueryString("name")
<form action=modified.asp?name=<%=name%> method=post></form>
3、数据库传递
db=Request.QueryString("db")
set rs=server.createobject("adodb.recordset")
rs.open "SELECT * FROM "&db&" where id="&id,Conn,1,1
4、输出传递
<%Response.Write ""&rs("topic")&""%>
7、conn=session("conn")
rs.Open "update userinfo_pbyy set 姓名='"&Request.Form("name")&"',password='"&Request.Form("pass")&"',userrights='"&Request.Form("rights")&"',userid="&Request.Form("id")&" where 姓名='"&nametemp&"'",conn,1,1
8、session值的定义与使用
<%name=Request.Form("username")
pass=Request.Form("password")
if name="administrator" and pass="bbkav31" then
session("pass")="1"
set conn=server.createobject("adodb.connection")
set rs=server.createobject("adodb.recordset")
DBPath = Server.MapPath("..\dbacess\yjkuop.mdb")
conn.Open "Provider=SQLOLEDB.1;Password=test;Persist Security Info=True;User ID=sa;Initial Catalog=test;Data Source=test"
session("conn")=conn
end if
Response.Redirect "admin.asp"
%>
使用方法:
if session("pass")="1" then
Response.Redirect("xsdf.asp")
else
Response.Redirect "error.htm"
end if
%>
上一篇: 怎样实现页面自动跳转
下一篇: Linux虚机&