| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2449 人关注过本帖
标题:[求助]SQL查询结果分页显示报错ADODB.Recordset 错误 '800a0bb9'
取消只看楼主 加入收藏
yanziyz
Rank: 1
等 级:新手上路
帖 子:171
专家分:0
注 册:2006-5-20
结帖率:75%
收藏
 问题点数:0 回复次数:1 
[求助]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
yanziyz
Rank: 1
等 级:新手上路
帖 子:171
专家分:0
注 册:2006-5-20
收藏
得分:0 

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

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



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

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