请问各位怎么解决呢,谢谢!sql语句应该是没问题的,分页的第一页也正确的,也就是说表单正确传递了,但就是点击下一页时程序无法得到表单数据了!
[此贴子已经被作者于2005-10-10 10:47:52编辑过]
这个是datequery_year.asp <!--#include file="conn.asp"--> <% whatyear=request.form("年") whatmonth=request.form("月") whatday=request.form("日") %>
<font color="#0000FF" size="5">
<b><i>模糊查询的结果</i></b></font>: <table cellSpacing=0 borderColorDark=#ffffff cellPadding=4 width='100%' borderColorLight=#aaaaaa border=1">
<% Set rs = Server.CreateObject ("ADODB.Recordset") sql="Select * from gzhz where 年="&request.form("年")&"" rs.Open sql,conn,1,2 %>
<% dim gzcount gzcount=rs.RecordCount %> <tr bgcolor=#006c6c> <td colspan=<%=rs.Fields.Count+1 %>.><%Response.Write "<b><font color=white>共"&gzcount&"条纪录 当前时间"&CStr(now)&"</font></b>"%></td> </tr> <tr bgcolor="#ffffaf">
<!--#include file="table.inc"--> <form method="POST" action="datequery_year.asp" name="FrontPage_Form1" onsubmit="return FrontPage_Form1_Validator(this)"> <p align="right"><font size="2" face="宋体"> <a href="datequery_year.asp?iPage=0&OldPageNo=<%=PageNo%>">第一页</a> <a href="datequery_year.asp?iPage=1&OldPageNo=<%=PageNo%>">上一页</a> <a href="datequery_year.asp?iPage=2&OldPageNo=<%=PageNo%>">下一页</a> <a href="datequery_year.asp?iPage=3&OldPageNo=<%=PageNo%>">最后一页</a> 第 <input type="text" name="PageIn" size="4" value=<%=PageNo%>>页,页数:</font><font size="2"><%=PageNo%>/<%=rs.PageCount%></font></p> <input type="hidden" name="OldPageNo" value="<%=PageNo%>"> </form>
<% rs.close Set rs = Nothing conn.close set conn=Nothing %>
这个是table.inc <% for i=0 to rs.Fields.Count-24 Response.Write "<td align=center nowrap><font size=2>ID号</font></td>" Next FOR i=1 to rs.Fields.Count-23 Response.Write "<td align=center nowrap><font size=2>开始日期</font></td>" Next FOR i=2 to rs.Fields.Count-22 Response.Write "<td align=center nowrap><font size=2>结束日期</font></td>" Next FOR i=3 to rs.Fields.Count-21 Response.Write "<td align=center nowrap><font size=2>发生时间段</font></td>" Next FOR i=11 to rs.Fields.Count-13 Response.Write "<td align=center nowrap><font size=2>"&Ucase(rs(i).Name)&"(分钟)</font></td>" Next FOR i=12 to rs.Fields.Count-1 Response.Write "<td align=center nowrap><font size=2>"&Ucase(rs(i).Name)&"</font></td>" Next %> </tr>
<%
'页号处理 '每页记录条数为20 rs.PageSize=20:iPage=Request("iPage"):PageIn=Request("PageIn"):OldPageNo=Request("OldPageNo") If iPage="" and PageIn="" Then PageNo=1 Else If PageIn="" Then Select Case iPage Case "0" PageNo=1 Case "1" PageNo=OldPageNo-1 Case "2" PageNo=OldPageNo+1 Case Else PageNo=rs.PageCount End Select Else If len(PageIn)>5 Then response.write "输入的页码范围超出有效范围!" PageNo=1 Else if Clng(pagein)>32767 then response.write "输入的页码范围超出有效范围!" pageno=1 else PageNo=CInt(PageIn) end if End If End If End If If PageNo<1 Then:PageNo=1:End If If PageNo>rs.PageCount Then:PageNo=rs.PageCount:End If %>
<% '输出内容 rs.MoveFirst rs.AbsolutePage=PageNo '分页处理 For c=1 to rs.PageSize if Not(rs.EOF) then If ((c+5) Mod 5)=0 Then Response.Write "<tr bgcolor=#e4e0ca>" Else Response.Write "<tr>" End if Response.Write "<td><p align=center><font size=2 nowrap>"& (pageno-1)*rs.pagesize+c &"</font></td>"
for i=0 to rs.Fields.Count-25 Response.Write "<td align=center nowrap><font size=2>"&Ucase(rs(i).Value)&"</font></td>" Next FOR i=1 to rs.Fields.Count-23 Response.Write "<td align=center nowrap><font size=2>"&Ucase(rs(1).Value&"-"&rs(2).Value&"-"&rs(3).Value)&"</font></td>" Next FOR i=2 to rs.Fields.Count-22 Response.Write "<td align=center nowrap><font size=2>"&Ucase(rs(4).Value&"-"&rs(5).Value&"-"&rs(6).Value)&"</font></td>" Next FOR i=3 to rs.Fields.Count-21 Response.Write "<td align=center nowrap><font size=2>"&Ucase(rs(7).Value&":"&rs(8).Value&"-"&rs(9).Value&":"&rs(10).Value)&"</font></td>" Next FOR i=11 to rs.Fields.Count-1 Response.Write "<td align=center nowrap><font size=2>"&rs(i).Value&"</font></td>" Next
rs.MoveNext Response.Write "</tr>" end if next Response.Write "</tr>" Response.Write"</table>"
%>
<script Language="JavaScript"> <!-- function FrontPage_Form1_Validator(theForm) { var checkOK = "0123456789-"; var checkStr = theForm.PageIn.value; var allValid = true; var decPoints = 0; var allNum = ""; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } allNum += ch; } if (!allValid) { alert("在 PageIn 域中,只能输入 数字 个字符。"); theForm.PageIn.focus(); return (false); } return (true); } //--> </script>
[此贴子已经被作者于2005-10-10 10:19:41编辑过]