传递价值问题 [英] Passing Value Question
问题描述
我将页面中的值传递到另一页
页面时遇到一些困难。我将提供代码的摘录。我想我很接近。
这是来自Page1.ASP
<%
Set Conn = Server.CreateObject(" ADODB.Connection")
DSNtest =" DRIVER = {Microsoft Access Driver(* .mdb)};
DSNtest = dsntest& " DBQ = QUOT; &安培; Server.MapPath(" ncci.mdb")
Conn.Open DSNtest
设置rs = Server.CreateObject(" ADODB.Recordset")
strSQL =" SELECT Distinct Insured FROM CCI2"
rs.Open strSQL,conn,3
%>
< TABLE>
< tr>
< td width = 200>
< select
onchange =" parent.fSearch1.location.href =''Search1.a sp?Ins =''+ this.value;"
size =" 1">
选择内容后,将INS值传递给Page 2.ASP(代码
未显示)
这是来自Page 2.ASP
insName = Request.QueryString(" Ins")
>
功能sIn(s)
sIn ="''" &安培;替换(s,,,和&; "''"
结束函数
设置Conn = Server.CreateObject(" ADODB.Connection")
DSNtest =" DRIVER = {Microsoft Access Driver(* .mdb)};
DSNtest = dsntest& " DBQ = QUOT; &安培; Server.MapPath(" cci.mdb")
Conn.Open DSNtest
设置rs = Server.CreateObject(" ADODB.Recordset")
strSQL =" SELECT Distinct State FROM CCI2,其中Insured =" &安培; sIn(insName)&
";"
rs.Open strSQL,conn,3,3
到目前为止应该可以正常工作。
我正在尝试将insName传递给Page 3.ASP
我已经在我的表单中尝试了这个。 />
<%
response.write"< input type = hidden name = insName value =''" &安培; insName& "''>"
%>
这是来自Page 3.ASP
insName = Request.form(" insName")
然后我只是尝试使用下面的代码显示它并且它没有看到
它。
response.write(insName)
请帮忙。
< form> page2.asp上的标签说method =" post"或方法=" get"?
如果method =" post",则一切都应该没问题。 (如果这是'b
的情况,请向我们展示page2.asp。)如果它的方法=" get",则使用
Request.Querystring(" ; insName")而不是Request.Form。
-
雷在工作
Microsoft ASP / ASP.NET MVP
" Dthmtlgod" <做************ @ netzero.net>在消息中写道
news:ep ************** @ TK2MSFTNGP12.phx.gbl ...
<我试图将insName传递给Page 3.ASP
我在我的表单中尝试了这个。
<%
response.write"< input type = hidden name = insName value =''" &安培; insName&
"''>" %>
这是来自Page 3.ASP
insName = Request.form(" insName")
然后我只是在尝试使用下面的代码显示它,
看不到它。
response.write(insName)
嗨雷,在这里你去
这是Page 2
< body>
<%@ LANGUAGE =" VBSCRIPT" %>
<%
insName = Request.QueryString(" Ins")----这是来自之前的页面。
函数sIn(s)
sIn ="''" &安培;替换(s,,,和&; "''"
结束函数
设置Conn = Server.CreateObject(" ADODB.Connection")
DSNtest =" DRIVER = {Microsoft Access Driver(* .mdb)};
DSNtest = dsntest& " DBQ = QUOT; &安培; Server.MapPath(" cci.mdb")
Conn.Open DSNtest
设置rs = Server.CreateObject(" ADODB.Recordset")
strSQL =" SELECT Distinct State FROM CCI2,其中Insured =" &安培; sIn(insName)&
";"
rs.Open strSQL,conn,3,3
% >
< table border =" 0" CELLSPACING = QUOT; 0" cellpadding =" 0">
< form name =" formSearch1"行动= QUOT; HTTP://cci/home.html" method =" post">
< tr>
< td>< b>过滤器:< / b>& nbsp; < / td>
< td>
< select name =" state"
onchange =" parent.fSearch2。 location.href =''Search2.a sp?St =''+ this.value;"
size =" 1">
< option value ="">选择州< /选项>
<%
虽然不是RS.EOF
%>
< div>< font size = 1>
< center>
< option value ="< ;%= RS(" State")%>"><%= RS(" State")%>< / option>
< / center>
< / font>
< / div>
<%
RS.MoveNext
WEND
%>
< / select>
< / td>
< / tr>
<%
response.write"< input type = hidden name = insName value ='' " &安培; insName& "''>"
%>
< / form>
< / table>
< / body>
Page 3
<%@ LANGUAGE =" VBSCRIPT" %>
<! - METADATA TYPE =" typelib" FILE =" c:\program files \ commmon
files \ system \\\\\\\\\\\\\\\\\\\\\\\\ - >
<%
rState = Request.QueryString(" St")
insName = Request.Form(" insName")
函数sIn(s)
sIn ="''" &安培;替换(s,,,和&; "''"
结束功能
response.write("< H3>")
回复.write("< CENTER>")
response.write(sIn(insName))
response.write("< / center>" )
response.write("< / H3>")
......
Ray Costanzo [MVP]" <我的第34号商业广告的名字>写在
消息新闻:或************** @ TK2MSFTNGP11.phx.gbl ...< form> ; page2.asp上的标签说method =" post"或方法=" get"?
如果method =" post",一切都应该没问题。 (如果是'那么请向我们显示page2.asp。)如果它的方法="获取",则使用
Request.Querystring(" insName")而不是Request。表格。
-
雷在工作
Microsoft ASP / ASP.NET MVP
" Dthmtlgod" <做************ @ netzero.net>在消息中写道
新闻:ep ************** @ TK2MSFTNGP12.phx.gbl ...
我我试图将insName传递给Page 3.ASP
我在我的表单中尝试了这个。
<%
response.write"< input type = hidden name = insName值= '' " &安培; insName&
"''>"%>
这是来自Page 3.ASP
insName = Request.form(" insName")
然后我只是尝试使用下面的代码显示它
没有看到< blockquote class =post_quotes> it。
response.write(insName)
你发布到.html页面?您是否已将IIS配置为使用ASP.dll处理
进程.html页面?你的样本中的第3页是home.html?
-
雷在工作
Microsoft ASP / ASP .NET MVP
" Dthmtlgod" <做************ @ netzero.net>在消息中写道
新闻:%2 ****************** @ TK2MSFTNGP10.phx.gbl ...
< table border =" 0" CELLSPACING = QUOT; 0" cellpadding =" 0">
< form name =" formSearch1"行动= QUOT; HTTP://cci/home.html"
method =" post"> < tr>
< td>< b>过滤器:< / b>& nbsp;< / td>
< td>
< select name =" state"
onchange =" parent.fSearch2.location.href =''Search2.a sp?St =''+ this.value;
"大小= QUOT 1 QUOT;>
Page 3
rState = Request.QueryString(" St")
insName = Request.Form(" insName")
I am having a little difficulty in passing a value from a page to another
page. I am going to provide excerpts from the code. I think I am close.
This is from Page1.ASP
<%
Set Conn = Server.CreateObject("ADODB.Connection")
DSNtest="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtest=dsntest & "DBQ=" & Server.MapPath("ncci.mdb")
Conn.Open DSNtest
Set rs = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT Distinct Insured FROM CCI2"
rs.Open strSQL, conn, 3, 3
%>
<TABLE>
<tr>
<td width=200>
<select
onchange="parent.fSearch1.location.href=''Search1.a sp?Ins=''+this.value;"
size="1">
This passes the INS value to Page 2.ASP after something is selected (code
not shown)
This is from Page 2.ASP
insName = Request.QueryString("Ins")
Function sIn(s)
sIn = "''" & Replace(s, "''", "''''") & "''"
End Function
Set Conn = Server.CreateObject("ADODB.Connection")
DSNtest="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtest=dsntest & "DBQ=" & Server.MapPath("cci.mdb")
Conn.Open DSNtest
Set rs = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT Distinct State FROM CCI2 where Insured = " & sIn(insName) &
";"
rs.Open strSQL, conn, 3, 3
This works as it should up to this point.
I am trying to pass insName to Page 3.ASP
I have tried this inside my form.
<%
response.write"<input type=hidden name=insName value=''" & insName & "''>"
%>
This is from Page 3.ASP
insName = Request.form("insName")
Then I am just trying to display it using the below code and it doesn''t see
it.
response.write(insName)
Please help.
Does the <form> tag on page2.asp say method="post" or method="get"?
If method="post", all should be okay. (Show us page2.asp if that''s
the case.) If it''s method="get", then use
Request.Querystring("insName") instead of Request.Form.
--
Ray at work
Microsoft ASP/ASP.NET MVP
"Dthmtlgod" <do************@netzero.net> wrote in message
news:ep**************@TK2MSFTNGP12.phx.gbl...
I am trying to pass insName to Page 3.ASP
I have tried this inside my form.
<%
response.write"<input type=hidden name=insName value=''" & insName & "''>" %>
This is from Page 3.ASP
insName = Request.form("insName")
Then I am just trying to display it using the below code and it doesn''t see it.
response.write(insName)
Hi Ray, here you go
Here is Page 2
<body>
<%@ LANGUAGE="VBSCRIPT" %>
<%
insName = Request.QueryString("Ins") ---- This was from a previous page.
Function sIn(s)
sIn = "''" & Replace(s, "''", "''''") & "''"
End Function
Set Conn = Server.CreateObject("ADODB.Connection")
DSNtest="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtest=dsntest & "DBQ=" & Server.MapPath("cci.mdb")
Conn.Open DSNtest
Set rs = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT Distinct State FROM CCI2 where Insured = " & sIn(insName) &
";"
rs.Open strSQL, conn, 3, 3
%>
<table border="0" cellspacing="0" cellpadding="0">
<form name="formSearch1" action="http://cci/home.html" method="post">
<tr>
<td><b>Filter(s):</b> </td>
<td>
<select name="state"
onchange="parent.fSearch2.location.href=''Search2.a sp?St=''+this.value;"
size="1">
<option value="">Select a State</option>
<%
While NOT RS.EOF
%>
<div><font size=1>
<center>
<option value="<%=RS("State")%>"><%=RS("State")%></option>
</center>
</font>
</div>
<%
RS.MoveNext
WEND
%>
</select>
</td>
</tr>
<%
response.write"<input type=hidden name=insName value=''" & insName & "''>"
%>
</form>
</table>
</body>
Page 3
<%@ LANGUAGE="VBSCRIPT" %>
<!-- METADATA TYPE="typelib" FILE="c:\program files\common
files\system\ado\msado15.dll" -->
<%
rState = Request.QueryString("St")
insName = Request.Form("insName")
Function sIn(s)
sIn = "''" & Replace(s, "''", "''''") & "''"
End Function
response.write("<H3>")
response.write("<CENTER>")
response.write(sIn(insName))
response.write("</center>")
response.write("</H3>")
......
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:Or**************@TK2MSFTNGP11.phx.gbl...Does the <form> tag on page2.asp say method="post" or method="get"?
If method="post", all should be okay. (Show us page2.asp if that''s
the case.) If it''s method="get", then use
Request.Querystring("insName") instead of Request.Form.
--
Ray at work
Microsoft ASP/ASP.NET MVP
"Dthmtlgod" <do************@netzero.net> wrote in message
news:ep**************@TK2MSFTNGP12.phx.gbl...
I am trying to pass insName to Page 3.ASP
I have tried this inside my form.
<%
response.write"<input type=hidden name=insName value=''" & insName &
"''>"%>
This is from Page 3.ASP
insName = Request.form("insName")
Then I am just trying to display it using the below code and it
doesn''t seeit.
response.write(insName)
You''re posting to a .html page? Do you have IIS configured to
process .html pages with ASP.dll? Page3 in your sample is home.html?
--
Ray at work
Microsoft ASP/ASP.NET MVP
"Dthmtlgod" <do************@netzero.net> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
<table border="0" cellspacing="0" cellpadding="0">
<form name="formSearch1" action="http://cci/home.html" method="post"> <tr>
<td><b>Filter(s):</b> </td>
<td>
<select name="state"
onchange="parent.fSearch2.location.href=''Search2.a sp?St=''+this.value;
" size="1">
Page 3 rState = Request.QueryString("St")
insName = Request.Form("insName")
这篇关于传递价值问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!