变量如何保存

zhanghua4109 2004-08-27 08:06:25
city这个变量如何保存
请高手指教
<!--#include file="adovbs.inc"-->
<!-- #include file="cnn.asp" -->
<%
dim city
city=request.form("city")
city=request.querystring("city")
Session("city")=city
set rst=cnn.execute("selectreccoach3 "&Session("city")&" ",,adcmdtext)
set rst1=cnn.execute("fare",,adcmdtable)
set rst2=cnn.execute("Report_fare",,adcmdtable)
%>
<html>
<body>

<div align="left">
 
<form name="form1" method="post" action="http://localhost/zh/index.asp">
<p>时间查询:
<select size="1" name="lstfld">
<option selected value="jt">今天</option>
<option value="mt">明天</option>
<option value="zt">昨天</option>
</select> 
<input name="btnsubmit" type="submit" value="查询"></p>
</form>
<%
dim field
field=request.form("lstfld")
if field="jt" then
set rst=cnn.execute("selectreccoach3 " & Session("city")& "",,adcmdtext)
end if
if field="mt" then
set rst=cnn.execute("selectreccoach",,adcmdtext)
end if
if field="zt" then
set rst=cnn.execute("selectreccoach2",,adcmdtext)
end if
%>
<%if rst.eof then%>
<p><font color="red">当前没有您所要的数据!</font></p>
<%else%>
     
<table cellspacing="3" cellpadding="3" width="100%" border="1" align="center">
<tr align="center" bgcolor="">
<td><font color="#">车次</td>
<td><font color="#">发车时间</td>
<td><font color="#">车型</td>
<td><font color="#">终点</td>
<td><font color="#">价格</td>
<td><font color="#">有无票</td>
<td><font color="#">途经站点</td>
</tr>
<%while not rst.eof%>

<tr bgcolor="">
<td align="center"><%=rst("coach")%></td>
<td><%=rst("run_time")%></td>
<td align="center"><%=rst("typename")%></td>
<td align="center"><%=rst("terminal")%></td>
<td align="center"><%=rst1("price")%></td>
<td align="center"><%if rst("leaves")>0 then %>有
<%else%>无
<%end if%></td>
<td><%=rst2("station")%></td>
</tr>
<%
rst.movenext
wend
%>
</table>
<%end if%>
</div>
</body>
</html>
...全文
108 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
seraphgxh 2004-08-27
  • 打赏
  • 举报
回复
上面提到的方法都可以。
此外,还可以用Hidden变量来实现。
hxnet 2004-08-27
  • 打赏
  • 举报
回复
session
nbce 2004-08-27
  • 打赏
  • 举报
回复
关键要看你这个city保存起来怎么用??
上面的很多方法都可以。不过具体还是要看你怎么使用了。
风之银翼 2004-08-27
  • 打赏
  • 举报
回复
用session保存!!!
BigTreeForShadow 2004-08-27
  • 打赏
  • 举报
回复
application保存也可以的。
gamestar1 2004-08-27
  • 打赏
  • 举报
回复
city是通过session来保存的,但session只能保存一段时间,最好还是存到数据库中.
makay 2004-08-27
  • 打赏
  • 举报
回复
session or database
guoweidong 2004-08-27
  • 打赏
  • 举报
回复
<form name="form1" method="post" action="http://localhost/zh/index.asp&city=<%=Session("city")%>">
guoweidong 2004-08-27
  • 打赏
  • 举报
回复
永久性储存还是存到数据库吧.
bzscs 2004-08-27
  • 打赏
  • 举报
回复
session

28,390

社区成员

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

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