<%@ Language=VBScript %>
<%
'判断用户是否登录
if isempty(Session("ID")) then
Response.Redirect "index.asp"
end if
'连接系统数据库
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("sd.mdb")
set rs= server.createobject("adodb.recordset")
dim i,intPage,page,pre,last定义变量
'初始化报表状态和警告状态
Warning=false
'判断当前页面状态是否是报表状态
if not IsEmpty(Request.Form("GoBack")) then
ReportLabel=False
end if
'报表的排序方式
if Request.Form("ReportOrder")="jnow" then'jnow是jipiao表里的字段名
TheOrder="按出票时间"
elseif Request.Form("ReportOrder")="num" then'num是jipiao表里的字段名
TheOrder="按机票号码"
elseif Request.Form("ReportOrder")="jdate" then'num是jipiao表里的字段名
TheOrder="按乘机日期"
elseif Request.Form("ReportOrder")="carrier" then'carrier是jipiao表里的字段名
TheOrder="按承运人"
end if
'报表是否有时间期限
if Request.Form("DateLimit")="Yes" then
StartDate=Request.Form("StartYear") & "-" & Request.Form("StartMonth") _
& "-" & Request.Form("StartDay")
EndDate= Request.Form("EndYear") & "-" & Request.Form("EndMonth") _
& "-" & Request.Form("EndDay")
TheTimeLimit="时间期限:从" & CStr(StartDate) & "到" & Cstr(EndDate) & " "
else
StartDate="1900-1-1"
EndDate="2100-1-1"
TheTimeLimit="时间期限:无 "
end if
'生成报表
if not IsEmpty(Request.Form("Send")) then'当点下生成报表时
'生成总流水帐报表
'生成正常流水帐报表
if Request.Form("reporttype") = "okjipiao" then'如果选择的是废票类型
sql="select * from jipiao where sta ='正常' and jcont='"&Session("Nameid")&"' and jnow >=#" & StartDate _
& "# and jnow<=#" & EndDate & "# order by " & Request.Form("ReportOrder")&" desc"
TheMessage = TheTimeLimit & "正常票流水帐报表按-" & TheOrder & "-排序如下"
ReportLabel=True
end if
'生成作废流水帐报表
if Request.Form("reporttype") = "voidjipiao" then'如果选择的是废票类型
sql="select * from jipiao where sta ='作废' and jcont='"&Session("Nameid")&"' and jnow >=#" & StartDate _
& "# and jnow<=#" & EndDate & "# order by " & Request.Form("ReportOrder")&" desc"
TheMessage = TheTimeLimit & "废票流水帐报表按-" & TheOrder & "-排序如下"
ReportLabel=True
end if
rs.PageSize = 2 '这里设定每页显示的记录数
rs.CursorLocation = 3
rs.open sql,conn,0,2,1
pre = true
last = true
page = trim(Request.QueryString("page"))'变量是跳转页面时的值
if len(page) = 0 then
intpage = 1
pre = false
else
if cint(page) =< 1 then
intpage = 1
pre = false
else
if cint(page) >= rs.PageCount then
intpage = rs.PageCount
last = false
else
intpage = cint(page)
end if
end if
end if
if not rs.eof then
rs.AbsolutePage = intpage
end if
else
TheMessage = "请选择您要生成的报表类型"
ReportLabel=False
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>代理人订票查询系统</title>
<link href="info.css" rel="stylesheet" type="text/css" />
</head>
<BODY BGCOLOR="">
<FORM ACTION="chaxun1.asp" METHOD=POST>
<% if Reportlabel=False then %>
<table width=800 border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2 align=center>
<tr bgcolor=white><td valign=center ><img src="image/ASPLogo3.jpg" width=800 height=123></td>
</tr></table>
<table width="800" border="0" bordercolor="#164DA8" align="center" cellpadding="0" cellspacing="0">
<tr><td height="13"><img src="image/banner2.jpg" width="800" height="12"></td></tr></table>
<tr bgcolor=white >
<table width=800 border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2 align=center >
<tr><td colspan=3>
<font color=white>
<P ALIGN=CENTER>查询报表 [当前用户-
<% response.write Session("Nameid") %> ]
</font></td></tr>
<tr bgcolor=white >
<td><a href=main1.asp><font color=#104DAD>返回主页</font></a></td>
<td align=center>
<% if Warning=false then %>
<font color="#104DAD" ><% response.write TheMessage %></FONT>
<% else %>
<font color=Red ><% response.write TheMessage %></font>
<% end if %>
</td>
<td align=right><a href=dapiao.asp><font color=#104DAD>返回上一级网页</font></a></td>
</tr></table>
<table width=800 border=0 bordercolor=#164DA8 align=center cellpadding=0 cellspacing=0>
<tr><td height=10 colspan=4 valign=top bgcolor=#FFFFFF>
<img src=image/banner2.jpg width=800 height=12>
</td></tr></table>
<table cellpadding=1 cellspacing=1 border=1 bordercolor=#164DA8 align=center width=800 >
<tr><td colspan=5 align=center bgcolor=#B5C7EF><font color=#164DA8>机票票状态</font></td>
</tr>
<tr><td><INPUT TYPE=radio CHECKED NAME=reporttype VALUE=thisalljipiao >正常 </td>
<td><INPUT TYPE=radio NAME=reporttype VALUE=voidjipiao>废票</td>
</tr>
</table><br>
<table cellpadding=1 cellspacing=1 border=1 bordercolor=#164DA8 align=center width=800 >
<tr><td colspan=4 align=center bgcolor=#B5C7EF><font color=#164DA8>排序方式</font></td>
</tr>
<tr><td><INPUT TYPE=radio CHECKED NAME=ReportOrder VALUE=jnow >按出票日期排序 </td>
<td><INPUT TYPE=radio NAME=ReportOrder VALUE=num >按票号排序 </td>
<td><INPUT TYPE=radio NAME=ReportOrder VALUE=date >按乘机日期排序 </td>
<td><INPUT TYPE=radio NAME=ReportOrder VALUE=carrier>按承运人排序</td>
</tr>
</table><br>
<table cellpadding=1 cellspacing=1 border=1 bordercolor=#164DA8 align=center width=800 >
<tr><td colspan=2 align=center bgcolor=#B5C7EF><font color=#164DA8>时间期限</font></td></tr>
<tr><td><INPUT TYPE=radio CHECKED NAME=DateLimit VALUE=No >无时间限制 </td><td> </td></tr>
<tr><td><INPUT TYPE=radio NAME=DateLimit VALUE=Yes>有时间期限</td>
<td>
<table border=1 width=100%>
<tr><td>开始时间</td>
<td>
<select name="StartYear" size=1>
<OPTION VALUE="<% Response.Write Year(Date) %>">  <% Response.Write Year(Date) %>  </OPTION>
<%
YearCounter = 2050
Do until YearCounter <=1990
%>
<OPTION VALUE="<% Response.Write YearCounter %>">  <% Response.Write YearCounter %>  </OPTION>
<%
YearCounter = YearCounter-1
loop
%>
</select>年
</td>
<td>
<select name="StartMonth" size=1>
<OPTION VALUE="<% Response.Write Month(Date) %>">  <% Response.Write Month(Date) %>  </OPTION>
<%
MonthCounter = 12
Do until MonthCounter <=0
%>
<OPTION VALUE="<% Response.Write MonthCounter %>">  <% Response.Write MonthCounter %>  </OPTION>
<%
MonthCounter = MonthCounter-1
loop
%>
</select>
月</td>
<td>
<select name="StartDay" size=1>
<OPTION VALUE="<% Response.Write Day(Date) %>">  <% Response.Write Day(Date) %>  </OPTION>
<%
DayCounter = 31
Do until DayCounter <=0
%>
<OPTION VALUE="<% Response.Write DayCounter %>">  <% Response.Write DayCounter %>  </OPTION>
<%
DayCounter = DayCounter-1
loop
%>
</select>日</td></tr>
<tr><td>截至时间</td><td>
<select name="EndYear" size=1>
<OPTION VALUE="<% Response.Write Year(Date) %>">  <% Response.Write Year(Date) %>  </OPTION>
<%
YearCounter = 2050
Do until YearCounter <=1990
%>
<OPTION VALUE="<% Response.Write YearCounter %>">  <% Response.Write YearCounter %>  </OPTION>
<%
YearCounter = YearCounter-1
loop
%>
</select>年</td><td>
<select name="EndMonth" size=1>
<OPTION VALUE="<% Response.Write Month(Date) %>">  <% Response.Write Month(Date) %>  </OPTION>
<%
MonthCounter = 12
Do until MonthCounter <=0
%>
<OPTION VALUE="<% Response.Write MonthCounter %>">  <% Response.Write MonthCounter %>  </OPTION>
<%
MonthCounter = MonthCounter-1
loop
%>
</select>月</td><td>
<select name="EndDay" size=1>
<OPTION VALUE="<% Response.Write Day(Date) %>">  <% Response.Write Day(Date) %>  </OPTION>
<%
DayCounter = 31
Do until DayCounter <=0
%>
<OPTION VALUE="<% Response.Write DayCounter %>">  <% Response.Write DayCounter %>  </OPTION>
<%
DayCounter = DayCounter-1
loop
%>
</select>日</td></tr>
</table></table>
<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=1 WIDTH=800 align=center>
<TR VALIGN=top ALIGN=center><TD align=center >
<INPUT TYPE=submit NAME=Send VALUE=生成财务报表 style="border: 1px solid #3466BB; background-color: #B6CAEB; color: #3466BB">
</td></table>
<%
end if
%>
<br>
<% if ReportLabel=true then %>'当查询结果出现时
<table width=800 border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2 align=center>
<tr><td><font color=white><P ALIGN=CENTER><% response.write TheMessage %>
</font></td></tr>
<tr bgcolor=white ><td align=center>
<table width=800 bgcolor=#164DA8 border=0 cellspacing=1 cellpadding=2 align=center>
<td width="116"><font color=white>出票日期</font></td>
<td width="160"><font color=white>票号</font></td>
<td width="92"><font color=white>乘机日期</font></td>
<td width="55"><font color=white>出发地</font></td>
<td width="55"><font color=white>到达地</font></td>
<td width="55"><font color=white>承运人</font></td>
<td width="45"><font color=white>折扣</font></td>
<td width="72"><font color=white>机票价格</font></td>
<td width="72"><font color=white>机票总价</font></td>
<td width="60"><font color=white>代理费</font></td>
<td width="39"><font color=white>状态</font></td>
</tr>
'开始循环显示查询结果
<%
for i=1 to rs.PageSize
if rs.EOF or rs.BOF then exit for
%>
<tr bgcolor=white >
<TD ><font face=arial>
<% Response.write RS("jnow") %>
</font></TD>
<TD ><font face=arial><% Response.write RS("num") %></font></TD>
<TD ><font face=arial><% Response.write RS("jdate") %></font></TD>
<TD ><font face=arial><% Response.write RS("jfrom") %></font></TD>
<TD ><font face=arial><% Response.write RS("jto") %></font></TD>
<TD ><font face=arial><% Response.write RS("carrier") %></font></TD>
<TD ><font face=arial><% Response.write RS("class") %></font></TD>
<TD align="right" ><font face=arial><% Response.write RS("cny") %></font></TD>
<TD align="right" ><font face=arial><% Response.write RS("tot") %></font></TD>
<TD align="right" ><font face=arial><% Response.write RS("supply") %></font></TD>
<TD HEIGHT=21><font face=arial><% Response.write RS("sta") %></font></TD>
</tr>
<%
sumcny=sumcny+rs("cny")
sumtot=sumtot+rs("tot")
sumsupply=sumsupply+rs("supply")
rs.movenext
next
%>
<tr bgcolor=white >
<TD ><font face=arial>合计</font></TD>
<TD > </TD>
<TD > </TD>
<TD > </TD>
<TD > </TD>
<TD > </TD>
<TD > </TD>
<TD align="right" ><font face=arial><% Response.write Sumcny %></font></TD>
<TD align="right" ><font face=arial><% Response.write Sumtot %></font></TD>
<TD align="right" ><font face=arial>
<% Response.write Sumsupply %></font></TD>
<TD HEIGHT=21> </TD>
</tr></table>
<table WIDTH=800 border=0 align=center cellpadding=2 cellspacing=1 bordercolor="#164DA8" bgcolor=#FFFFFF>
<tr bordercolor="#164DA8">
'分页部分开始
<%if rs.pagecount > 0 then%>
<td align="left">共[<font color="#FF0000"><%=rs.RecordCount%></font>]条留言|每页显示 <font color="#FF0000"><%=rs.pagesize%></font>条记录|当前页<%=intpage%>/<%=rs.PageCount%></td>
<%else%>
<td align="left">当前页0/0</td>
<%end if%>
<td width="46%" align="right"> <a href="chaxun1.asp?page=1">首页</a>|
<%if pre then%>
<a href="chaxun1.asp?page=<%=intpage -1%>">上页</a>| <%end if%>
<%if last then%>
<a href="chaxun1.asp?page=<%=intpage +1%>">下页</a> |<%end if%>
<a href="chaxun1.asp?page=<%=rs.PageCount%>">尾页</a>|转到第
<select name="sel_page" onchange="javascript:location=this.options[this.selectedIndex].value;">
<%
for i = 1 to rs.PageCount
if i = intpage then%>
<option value="chaxun1.asp?page=<%=i%>" selected><%=i%></option>
<%else%>
<option value="chaxun1.asp?page=<%=i%>"><%=i%></option>
<%
end if
next
%>
</select>页</font>
</td>
</tr>
</table>
<table width=800 border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2 align=center><tr>
<td><p align=center>
<input type=submit name=GoBack value=  重新查询报表   style="border: 1px solid #3466BB; background-color: #FFFFFF; color: #3466BB">
</p></td></tr></table>
<%
end if
%>
</table>
</table>
</form>
<body>
</body>
</html>
页面能正常显示,根据需要能查询出需要的结果。问题是当点击分页部分的代码,如:下页,上页,首页,尾页时,出现的页面不是下一页结果,而是开始出现的查询条件。有人说是查询条件没有传递下去,但这个怎么传递呢?希望能得到大家的帮助