有关数据查询后分页显示数据的问题

di78da 2003-01-03 10:22:17
小弟在这里先谢了!问题,我做了个查询页面当我输入条件后,进入显示页面(由*.ASP引导)后第一页可以显示符合要求的记录,但当我点击下一页后,显示的记录就不在是我所要查询的记录了!问题在那里?原码如下:<% const maxperpage=3
dim SQLstr,rs,totalput,currentpage,totalpages,i,j%>

<%SQLstr=""
StationName=Request.Form("StationName")
DeviceName=Request.Form("DeviceName")
set rs = server.CreateObject ("ADODB.Recordset")
if StationName <>"" or DeviceName <>"" then
SQLstr= " SELECT * from DeviceBug where StationName Like '%"&Request("StationName")&"%'and DeviceName Like '%"&Request("DeviceName")&"%'"
else SQLstr= " SELECT * from DeviceBug "
end if
set rs = server.CreateObject ("ADODB.Recordset")
rs.Open SQLstr,conn,1,1
rs.MoveFirst
%>
<%
rs.PageSize=maxperpage
howmanyfields=rs.Fields.count-1
if trim(request("page"))<>""then
currentpage=clng(request("page"))
if currentpage>rs.PageCount then
currentpage=rs.PageCount
end if
else
currentpage=1
end if
if rs.EOF then
Response.Write"<p align='center'>error!</p>"
else
totalput=rs.RecordCount
if currentpage<>1 then
if (currentpage-1)*maxperpage<totalput then
rs.Move(currentpage-1)*maxperpage
dim bookmark
bookmark=rs.Bookmark
end if
end if
end if
dim n,k
if(totalput mod maxperpage)=0 then
n=totalput\maxperpage
else
n=totalput\maxperpage+1
end if
%>
page<%=currentpage%>
of<%=n%>
共<font color=Black><%=rs.RecordCount%></font>条记录

<% k=currentpage

if page <>1 then
Response.Write "<a href=userud.asp?page="&page&">首頁</a>" & vbCrlf
end if
tmppage = currentpage - 1
if tmppage <= 0 then
tmppage = 1
else
Response.Write"<a href=userud.asp?page="&tmppage&">上一頁</a>"& vbCrlf
end if
tmppage = currentpage + 1
if tmppage > Rs.PageCount then
tmppage = currentpage
else
Response.Write "<a href=userud.asp?page="&tmppage&">下一頁</a>"&vbCrlf
end if

Response.Write"[<b>"+"<a href='userud.asp?page="+cstr(n)+"'>尾页</a></b>]"



%>


<TD width=150 align=middle><font face=宋体 size=2 color=aliceblue>变电站名称</font></TD>
<td width=150 align=middle><font face=宋体 size=2 color=aliceblue>设备名称</font></td>
<td width=100 align=middle><font face=宋体 size=2 color=aliceblue>设备编号</font></td>
<td width=100 align=middle><font face=宋体 size=2 color=aliceblue>设备类型</font></td>
<td width=100 align=middle><font face=宋体 size=2 color=aliceblue>发现时间</font></td>
<td width=60 align=middle><font face=宋体 size=2 color=aliceblue>发现人</font></td>
<td width=100 align=middle><font face=宋体 size=2 color=aliceblue>上报时间</font></td>
<td width=100 align=middle><font face=宋体 size=2 color=aliceblue>消除时间</font></td>
<td width=60 align=middle><font face=宋体 size=2 color=aliceblue>消除人</font></td>
<td width=60 align=middle><font face=宋体 size=2 color=aliceblue>验收人</font></td>
<td width=100 align=middle><font face=宋体 size=2 color=aliceblue>验收时间</font></td><tr>
<tr>
<%i=1
while not rs.EOF and i<=maxperpage
%>
<TR align=middle bgcolor=lightsteelblue>
<td width=80 align=middle ><font face=宋体 size=2>
<a href="userud_1.asp?stationName=<%=rs.Fields("stationName")%>">
<%=rs.Fields("stationName")%></a>
<td width=80 align=middle ><font face=宋体 size=2>
<%=rs("Devicename")%></font></td>
<td width=100 align=middle ><font face=宋体 size=2>
<%=rs("DeviceNum")%></font></td>
<td width=100 align=middle ><font face=宋体 size=2>
<%=rs("Devicetype")%></font></td>
<td width=100 align=middle ><font face=宋体 size=2>
<%=rs("FindTime")%></font></td>
<td width=100 align=middle ><font face=宋体 size=2>
<%=rs("Findperson")%></font></td>
<td width=100 align=middle ><font face=宋体 size=2>
<%=rs("ReportTime")%></font></td>
<td width=100 align=middle ><font face=宋体 size=2>
<%=rs("ResolveTime")%></font></td>
<td width=100 align=middle ><font face=宋体 size=2>
<%=rs("Resolveperson")%></font></td>
<td width=100 align=middle ><font face=宋体 size=2>
<%=rs("Checkperson")%></font></td>
<td width=100 align=middle ><font face=宋体 size=2>
<%=rs("CheckTime")%></font></td>
<tr>
<%i=i+1
rs.MoveNext
wend
%>
...全文
74 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
内容概要:本文详细介绍了利用Simulink进行变压器开路试验的电路连接配置与仿真实现方法,重点在于通过仿真手段还原实际电力系统中变压器在空载条件下的电气特性,从而深入理解其工作原理与性能表现。文章作为电力系统仿真系列研究的一部分,系统阐述了从电路模型搭建、参数设定、仿真运行到结果分析的完整流程,突出展示了MATLAB/Simulink在电力设备建模与教学科研中的强大功能与应用价值。; 适合人群:具备电力系统基础知识,熟悉MATLAB/Simulink仿真环境,从事电气工程、自动化及相关领域的研发人员,以及高年级本科生和研究生。; 使用场景及目标:①掌握变压器开路试验的基本原理与Simulink仿真建模的具体步骤;②通过仿真实验深入理解空载电流、铁芯损耗及励磁特性等关键参数的物理意义;③为后续开展变压器短路试验、暂态过程分析以及其他电力设备的仿真研究奠定理论与实践基础。; 阅读建议:建议结合Simulink软件动手实践,逐步构建并调试电路模型,重点关注各元件参数的设置方法与测量模块的应用技巧,同时推荐参考文中提及的其他相关仿真案例进行拓展学习,以全面提升对电力系统仿真实践的整体认知与操作能力。

28,403

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