| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2449 人关注过本帖
标题:[求助]SQL查询结果分页显示报错ADODB.Recordset 错误 '800a0bb9'
只看楼主 加入收藏
yanziyz
Rank: 1
等 级:新手上路
帖 子:171
专家分:0
注 册:2006-5-20
结帖率:75%
收藏
 问题点数:0 回复次数:3 
[求助]SQL查询结果分页显示报错ADODB.Recordset 错误 '800a0bb9'
各位高手帮忙救命呀,我想把查询结果分页显示,第一页还可以正常显示,但点击“下一页“后就报以下错误:

ADODB.Recordset 错误 '800a0bb9'

参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。

/paper_serch/jscj.asp,行 47


下面是我的查询分页显示代码,文件名是jscj.asp

<body>
<table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/js_title.png" width="780" height="100"></td>
</tr>
<tr>
<td height="13">&nbsp;</td>
</tr>
</table>
<%
dim strselect, strinput,strsql

strselect=Request.form("txtPrimary") '从上一页取得参数
strinput=Request.form("txtinput") '从上一页取得参数


select case strselect
case "论文题名"
strsql="select * from xwlwtj where (Chntitle='"&strinput&"')"
case "论文作者"
strsql="select * from xwlwtj where (Name='"&strinput&"')"
case "导师"
strsql="select * from xwlwtj where (Teachername1='"&strinput&"')"
case "学科专业"
strsql="select* from xwlwtj where (Major='"&strinput&"')"
case"关键词"
strsql="select * from xwlwtj where (Keyword like '%"&strinput&"%')"
case"中文摘要"
strsql="select * from xwlwtj where (AbstructCH like '%"&strinput&"%')"

end select
set conn=server.CreateObject("ADODB.Connection")
conn.open"Driver={SQL Server};Server=USER;Database=paperdate;Uid=sa;Pwd=123"
set rs=server.createobject("ADODB.recordset")
'rs.CursorType ="adOpenStatic"
'rs.CursorLocation ="adUseClient"

rs.open strsql,conn,"3","1" '出错行
PgSz="1"
rs.PageSize = Cint(PgSz)
Total=INT(RS.recordcount / PgSz * -"1")*-"1" '计算可显示页面的总数

%>
<table width="780" border="0" cellspacing="0" cellpadding="0">
<form name="form1" method="post" action="">
<tr>
<td width="83" height="25">&nbsp;</td>
<td width="619" height="25"><font size="2"><strong>查询结果:</strong></font><font size="2">检索命中记录数为<%=rs.RecordCount%>条,共<%=rs.pageCount%>页</font>&nbsp;</td>
<td width="78" height="25">&nbsp;</td>
</tr>
<tr>
<td width="83" height="25">&nbsp;</td>
<td height="25"><font size="2"><strong>当前检索表达式为</strong>:
<%response.write""&strselect&"="&strinput&""%></font></td>
<td height="25">&nbsp;</td>
</tr>
<tr>
<td height="25">&nbsp;</td>
<td height="25">&nbsp;&nbsp;&nbsp;<select name="txtPrimary" >
<option value="论文题名">论文题名</option>
<option value="论文作者">论文作者</option>
<option value="导师">导师</option>
<option value="学科专业">学科专业</option>
<option value="关键词">关键词</option>
<option value="中文摘要">中文摘要</option>
</select>
&nbsp;&nbsp;
<input type="text" name="textfield" size="30">&nbsp;&nbsp;&nbsp;
<input type="submit" name="Submit" value="二次检索">&nbsp;</td>
<td height="25">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><%If RS.RecordCount="0" then
response.write "<font size=2>对不起,数据库中没有相关信息!</font>"
else

