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
%> 展开
错误信息如下:
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
%> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询