The first thing you need to do is create a database called MyCustomers. Then create a table called tblCustomerInfo with these fields:
ID - autonumber
Email - text field
Name - text field
Then, enter some test data. For this example, we will say that we have a database containing 30 customers and we only want to display 10 customers per page.
Next, you create a page called displaycustomers.asp and copy the below code into your page:
<%=objRS("Email")%> - <%=objRS("Name")%> |
<%=intPageRecords%> - <%=intPageRecords+(intRecordCount-1)%> of <%=(objRS.RecordCount)%> customers
Scroll Through More Customers
<% intCurrentPage = Request.Querystring("page") IF intCurrentPage = "" THEN intCurrentPage = 1 intNumberOfPages = int(objRS.RecordCount \ 10) IF objRS.RecordCount MOD 10<> 0 THEN intNumberOfPages = intNumberOfPages + 1
Response.Write("Pages: [")
FOR intDisplayPage = 1 TO intNumberOfPages
IF Cint(intDisplayPage) = Cint(intCurrentPage) THEN
Response.Write " " & intDisplayPage & " "
ELSE
Response.Write " " & intDisplayPage &_
" "
END IF
NEXT
Response.Write ("]")
%>
Finished! You now have your very own scrollable customer list. Now all you have to do is go out and get those customers!
http://www.aspwebpro.com/aspscripts/database/displaynrecordsperpage.asp
No comments:
Post a Comment