0

私は Classis ASP を使用して (自分の個人サーバーで) しばらくの間サイトに取り組んできましたが、つまずきにぶつかりました。ページングを機能させようとしていますが、何らかの理由でページに何も表示されず、まったく理解できません。基本的に、このサイトは広告掲示板で、1 ページに各アイテム タイプの合計が表示されます。それをクリックすると、それらのアイテムが表示されますが、ページが表示されます。

<%
    If (Request.QueryString("type") <> "" ) Then
        Set rs = Server.CreateObject("ADODB.Recordset")
        rs.Open "select s.Unique_ID, s.Location,s.Extension,s.Item,s.Description,s.Price,s.Date_On_Sale,s.Type, s.Name, s.Date_Posted " & _
        " from tblSales s where Lower(s.Type) = Lower('" & Request.QueryString("type") &  "')" , objconn, 3, 3

        If (rs.BOF or rs.EOF) Then StrMsg = "<font color='red'> <b> System found no results for <u> " & Request.QueryString("type") & " </u>  </b></font>"
    End If
%>

<%response.Write(strQuery) %>  
<div id="midrow" style="clear:both;"> 
    <div class="center">     
         <p>To view the details of an item, simply click on desired item</p>
    </div>
</div>

<div class="board_bottomrow">
    <div class="center">



<% If StrMsg <> "" Then
Response.Write(StrMsg)
Else
      Dim bShowPages 
      rs.PageSize = 20
      nPageCount = rs.PageCount
      If nPageCount <2 Then 
      bShowPages = false 
      Else bShowPages = true 
      End If

      nPage = CLng(Request.QueryString("Page"))
      If (Request.QueryString("Page") = "") Then nPage = 1
      If nPage < 1 Or nPage > nPageCount Then
  nPage = 1
      End If

      item_type = Request.QueryString("type")

      rs.AbsolutePage = nPage

      %>

<div> <b>  <%= Request.QueryString("type") %> Items </b>  </div>
<br>

<table class="table_border" cellpadding="5" cellspacing="5" border="0" style="width:950px" id="items" >

<thead>
<th style="text-align:left"> <b> <font size="2"> Item  </font> </b> </th>
<th style="text-align:left"> <b> <font size="2">  Description </font> </b> </th>
<th style="text-align:left;"> <b> <font size="2"> Price </font> </b> </th>
<th style="text-align:left;"> <b> <font size="2"> Posted By  </font> </b> </th>
<th style="text-align:left;"> <b> <font size="2"> Extension </font> </b> </th>
<th style="text-align:left;"> <b> <font size="2"> Posted On  </font> </b> </th>
</thead>


<tbody>


<% 
  Response.Write(rs.AbsolutePage)
    While Not (rs.Eof Or rs.AbsolutePage <> nPage) %>
   <tr style="vertical-align:top">
<td> <a href='Board_Item.asp?link_id=<%=rs("Unique_ID")%>'> <%= rs("Item") %> </a> </td>
<td style="width:350px"> <%= rs("Description") %>  </td>
<td style="margin-left:10px"> £ <%= rs("Price") %> </td>
<td> <%= rs("Name") %> </td>
<td> <%= rs("Extension") %> </td>
<td> <%= rs("Date_Posted") %> </td>

  </tr>
 <%
rs.MoveNext()
  Wend  

 'Response.Write ("bShowPages " & bShowPages)
 %>


<!-- show pages only if pageCount > 1 -->
<%If bShowPages <> false Then%>
<tr style="background-color:#f1f1f1">
<td> Pages:  </td> <td colspan="5"> 
 <a href='Items.asp?type=<%=item_type%>&Page=1'> First </a>  
<a href='Items.asp?type=<%=item_type%>&Page=<%=nPage - 1%>'> Prev </a>  
<a href='Items.asp?type=<%=item_type%>&Page=<%=nPage + 1%>'> Next </a> 
 <a href='Items.asp?type=<%=item_type%>&Page=<%=nPageCount%>'> Last </a> 
 <td> </td>
  </tr>

  </tbody>
 </table>
 <%End If%>

<% End If %>


</div>

<br>

サンプルに不適切なコーディングが含まれていることは十分承知していますが、これは現時点で個人的な学習プロジェクトです。ページ番号はすべて表示されますが、レコードは表示されません。ありがとう。

4

0 に答える 0