473,245 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,245 software developers and data experts.

ASP paging problem

Hi
I have written code in ASP for paging records from the
database (SQL Server 2000).
The real problem I have around 10,000 records and it
tries to fetch all the records everytime (I'm saying
because its take a lot time to display it). Even though,
it displays all the data correctly and you can also
navigate through links.
Is it possible to set the limit on recordset while it
fetches the data. Lets say page size is 20 records per
page, so it should fetch only twenty records from the
database (depends on page being displayed) rather fetches
all records and displaying twenty records.
I know its possible if we use mysql database so can you
set the limit (its keyword) in the query statement.
Any help would be appreciated.
Thanx in advance...
Dave
Jul 19 '05 #1
4 1706
Some alternative approaches here. http://www.aspfaq.com/2120

If you can wait a few days, I'll probably have a much more comprehensive and
totally re-written article ready by Monday.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"david" <an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl...
Hi
I have written code in ASP for paging records from the
database (SQL Server 2000).
The real problem I have around 10,000 records and it
tries to fetch all the records everytime (I'm saying
because its take a lot time to display it). Even though,
it displays all the data correctly and you can also
navigate through links.
Is it possible to set the limit on recordset while it
fetches the data. Lets say page size is 20 records per
page, so it should fetch only twenty records from the
database (depends on page being displayed) rather fetches
all records and displaying twenty records.
I know its possible if we use mysql database so can you
set the limit (its keyword) in the query statement.
Any help would be appreciated.
Thanx in advance...
Dave

Jul 19 '05 #2

OP - Go with the DB Stored Proc way of paging... its MUCH MUCH Quicker
:)

Arron, are you rewriting the stored proc version? I'd be interest in
this if its even better :)

Al.

On Wed, 7 Jan 2004 23:13:10 -0500, "Aaron Bertrand [MVP]"
<aa***@TRASHaspfaq.com> wrote:
Some alternative approaches here. http://www.aspfaq.com/2120

If you can wait a few days, I'll probably have a much more comprehensive and
totally re-written article ready by Monday.


Jul 19 '05 #3
There will be a bunch of new stored procedure approaches. Just need to find
time to breathe first.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Harag" <ha***@REMOVETHESECAPITALSsofthome.net> wrote in message
news:8c********************************@4ax.com...

OP - Go with the DB Stored Proc way of paging... its MUCH MUCH Quicker
:)

Arron, are you rewriting the stored proc version? I'd be interest in
this if its even better :)

Al.

On Wed, 7 Jan 2004 23:13:10 -0500, "Aaron Bertrand [MVP]"
<aa***@TRASHaspfaq.com> wrote:
Some alternative approaches here. http://www.aspfaq.com/2120

If you can wait a few days, I'll probably have a much more comprehensive andtotally re-written article ready by Monday.

Jul 19 '05 #4

Hey Dave,

I hope you get this although the message is starting to age.

Try out my /coolpier_script/DBConn.asp. The paging function I use that
generally works really fast. It is located at ...

http://www.coolpier.com/cp/cp_script...ile=DBConn.asp

And it has...

cp_TheConnectionString

Sub cp_DBConn(cp_ConnAction) '// "open" or "close"

Sub cp_SqlExecute(cp_TheSqlStatement) '// one not returning a
recordset

Function cp_SqlArray(cp_TheSqlStatement) '//returns recordset as array

Function cp_DBPaging(cp_TheSQLStatement, cp_ThePageNumber,
cp_RecordsPerPage) '// returns that pages recordset as array

The 2 that return arrays, you will want to check if any records found
by ...

Your code would look similar to this...

<%
Dim pageNum, perPage
pageNum = CInt(Request.QueryString("page"))
perPage = 20

Dim yourArray, yourSQL, totalPagesOfRecords
cp_TheConnectionString = "DSN=yourDSN;"
yourSQL = "Select * From yourTable Where this = 'that';"

'// IN & OUT of database connection fast as heck ;)
cp_DBConn("open")
yourArray = cp_DBPaging(cp_TheSQLStatement, pageNum, perPage)
totalPagesOfRecords = cp_TotalPages
cp_DBConn("close")
If Not IsArray(yourArray) Then
'// No records found code
Else
'// Records found code
End If
%>

I will have more detailed instruction on my website very soon.
On Wed, 7 Jan 2004 19:53:40 -0800, "david"
<an*******@discussions.microsoft.com> wrote:
Hi
I have written code in ASP for paging records from the
database (SQL Server 2000).
The real problem I have around 10,000 records and it
tries to fetch all the records everytime (I'm saying
because its take a lot time to display it). Even though,
it displays all the data correctly and you can also
navigate through links.
Is it possible to set the limit on recordset while it
fetches the data. Lets say page size is 20 records per
page, so it should fetch only twenty records from the
database (depends on page being displayed) rather fetches
all records and displaying twenty records.
I know its possible if we use mysql database so can you
set the limit (its keyword) in the query statement.
Any help would be appreciated.
Thanx in advance...
Dave


I participate in the group to help give examples of code. I do not guarantee the effects of any code posted. Test all code before use!

Brynn
www.coolpier.com
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Li | last post by:
Hi, guys, I got a problem when trying to paging the recordset. the problem is even I set the pagesize but the first page will always show all the records and the number of records that shown on...
3
by: sara | last post by:
Hi all, I have a strange problem. I have a page where I am creating a recordset that can handle paging and the query for it was originally selecting from only one table. This was all working...
2
by: Daniel Walzenbach | last post by:
Hi, I have a question regarding the DataGrid control. If paging is enabled the grid binds the data, sets the paging on the top/bottom (or however it is set up) and throws away unnecessary...
2
by: saleek | last post by:
Hi, I am trying to figure out why my datagrid has stopped firing the page and sort commands. Scenario: I originally had template columns in my datagrid and had set up custom bi-directional...
2
by: farhad13841384 | last post by:
Hi , I Hope You fine. I have some problem with this code for paging in asp.net this bottom code work correctly without any error but when I try to place separate code in .VB file then error is...
2
by: antonyliu2002 | last post by:
I've been googling for some time, and could not find the solution to this problem. I am testing the paging feature of gridview. I have a very simple web form on which the user can select a few...
2
by: rn5a | last post by:
In a shopping cart app, a ASPX page retrieves the order details & personal details of a user from a MS-Access database table depending upon the username of the user. The order details of a...
7
by: =?Utf-8?B?SmVmZiBCZWVt?= | last post by:
The default paging behavior of the gridview doesn't work well with very large sets of data which means we have to implement some sort of custom paging. The examples I have seen (4guysfromrolla,...
1
by: =?Utf-8?B?TG95b2xhIHN0YWxpbg==?= | last post by:
Hi, I am using ASP.Net 2.0 version and Windows'XP OS. I am useing the Grid view control to display the user details along with the paging concept provided by the grid view control. When i...
2
by: wallconor | last post by:
Hi, I am having a problem using Dreamweaver CS3 standard recordset paging behavior. It doesn’t seem to work when I pass parameter values from a FORM on my search page, to the recordset on my...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.