Solved

Recordset paging in VB ASP with mySQL Database

Posted on 2007-11-22
4
1,139 Views
Last Modified: 2008-03-15
Hi,

I'm building a website that needs to connect to a mySQL database.

Using the code below, I can connect to the database and display x amount of records using the LIMIT function of mySQL.

I now want to be able to page through all the records in blocks of x with the pages listed at the bottom and a total count of records.

How can I do this?
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<%

Set OBJdbConn = Server.CreateObject("ADODB.Connection")

OBJdbConn.Open = "Driver={MySQL ODBC 3.51 Driver};Server=admin-sw;Database=ijtd_export; User=root;Password=cre2unat;Option=3;"

%>
 
 

<%

Dim rsCallBackStatus

Dim rsCallBackStatus_numRows
 

SQLQuery = "SELECT * FROM vallinone LIMIT 0, 20"
 

Set rsCallBackStatus = OBJdbConn.Execute(SQLQuery)
 

rsCallBackStatus_numRows = 0

%>
 
 

<%do until rsCallBackStatus.eof%>
 

<%=rsCallBackStatus("Customer_URN")%><br>
 

<%rsCallBackStatus.movenext

		loop%>
 
 

  <%

rsCallBackStatus.Close()

Set rsCallBackStatus = Nothing

OBJdbConn.Close

Set OBJdbConn = Nothing

%>

Open in new window

0
Comment
Question by:BenthamLtd
4 Comments
 
LVL 23

Expert Comment

by:Ashish Patel
Comment Utility
Hint for getting this done . Start having two variables like currentpage = 1 and noofrows = 20 and apply the variables to your limit like below.
SQLQuery = "SELECT * FROM vallinone LIMIT " & (currentpage * noofrows)-20 & " , " & noofrows
and then keep a hyperlink below the page with currentpage + 1 in ">" sign and move on.

You will have to put some if else logics for "<" or "<<" and ">" or ">>" and that should be good.
0
 
LVL 6

Accepted Solution

by:
dxz2 earned 500 total points
Comment Utility
0
 
LVL 1

Expert Comment

by:Computer101
Comment Utility
Forced accept.

Computer101
EE Admin
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now