请大家帮我看一下代码,修改一下,在线等!!!!

golive 2004-04-07 10:16:58
<%
page_c=10 '显示行数

Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("../Result.mdb")
sql = "select wellposid,yearno,jh,jhdm,jb,ktxm,ktlb,jkddh from surveywellpos where surveyareaid=" & request("id")
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn,3
rs.PageSize=page_c
name="当前位置:"& request("name")&" "&"探区"
Page = CLng(Request("Page")) ' CLng 不可省略
If Page < 1 Then Page = 1
If Page > rs.PageCount Then Page = rs.PageCount
totalcount = rs.recordcount
%>


原因是我点击下一页时'surveyareaid='没有存住。请大家帮我id设为全局变量存起来,然后在surveyareaid=调用它。请大家帮我改一下,谢谢。
...全文
4 点赞 收藏 13
写回复
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
golive 2004-04-07
拜托,我是个菜鸟,您这样说我不太清楚。哪位能帮我搞定代码吗??谢谢啊
回复
你可以连接某个页面的时候指定id的值,然后request.querystring("id")
回复
golive 2004-04-07
session("id") = request("id")

上面变量,在sql = "select wellposid,yearno,jh,jhdm,jb,ktxm,ktlb,jkddh from surveywellpos where surveyareaid=" & request("id")怎么调用??
回复
zl13 2004-04-07
session("id") = request("id")
回复
golive 2004-04-07
上面的朋友我照着你们说的做了,不对啊。定义session("id")存储id怎么写啊??
回复
GoodyeahApple 2004-04-07
定义session("id")存储id
回复
yinxiong2002 2004-04-07
在你的数据库中,看一下surveyareaid这个字段的类型是数字型的,还是文本型的

如果是数字型,应为:sql = "select wellposid,yearno,jh,jhdm,jb,ktxm,ktlb,jkddh from surveywellpos where surveyareaid=" & request("id")

如果是文本型,应为:sql = "select wellposid,yearno,jh,jhdm,jb,ktxm,ktlb,jkddh from surveywellpos where surveyareaid='" & request("id")&"'"


回复
zl13 2004-04-07
每个后面都要加上这个"&id=" & request("id")
&
回复
zl13 2004-04-07
<%

response.write "共 " & rs.PageCount & " 页 第 " & Page & " 页 "
if Page=1 or rs.PageCount<=1 then
response.write "<font color=gray>首页 前页</font>"
else
response.write "<a href=cjxm_check.asp?page=1>首页</a> <a href=cjxm_check.asp?page=" & Page-1 & ">前页</a>"
end if

if Page=rs.PageCount or rs.PageCount<=1 then
response.write " <font color=gray>后页 尾页</font>"
else
response.write " <a href=cjxm_check.asp?page=" & Page+1 & "&id=" & request("id")
& "">后页</a> <a href=cjxm_check.asp?page=" & rs.PageCount & ">尾页</a>"
end if
%>


response.write " <a href=cjxm_check.asp?page=" & Page+1 & "&id=" & request("id")
&
回复
golive 2004-04-07
我的后面是这样的代码,怎么修改啊?
<%

response.write "共 " & rs.PageCount & " 页 第 " & Page & " 页 "
if Page=1 or rs.PageCount<=1 then
response.write "<font color=gray>首页 前页</font>"
else
response.write "<a href=cjxm_check.asp?page=1>首页</a> <a href=cjxm_check.asp?page=" & Page-1 & ">前页</a>"
end if

if Page=rs.PageCount or rs.PageCount<=1 then
response.write " <font color=gray>后页 尾页</font>"
else
response.write " <a href=cjxm_check.asp?page=" & Page+1 & ">后页</a> <a href=cjxm_check.asp?page=" & rs.PageCount & ">尾页</a>"
end if
%>

谢谢。
回复
miller530 2004-04-07
在分页链接下加一个 &id=<%=request("id") %>
如:<a href="<%=Request.ServerVariables("script_name") & "?page=1&id=" & Request("id") %>首页</a>
回复
chinaworker 2004-04-07
dim id

id =request("id")
回复
zl13 2004-04-07
id不能设为全局变量,会不可更改的,把surveyareaid和page一起传过去
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告