<!--#INCLUDE FILE="../function/db.asp" -->
<!--#INCLUDE FILE="../function/control.asp" -->

<%
  dim master_rs
  dim staff_id
  dim sql
  
  dbf_connection()
  staff_id = cf_check_login_staff_id
  
  if Request.QueryString("hd_has_search") = "1" then 
  staff_id = "Has Search"
  end if
    
  Set conn = Server.CreateObject("ADODB.Connection")
  conn.Properties("Connect Timeout") = 300 
  conn.Open gots
    
  Set master_rs = Server.CreateObject("ADODB.Recordset")
  sql = "select * from network_frozen_master order by create_date desc"
  master_rs.Open sql, conn, 1
  
 %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
  body{ width:960px;}
  table tr{ background-color:#FFFFFF; text-align:center;}
</style>
<script type="text/javascript">

</script>
</head>
<body>
    <form action="network_frozen_index.asp">
    <table width="100%">
    <tr><td><h2>Network Frozen</h2></td></tr>
    <tr><td><hr style="width:85%; text-align:left;" /></td></tr>
    </table>
        <fieldset>
        <legend>List All Case</legend>
           <table style="width:80%"><tr><td>
            <input type="button" value="Add New" style="float:right; width:120px;" onclick="javascript:window.location.href='./network_frozen_detail.asp?type=new'" /></td></tr><tr><td>
            <table style="width:100%;margin-left:5px;background-color:#2C6193;" border="0" cellspacing="1" cellpadding="0">
            <tr style=" background-color:#D0D0D0; height:25px;"><th>Case No.</th><th>Create Staff</th><th>Create Date</th><th>Action</th></tr>
            
            <%
            dim page
            dim b_color
            page = 1
            master_rs.PageSize = 10
            
            if not IsEmpty(Request("Page")) then 
              page = CInt(Request("Page"))
              if page > master_rs.PageCount then  
                master_rs.AbsolutePage = master_rs.PageCount  
              elseif page <= 0 then  
                page = 1  
              else  
                master_rs.AbsolutePage = page   
              end if  
            end if
            
            if master_rs.bof and master_rs.eof then
               %>
               <tr><td colspan="4">No Data!</td></tr> 
               <%
            end if
            
            for i=1 to master_rs.PageSize
            
              if i mod 2 = 0 then 
                b_color = "style='background-color:#D0D0D0'"
              else
                b_color = ""
              end if
              
              if master_rs.eof then    
                exit for              
              end if
            
            %>
             <tr <%=b_color %> >
             <td><%=master_rs.Fields("nf_master_id") %></td>
             <td><%=master_rs.Fields("create_by") %></td>
             <td><%=master_rs.Fields("create_date") %></td>
             <td><a href='network_frozen_detail.asp?type=view&id=<%=master_rs.Fields("nf_master_id") %>'>View</a></td>
             </tr>
          
          <%
            master_rs.MoveNext  
           next 
           %>
          
            </table>            
           </td></tr>
           <tr><td>            
                <p align="center">  
                <%if request("Page")>1 then%>  
                <a href="network_frozen_index.asp?Page=<% = 1%>">首页</a>   
                <a href="network_frozen_index.asp?Page=<% =page -1 %>">上一页</a>  
                <%end if %>  
                  
                <%  
                if page > master_rs.pagecount then page = master_rs.pagecount  
                %>  
                <%if page<>master_rs.pagecount  then %>  
                <a href="network_frozen_index.asp?Page=<% = page + 1%>">下一页</a>   
                <a href="network_frozen_index.asp?Page=<% = master_rs.PageCount%>">尾页</a>   
                <% end if %>  
                <br />
                <label>Current Page:<%=page %></label>
                <label>Total Page:<%=master_rs.PageCount %></label>
                </td></tr>
           </table>
        </fieldset>
       <input type="hidden" name="hd_staff_id" value="<%=staff_id %>" />
       <input type="hidden" name="hd_has_search" value="1" />
    </form>
</body>
</html>

 工作中利用ASP的RecordSet实现分页效果