Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,028

HOME > ASP > ASP Forum > Code แสดงข้อมูลเป็นหน้า(PageNo.) มี Error ? รบกวนวิเคราะห์ Error ที่เกิดขึ้นให้หน่อยค่ะ



 

Code แสดงข้อมูลเป็นหน้า(PageNo.) มี Error ? รบกวนวิเคราะห์ Error ที่เกิดขึ้นให้หน่อยค่ะ

 



Topic : 016976

Guest




รบกวนวิเคราะห์ 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">&nbsp; 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">&middot; <%=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 เปล่า






Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 5 ธ.ค. 2550 06:03:36 By : fordot View : 2054 Reply : 1
 

 

No. 1

Guest


Go to : ASP Microsoft Access List Record Paging/Pagination






Date : 2011-08-01 20:43:03 By : thaicreate
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : Code แสดงข้อมูลเป็นหน้า(PageNo.) มี Error ? รบกวนวิเคราะห์ Error ที่เกิดขึ้นให้หน่อยค่ะ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 01
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่