Solved

Recordset paging in VB ASP with mySQL Database

Posted on 2007-11-22
4
1,141 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
ID: 20334028
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
ID: 20357100
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21135886
Forced accept.

Computer101
EE Admin
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

832 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