รบกวนวิเคราะห์ Error ที่เกิดขึ้นให้หน่อยค่ะ ต้องการแสดงข้อมูลเป็นหน้า หน้าละ 10 record
================================================
<table valign="top" width="90%" border="0" cellpadding="2" cellspacing="0">
<tr height="50"><td align="left" class="txtstrongheader"><img src="../images/arr_yellow.gif" border="0"> All Products</td></tr>
<%
'declare variables
Dim rsListe, SQLListe
Dim Currpage, pageLen, lastNumber, PageRem, PageTen
Dim connection, recordset, sSQL, sConnString, next10, prev10, P
Dim RSPrevPage, RSNextPage, start
'Get the current page the user is on, if it's the first time they
'visit and the variable 'PageNo' is empty, then 'CurrPage' gets set to 1
'Else the current page variable 'CurrPage' is set to the page number requested
If IsEmpty(Request.Querystring("PageNo")) then
CurrPage = 1
Else
CurrPage = Cint(Request.Querystring("PageNo"))
End If
'the two functions below return the next 10 and prev 10 page number
Function getNext10(num)
pageLen = len(num)
If pageLen = 1 Then
next10 = 10
Else If pageLen>1 Then
pageRem = 10
pageTen = right(num, 1)
next10 = num + pageRem - pageTen
End If
End If
getNext10 = next10
End Function
Function getPrev10(num)
pageLen = len(num)
If pageLen = 1 then
prev10 = 1
Else If pageLen>1 then
lastNumber = right(num, 1)
prev10 = num - lastNumber - 10
End If
End If
If prev10 = 0 then
prev10 = 1
End If
getPrev10 = prev10
End Function
Set rsListe = Server.CreateObject("ADODB.Recordset")
SQLListe = "SELECT * FROM Artikel"
rsListe.Open SQLListe, Conn
rsListe.CursorLocation = 3
rsListe.PageSize = 10
'get the next 10 and prev 10 page number
next10 = getNext10(CurrPage)
prev10 = getPrev10(CurrPage)
if rsListe.EOF or rsListe.BOF then
response.write "<tr><td align='center'><p align='center' class='strongBlue'><br><br>"&txt_nothinginhere&"</p></td></tr>"
Else
'this moves the record pointer to the first record of the current page
rsListe.AbsolutePage = CurrPage
%>
<tr><td><img src="../images/shim.gif" width="1" height="2"></td></tr>
<tr valign="top"><td align="center" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>
<%
Dim LinkCount
LinkCount = 0
dim iZah, result1
iZah = 1
'Do WHILE NOT rsListe.eof
Do Until rsListe.AbsolutePage <> CurrPage OR rsListe.eof
Dim showImageListe
showImageListe = rsListe("Image")
if showImageListe = "" then
showImageListe = "noPicture.gif"
end If
' Change the number for the columns to be shown
result1 = iZah mod 3
%>
<td valign="top" align="center"><table border="0" cellpadding="0" cellspacing="0" width="150" class="item"><tr bgcolor="#FFFFFF"><td align="center" height="25"><%=rsListe("Kategorie")%></td></tr><tr bgcolor="#FFFFFF"><td valign="middle" align="center"><table border="0" cellpadding="0" cellspacing="0" class="item2"><tr><td><a href="<%=rsListe("Beschreibung")%>" target="_top" onmouseover="window.status='http://cj.shop.com';return true;" onmouseout="window.status=' ';return true;" onclick="NewWindow(this.href,'mywin','800','600','yes','center');return false" onfocus="this.blur()"><img src="<%=showImageListe%>" border="0" width="140" height="140" alt="<%=rsListe("ArtName")%>" title="<%=rsListe("ArtName")%>"></a><img src="<%=rsListe("ArtNr")%>" border="0" width="1" height="1"></td></tr></table></td></tr><tr><td background="../images/bgh.jpg" valign="middle" align="center" height="25">· <%=rsListe("VE")%></td></tr></table><br></td>
<%
' Change the number for the columns to be shown as you have done above
if iZah=4 or result1=0 then
response.write "</td></tr><tr>"
end if
iZah = iZah + 1
%>
<%
rsListe.MoveNext
LOOP
%></tr></table>
<%
end If
'the next 2 lines setup the page number for the "previous" and "next" links
RSPrevPage = CurrPage -1
RSNextPage = CurrPage + 1
If Next10 > rsListe.PageCount Then
Next10 = rsListe.PageCount
End If
If prev10 = 1 AND next10 - 1 < 10 Then
start = 1
Else
start = Next10 - 10
If right(start, 1) > 0 Then
start = replace(start, right(start, 1), "0")
start = start + 10
End If
End If
'This checks to make sure that there is more than one page of results
If rsListe.PageCount > 1 Then
'Work out whether to show the Previous 10 '<<'
If currpage > 1 Then
response.write("<a href=""paging.asp?PageNo=" & Prev10 & """><<</a> ")
End If
'Work out whether to show the Previous link '<'
If NOT RSPrevPage = 0 then
response.write("<a href=""paging.asp?PageNo=" & RSPrevPage & """><</a> ")
End If
'Loop through the page number navigation using P as our loopcounter variable
For P = start to Next10
If NOT P = CurrPage then
response.write("<a href=""paging.asp?PageNo=" & P & """>" & P & "</a> ")
Else
'Don't hyperlink the current page number
response.write(" <b>" & P & " </b>")
End If
Next
'this does the same as the "previous" link, but for the "next" link
If NOT RSNextPage > rsListe.PageCount Then
response.write("<a href=""paging.asp?PageNo=" & RSNextPage & """>></a> ")
End If
'Work out whether to show the Next 10 '>>'
If NOT Next10 = rsListe.PageCount Then
response.write(" <a href=""paging.asp?PageNo=" & Next10 & """>>></a>")
End If
End If
rsListe.Close
set rsListe=Nothing
%></td></tr></table>
================================================
ADODB.Recordset error '800a0e79'
Operation is not allowed when the object is open.
/shop/list.asp, line 50 (is rsListe.CursorLocation = 3)
============than if 'rsListe.CursorLocation = 3=========
ADODB.Recordset error '800a0cb3'
Current Recordset does not support bookmarks. This may be a limitation of the provider or of the selected cursortype.
/shop/list.asp, line 60 (is rsListe.AbsolutePage = CurrPage)
========than if 'rsListe.AbsolutePage = CurrPage=======
จะแสดง page เปล่า