| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 571 人关注过本帖
标题:[求助]asp+sql检索后分页 错误sos
只看楼主 加入收藏
安静
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2006-5-8
收藏
 问题点数:0 回复次数:3 
[求助]asp+sql检索后分页 错误sos

<%
public sql
public counttemp
public typetemp
public nametemp
public metrotemp
public typetemp1
select case request("ra")
case "咖哩"
typetemp1="咖喱"
case "CN"
typetemp1="CN"
end select
if typetemp1<>"CN" then
sql="select count(guest_id) countid from guest_info where guest_bigname='" & typetemp1 & "' and guest_type='C' "
set session("rs")=session("cn").execute (sql)
counttemp=session("rs").fields("countid")
sql="select guest_time,guest_tel,guest_address,guest_tran,guest_hy,guest_metro,guest_id,guest_name,guest_memo,guest_bigname from guest_info where guest_bigname='" & typetemp1 & "' and guest_type='C' order by guest_hy desc,guest_memo desc"
set session("rs")=session("cn").execute (sql)
nametemp=session("rs").fields("guest_name")
metrotemp=session("rs").fields("guest_metro")
typetemp=session("rs").fields("guest_bigname")
hytemp=session("rs").fields("guest_hy")
else
sql="select count(guest_id) countid from guest_info where guest_hy like '%C%' and guest_type='C' and guest_grad='16'"
set session("rs")=session("cn").execute (sql)
counttemp=session("rs").fields("countid")
sql="select guest_time,guest_tel,guest_address,guest_tran,guest_hy,guest_metro,guest_id,guest_name,guest_memo,guest_bigname from guest_info where guest_hy like '%C%' and guest_type='C' order by guest_hy desc"
set session("rs")=session("cn").execute (sql)
nametemp=session("rs").fields("guest_name")
metrotemp=session("rs").fields("guest_metro")
typetemp=session("rs").fields("guest_bigname")
end if
%>
<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#a04848">
<%
dim a
dim b
dim c
dim d
dim f
dim g
if counttemp<>0 then
session("rs").PageSize =8
iCount=session("rs").recordcount
iPageSize=session("rs").PageSize
maxpage=session("rs").PageCount
page=request("page")
if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if
session("rs").AbsolutePage=Page
if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=int(iPageSize+1)/8
end if
for i=1 to x
b=session("rs").fields("guest_name")
c=session("rs").fields("guest_metro")
d=session("rs").fields("guest_id")
f=session("rs").fields("guest_memo")
z=session("rs").fields("guest_address")
y=session("rs").fields("guest_tel")
x=session("rs").fields("guest_tran")
v=session("rs").fields("guest_time")
hytemp=session("rs").fields("guest_hy")
f=left(f,50)
g=left(session("rs").fields("guest_bigname"),2)
hrefname="<a href=/store/page/" & d & ".asp>"
response.write "<tr>"
response.write "<td align=center bgcolor=#666666 height=30 width=246>"
response.write "<font color=#ffffff size=2>" & "<strong>" & b & "</strong>" & "</font>"
response.write "</td>"
response.write "<td rowspan=2 align=left>" & "<br>"
response.write "<font size=2 color=#a04848>" & f & "……" & "</font>" & "<br>"
response.write "<font size=2 color=#a04848>" & "OPEN:" & v & "</font>" & "<br>"
response.write "<font size=2 color=#a04848>" & "TEL:" & y & "</font>" & "<br>"
response.write "<font size=2 color=#a04848>" & "ADDRESS:" & z & "</font>" & "<br>"
response.write "<font size=2 color=#2952A7>" & "<a onclick=""javascript:mst_showMap(21,'" & b & "','" & z & " ')""> " & " <strong> " & " --------- 点击查看详细地址与路线. " & " </strong> " & " </a> "
response.Write " <br> "
response.write "<font size=2 color=#a04848>" & "TRAN:" & x & "</font>"
response.write "<form name=detail method=post action=result.asp> " & "<input name=detailsub type=image src=pics/complete/butdetail.gif>" & "<input name=idtran type=hidden value=" & d & ">" & "</form>"
response.write "</td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td align=left valign=top>"
response.write "<img src=/store/pics/" & d & "/11.jpg" & " width=246" & " height=164>"
response.write "</td>"
response.write "</tr>"
counttemp=counttemp-1
session("rs").movenext
next
call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=right>")
end if
%>
</table>
<%
Sub PageControl(iCount,pagecount,page,table_style,font_style)
Dim query, a, x, temp
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")

query = Split(Request.ServerVariables("QUERY_STRING"), "&")
For Each x In query
a = Split(x, "=")
If StrComp(a(0), "page", vbTextCompare) <> 0 Then
temp = temp & a(0) & "=" & a(1) & "&"
End If
Next
Response.Write("<table " & Table_style & " width=550 bgcolor=#f9aed7>" & vbCrLf )
Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & temp & "Page='+ this.page.value;return false;""><TR>" & vbCrLf )
Response.Write("<TD align=right>" & vbCrLf )
Response.Write(font_style & vbCrLf )
if page<=1 then
Response.Write ("首页 " & vbCrLf)
Response.Write ("上页 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=1 class=linkc>首页</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page-1) & " class=linkc>上页</A> " & vbCrLf)
end if
if page>=pagecount then
Response.Write ("下页 " & vbCrLf)
Response.Write ("尾页 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page+1) & " class=linkc>下页</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?" & temp & "Page=" & pagecount & " class=linkc>尾页</A> " & vbCrLf)
end if
Response.Write(" 页次:" & page & "/" & pageCount & "页" & vbCrLf)
Response.Write(" 转到" & "<INPUT TYEP=TEXT NAME=page SIZE=1 Maxlength=5 VALUE=" & page & ">" & "页" & vbCrLf & "<INPUT type=submit style=""font-size: 9pt"" value=GO class=b2>")
Response.Write("</TD>" & vbCrLf )
Response.Write("</TR></form>" & vbCrLf )
Response.Write("</table>" & vbCrLf )
End Sub
%>
错误提示:ADODB.Field 错误 '800a0bcd'

BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。

行红色字体处.
请求援助 在线等..

[此贴子已经被作者于2006-5-10 12:59:21编辑过]

搜索更多相关主题的帖子: sos sql asp 检索 
2006-05-10 12:58
islet
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:89
帖 子:6548
专家分:0
注 册:2005-1-28
收藏
得分:0 
记录数为0
2006-05-10 13:48
安静
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2006-5-8
收藏
得分:0 
可以详细一点吗? 如果不加分页代码时可以完全显示所有同类数据呵:)

安静 淡然 执着 狂野..
2006-05-10 14:09
安静
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2006-5-8
收藏
得分:0 
如果在调试程序中没有错误提示同时又没有显示自己想要的结果 应该添加什么代码可以查看出具体原因呢?

安静 淡然 执着 狂野..
2006-05-10 17:26
快速回复:[求助]asp+sql检索后分页 错误sos
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.039151 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved