?
Solved

Recordset paging in VB ASP with mySQL Database

Posted on 2007-11-22
4
Medium Priority
?
1,145 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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:
Dirar Abu Kteish earned 2000 total points
ID: 20357100
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21135886
Forced accept.

Computer101
EE Admin
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Creating and Managing Databases with phpMyAdmin in cPanel.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

741 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