PageNo=int(Request("pageno"))
if PageNo="" Then
PageNo ="1"
else
PageNo=PageNo+"1"
PageNo=PageNo-"1"
end if
ScrollAction =Request("ScrollAction")
if ScrollAction ="上一页" Then
PageNo=PageNo-"1"
end if
if ScrollAction ="下一页" Then
PageNo=PageNo+"1"
end if
if ScrollAction ="首页" Then
PageNo="1"
end if
if ScrollAction ="尾页" Then
pageNO=""&Total&""
end if
if PageNo<"1" Then
PageNo ="1"
end if
'n="1"
RS.AbsolutePage=PageNo
%>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<%Do while not(RS is nothing)
RowCount=RS.PageSize
Do While Not RS.EOF and rowcount>"0"
'If n=1 then
%>
<tr>
<td></td>
<td><hr color="#E7E7CD"></td>
<td></td>
</tr>
<tr>
<td></td>
<td height="30"><span style="font-size:9pt"> <%=RS("Chntitle")%>(全文);&nbsp;<%=rs("Name")%>[<%=rs("Xuewei")%>];&nbsp;<%=rs("Dept")%></span></td>
</tr>

</form>
<%
RowCount=RowCount-"1"
RS.MoveNext
Loop
set RS=RS.NextRecordSet
Loop
Conn.Close
set rs =nothing
set Conn=nothing
%>
<tr>
<td></td>
<td><hr color="#E7E7CD"></td>
<td></td>
</tr>
</table>
<table width="780" border="0" cellspacing="0" cellpadding="0">
<form name=form2 method="post" action="jscj.asp">

<tr>
<td width="88" height="33" rowspan="4">&nbsp;</td>
<td width="626" height="33">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="HIDDEN" NAME="pageno" VALUE="PageNo">
<%
if PageNo>"1" Then
response.write"<INPUT TYPE=SUBMIT NAME='ScrollAction VALUE='上一页'>"
end if
if RowCount="0" and PageNo<>Total then
response.write"<INPUT TYPE=SUBMIT NAME='ScrollAction' VALUE='下一页'>"
end if
if pageNo<>"1" and pageNo<>"0"then
response.write"<INPUT TYPE=SUBMIT NAME='ScrollAction' VALUE='首页'>"
end if
if pageNo<>Total and Total>"2" then
response.write"<INPUT TYPE=SUBMIT NAME='ScrollAction' VALUE='尾页'>"
response.write "</FORM>"
end if
End if
%></td>
<td width="66" rowspan="4">&nbsp;</td>
</tr>

</table>
</body>

搜索更多相关主题的帖子: SQL Recordset ADODB 结果 
2006-05-20 11:22
本刚
Rank: 1
等 级:新手上路
威 望:1
帖 子:192
专家分:0
注 册:2005-12-3
收藏
得分:0 
rs.open strsql,conn,"3","1" '出错行


这个你这样改下
rs.open strsql,conn,1,3

我的网站 http://6asp. 欢迎指教。
2006-05-20 18:08
yanziyz
Rank: 1
等 级:新手上路
帖 子:171
专家分:0
注 册:2006-5-20
收藏
得分:0 

多谢楼上的关心与支持了,这个问题查了一天的资料,终于解决了,使查询条件参数传递的问题!我是新手,以后有问题还需要大家多多帮助!

2006-05-21 16:55
guhua
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-6-27
收藏
得分:0 

楼主``问题怎么解决的??能不能把正确的代码贴出来看看,我也是碰到同样的问题啊,谢谢了。我照二楼说的改了,但也是不行。
我的代码:(新手刚学的。。。)
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file ="../inc/conn.asp"-->
<!--#include file ="../inc/adovbs.inc"--><%
dim xq,bj
xq=request("xq")
bj=request("bj")
Dim rs,sqlstr
set rs=server.createobject("ADODB.Recordset")
if xq="d1" and bj="jy1" then
sql="select * from 第一学期04级计应 where 班级='04级计应一班'"
elseif xq="d1" and bj="jy2" then
sql="select * from 第一学期04级计应 where 班级='04级计应二班'"
elseif xq="d1" and bj="jw" then
sql="select * from 第一学期04级计网"
elseif xq="d2" and bj="jy1" then
sql="select * from 第二学期04级计应 where 班级='04级计应一班'"
elseif xq="d2" and bj="jy2" then
sql="select * from 第二学期04级计应 where 班级='04级计应二班'"
elseif xq="d2" and bj="jw" then
sql="select * from 第二学期04级计网"
elseif xq="d3" and bj="jy1" then
sql="select * from 第三学期04级计应 where 班级='04级计应一班'"
elseif xq="d3" and bj="jy2" then
sql="select * from 第三学期04级计应 where 班级='04级计应二班'"
elseif xq="d3" and bj="jw" then
sql="select * from 第三学期04级计网"
end if
rs.cursorlocation = 3 '使用客户端游标,可以使效率提高
rs.open sql,conn,1
%>
<%
Dim filepath
filepath=Request.ServerVariables("path_info")
%>
<%
Dim page,recordsperpage'定义相关变量
recordsperpage=10'每页记录数为10
page=Trim(Request.QueryString("page"))'page为接受值
rs.Pagesize=recordsperpage '赋值给rs.Pagesize
If Not IsEmpty(page) Then'判断page是否为空
If Not IsNumeric(page) Then'判断page是否为数字
page=1
Else
page=Clng(page)'把page定义为长整型赋值给page
End If
If page>=rs.Pagecount Then'如果page值比总页数大,当前页等于总页数
page=rs.Pagecount
Elseif page<=0 Then'如果page小于等于0,当前页等于1
page=1
Else
rs.AbsolutePage=page'否则当前页等于page值
End If
Else
page=1
End If

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../style/page.css" type="text/css">
<script src="../scripts/common.js" language="javascript" type="text/javascript"></script>

