asp程序检索出现参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。

asp程序出错求大神帮帮改改错误信息如下:ADODB.Recordset'800a0bb9'参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。\wwwroot\... asp程序出错求大神帮帮改改
错误信息如下:
ADODB.Recordset '800a0bb9'
参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
\wwwroot\test\search.asp, line 124

<%
'连接和打开数据库
Dim connstr,names
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database.mdb")
Set sql = Server.CreateObject("ADODB.Connection")
sql.Open connstr
'查询
t1 = request("t1")
year1 = request("y1")
year2 = request("y2")
t3 = request("t3")
set rs = server.CreateObject("adodb.recordset")
if t1 <> "" and year1 <> "" and year2 <> "" and t3 <> "" Then
rs.open "Select * From ttt where t1 like '%" & t1 & "%' and t2 > #" & year1 &"# and t2 < #"&year2&"# and t3 like '%" & t3 &"%'", sql,1,1
elseif t1 <> "" and year1 <> "" and year2 <> "" and t3 = "" Then
rs.open "Select * From ttt where t1 like '%" & t1 & "%' and t2 > #" & year1 &"# and t2 < #"&year2&"#", sql,1,1
elseif t1 <> "" and year1 = year2 and t3 = "" Then
rs.open "Select * From ttt where t1 like '%" & t1 & "%' and t2 = #" & year1 &"#", sql,1,1
elseif t1 = "" and year1 <> "" and year2 <> "" Then
rs.open "Select * From ttt where t2 > #" & year1 &"# and t2 < #"&year2&"#", sql,1,1
elseif t1 = "" and year1 = year2 and year1 <> "" Then
rs.open "Select * From ttt where t2 = #" & year1 &"#", sql,1,1
elseif t1= "" and year1 = "" and year2 = "" and t3 = "" then
response.write "查询条件不符合规则,请重新输入查询条件"
response.end
end if
rs.pagesize=3 '允许每页显示记录最大数目
if request("page")<>"" then
epage=cint(request("page"))
if epage<1 then epage=1
if epage>rs.pagecount then epage=rs.pagecount
else
epage=0
end if

rs.absolutepage=epage

response.write "<title>以下为关于'"
response.write t1
response.write "'的搜索结果</title>"
response.write "<body style='background:url(../images/jiansuo/bg2.jpg) left top repeat-x;'>"
if rs.eof and rs.bof then
response.write "未找到与其相关的内容"
response.end
else
for i=0 to rs.pagesize-1
if rs.bof or rs.eof then exit for
Response.Write(I+1&".标题:"&rs("t1")&" ")
Response.Write("<td>日期:"&rs("t2")&" ")
Response.Write("<td>内容:"&rs("t3")&"<br/>")
rs.movenext()
next
end if
%>
<p align="center">
<%
if epage = rs.pagecount then
%>
<a href="?page=0&t1=<%=t1%>&y1=<%=year1%>&y2=<%=year2%>&t3=<%=t3%>">首页</a>
<a href="?page=<%=epage-1%>&t1=<%=t1%>&y1=<%=year1%>&y2=<%=year2%>&t3=<%=t3%>">上一页</a>
<%
else
%>
<a href="?page=0&t1=<%=t1%>&y1=<%=year1%>&y2=<%=year2%>&t3=<%=t3%>">首页</a>
<a href="?page=<%=epage-1%>&t1=<%=t1%>&y1=<%=year1%>&y2=<%=year2%>&t3=<%=t3%>">上一页</a>
<a href="?page=<%=epage+1%>&t1=<%=t1%>&y1=<%=year1%>&y2=<%=year2%>&t3=<%=t3%>">下一页</a>
<a href="?page=<%=rs.pagecount%>&t1=<%=t1%>&y1=<%=year1%>&y2=<%=year2%>&t3=<%=t3%>">尾页</a>
<%
end if
%>
</p>
<p align="center">现在是第<%=epage%>页一共有<%=rs.pagecount%>页</p>

<%
response.write "</body></html>"
rs.close
set rs=nothing
%>
展开
 我来答
云裳广场舞
2014-08-08 · 我爱广场舞,我运动、我快乐、我健康!
云裳广场舞
采纳数:834 获赞数:1065

向TA提问 私信TA
展开全部
会不会是因为搜的数据为空造成的,添加1、2条相关数据再试。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式