asp查询分页出错:点击下一页时:对象关闭时,不允许操作
setrs=Server.CreateObject("ADODB.RecordSet")'course_type=request.Form("course_type")'...
set rs=Server.CreateObject("ADODB.RecordSet")
'course_type=request.Form("course_type")
'On Error Resume Next
condition=request.Form("condition")
keyword=trim(request.Form("keyword"))
if condition="课件全部" then
rs.open "select * from CourseWare where CourseWare_Title like '%" &keyword& "%' or CourseWare_Grade like '%" &keyword& "%' or CourseWare_Desc like '%" &keyword& "%' and isdel=0",objConn,3,2
end if
if condition="课件标题" then
rs.open "select * from CourseWare where CourseWare_Title like '%" &keyword& "%' and isdel=0",objConn,3,2
end if
if condition="课件年级" then
rs.open "select * from CourseWare where CourseWare_Grade like '%" &keyword& "%' and isdel=0",objConn,3,2
end if
if condition="课件描述" then
rs.open "select * from CourseWare where CourseWare_Desc like '%" &keyword& "%' and isdel=0",objConn,3,2
end if
if rs.recordcount=0 then
Response.write "<script language=javascript>alert('没有找到有关的任何信息,请重新输入!');history.back();</script>"
else
rs.pagesize=3
if not isempty(request("page")) then
currentpage=cint(request("page")) '当前页
else
currentpage=1
end if
rs.absolutepage=currentpage
thispage=request.ServerVariables("SCRIPT_NAME")
%>
<div align="center">本版共<b><%=rs.recordcount%></b>条内容, 页次:<b><font color="red"><%=currentpage%></font>/<%=rs.pagecount%></b>
<% if pagecount<>1 then %>
<%if currentpage=1 then%>
<font color=darkgray>首页 上一页
<%else%>
<a href="<%=thispage%>?page=1">首页</a> <a href="<%=thispage%>?page=<%= currentpage-1 %>">上一页</a>
<% end if %>
<% end if %>
<% if pagecount<>rs.pagecount then %>
<%if currentpage=rs.pagecount then%>
<font color=darkgray >下一页 尾页</font>
<%else%>
<a href="<%=thispage%>?page=<%= currentpage+1 %>">下一页</a> <a href="<%=thispage%>?page=<%= rs.pagecount %>">尾页</a>
<% end if %>
<% end if %>
</font></div>
不行哈,我早试过了 展开
'course_type=request.Form("course_type")
'On Error Resume Next
condition=request.Form("condition")
keyword=trim(request.Form("keyword"))
if condition="课件全部" then
rs.open "select * from CourseWare where CourseWare_Title like '%" &keyword& "%' or CourseWare_Grade like '%" &keyword& "%' or CourseWare_Desc like '%" &keyword& "%' and isdel=0",objConn,3,2
end if
if condition="课件标题" then
rs.open "select * from CourseWare where CourseWare_Title like '%" &keyword& "%' and isdel=0",objConn,3,2
end if
if condition="课件年级" then
rs.open "select * from CourseWare where CourseWare_Grade like '%" &keyword& "%' and isdel=0",objConn,3,2
end if
if condition="课件描述" then
rs.open "select * from CourseWare where CourseWare_Desc like '%" &keyword& "%' and isdel=0",objConn,3,2
end if
if rs.recordcount=0 then
Response.write "<script language=javascript>alert('没有找到有关的任何信息,请重新输入!');history.back();</script>"
else
rs.pagesize=3
if not isempty(request("page")) then
currentpage=cint(request("page")) '当前页
else
currentpage=1
end if
rs.absolutepage=currentpage
thispage=request.ServerVariables("SCRIPT_NAME")
%>
<div align="center">本版共<b><%=rs.recordcount%></b>条内容, 页次:<b><font color="red"><%=currentpage%></font>/<%=rs.pagecount%></b>
<% if pagecount<>1 then %>
<%if currentpage=1 then%>
<font color=darkgray>首页 上一页
<%else%>
<a href="<%=thispage%>?page=1">首页</a> <a href="<%=thispage%>?page=<%= currentpage-1 %>">上一页</a>
<% end if %>
<% end if %>
<% if pagecount<>rs.pagecount then %>
<%if currentpage=rs.pagecount then%>
<font color=darkgray >下一页 尾页</font>
<%else%>
<a href="<%=thispage%>?page=<%= currentpage+1 %>">下一页</a> <a href="<%=thispage%>?page=<%= rs.pagecount %>">尾页</a>
<% end if %>
<% end if %>
</font></div>
不行哈,我早试过了 展开
展开全部
if selectt="1" then
rs.open "select * from Test where username like '%"&key&"%'",conn,1,1
elseif selectt="2" then
rs.open "select * from Test where address like '%"&key&"%'",conn,1,1
end if
这样写也可以,没错
<%dim key,selectt
key=trim(request("keyword"))
selectt=trim(request("select"))
'开始分页程序
if key="" or key="请输入搜索关键字" then '检查是否有输入关键字 '***********第一个if***********
response.write "<SCRIPT language=JavaScript>alert('请输入搜索关键字!');"
response.write "this.location.href='javascript:history.back()';</SCRIPT>"
response.end
else '有关键字就判断是进行用户名还是地址的查询
set rs=Server.CreateObject("adodb.recordset")'你漏了这一句
if selectt="1" then
rs.open "select * from Test where username like '%"&key&"%'",conn,1,1
elseif selectt="2" then
rs.open "select * from Test where address like '%"&key&"%'",conn,1,1
end if
if rs.bof and rs.eof then '把or改成and/判断能否查找到相关数据。 '******第二个if*****
response.write "<SCRIPT language=JavaScript>alert('对不起,没有找到符合条件的内容!');"
response.write "this.location.href='javascript:history.back()';</SCRIPT>"
response.end
..............
主要问题是你没有创建recordset对象
补充:这么多人都解决不了你的问题,用下面的方法再试试
在代码开始加 On Error Resume Next 试试
如:
<%
On Error Resume Next
dim key,selectt
key=trim(request("keyword"))
selectt=trim(request("select"))
'开始分页程序
......
rs.open "select * from Test where username like '%"&key&"%'",conn,1,1
elseif selectt="2" then
rs.open "select * from Test where address like '%"&key&"%'",conn,1,1
end if
这样写也可以,没错
<%dim key,selectt
key=trim(request("keyword"))
selectt=trim(request("select"))
'开始分页程序
if key="" or key="请输入搜索关键字" then '检查是否有输入关键字 '***********第一个if***********
response.write "<SCRIPT language=JavaScript>alert('请输入搜索关键字!');"
response.write "this.location.href='javascript:history.back()';</SCRIPT>"
response.end
else '有关键字就判断是进行用户名还是地址的查询
set rs=Server.CreateObject("adodb.recordset")'你漏了这一句
if selectt="1" then
rs.open "select * from Test where username like '%"&key&"%'",conn,1,1
elseif selectt="2" then
rs.open "select * from Test where address like '%"&key&"%'",conn,1,1
end if
if rs.bof and rs.eof then '把or改成and/判断能否查找到相关数据。 '******第二个if*****
response.write "<SCRIPT language=JavaScript>alert('对不起,没有找到符合条件的内容!');"
response.write "this.location.href='javascript:history.back()';</SCRIPT>"
response.end
..............
主要问题是你没有创建recordset对象
补充:这么多人都解决不了你的问题,用下面的方法再试试
在代码开始加 On Error Resume Next 试试
如:
<%
On Error Resume Next
dim key,selectt
key=trim(request("keyword"))
selectt=trim(request("select"))
'开始分页程序
......
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
TableDI
2024-07-18 广告
2024-07-18 广告
要将两个表格中的数据进行匹配,首先确定两个表格中都存在的共同字段,如ID、姓名或特定标识符。接着,使用数据处理工具(如Excel、SQL或Python的pandas库)来执行匹配操作。在Excel中,可以通过VLOOKUP函数或数据透视表来...
点击进入详情页
本回答由TableDI提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询