</head>
<body>
<table width="681" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#5ACE63" class="bodercolor2" style="border-collapse:collapse">
<tr bgcolor="#DEEFD6">
<td height="30" class="bordercolor" colspan=<%=rs.fields.count%>>
</td>
</tr>
<tr>
<td colspan=<%=rs.fields.count%>> </td>
</tr>
<%
response.write"<tr>"
for i=0 to rs.fields.count-1
response.write"<td nowrap align=center>" & rs(i).name & "</td>"
next
response.write"</tr>"
%>
<tr>
<td colspan="<%=rs.fields.count%>"><hr size="1" color="#CCCCCC"></td>
</tr>
<%
Do While rs.Eof=False and recordsperpage>0'循环开始直至recordperpage<=0结束循环
response.write"<tr onMouseOver='sbcolor(this)' onMouseOut='stcolor(this)' height=25>"
for i=0 to rs.fields.count-1
response.write"<td nowrap align=center>" & rs(i) & "</td>"
next
response.write"</tr>"
%>
<%
recordsperpage=recordsperpage-1
rs.MoveNext
Loop
%>
<%
If rs.Bof and rs.Eof Then
response.write"<tr>"
response.write"<td height=26 colspan=11><p>对不起,查找不到要查询的成绩!</p></td>"
response.write"</tr>"
%>
<%End If%>
<tr>
<td height="26" colspan="<%=rs.fields.count%>"><hr size="1" color="#CCCCCC"></td>
</tr>
</table>
<table width="680" border="0" align="center" cellpadding="0" cellspacing="0">
<tr bgcolor="#DEEFD6">
<form method="get" action="<%=filepath%>">
<td width="384">
<%If page<=1 Then %> [首页][上一页]
<%Else%>
<a href="<%=filepath%>?page=<%=1%>">[首页]</a>
<a href="<%=filepath%>?page=<%=page-1%>">[上一页]</a>
<%End If%>
<%If page>=rs.Pagecount Then%>
[下一页][尾页]
<%Else%>
<a href="<%=filepath%>?page=<%=page+1%>">[下一页]</a>
<a href="<%=filepath%>?page=<%=rs.Pagecount%>">[尾页]</a>
<%End If%></td>
<td height="20">
[页次:<font color="red"><b><%=page%></b></font>/<%=rs.Pagecount%>页][共<font color="red"><b><%=rs.Recordcount%></b></font>项 <font color="red"><b><%=rs.Pagesize%></b></font>项/每页] 转向
<input name="page" type="text" value="<%=page%>" size="2">页
<input name="imageField" type="image" src="../images/go.gif" width="18" height="18" border="0" onClick="document.form1.submit()">
</td>
</form>
</tr>
</table>
<%
rs.Close
Set rs=Nothing
conn.Close

Set conn=Nothing
%>
</html>

2006-06-27 21:55
快速回复:[求助]SQL查询结果分页显示报错ADODB.Recordset 错误 '800a0bb9'
数据加载中...
 
   



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

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