<% pageLen = 25 pageNo = request.QueryString("pageNo") if pageNo ="" then pageNo =1 Dim Conn Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "DSN=samunpai" Sql="Select * from question order by qNo desc" Set RS = Server.CreateObject("ADODB.Recordset") RS.Open Sql,Conn,1,3 Nrecord =RS.Recordcount RS.pageSize = pageLen totalPage = RS.PageCount if not RS.EOF then RS.absolutePage = pageNo %> <% recNo = 1 Do While Not RS.EOF and recNo <= pageLen %> <% RS.MoveNext recNo=recNo+1 Loop RS.Close Conn.Close %>
<%= "เรื่อง" & right("0000" & RS("qNo"),5) %>   "> <%=RS("Topic")%> - <%=RS("Name")%> - <%=day(RS("Date"))%>/<%=month(RS("Date"))%>/ <%=right(year(RS("Date")),2)%>(<%=RS("answer")%>)

จำนวน: <%=Nrecord%>ข้อความ,ขณะนี้อยู่หน้า <%=pageNo%>ในทั้งหมด <%=totalPage%>หน้า - <% if cint(pageno) > 1 then %> [หน้าแรก]  [ย้อนกลับ]  <% end if if cint(pageno) < totalPage then %> [หน้าต่อไป]  [หน้าสุดท้าย]  <% end if %>
กระโดดไปหน้า | <% for idx = 1 to totalPage%> <%=idx%>  <% next%>