Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP pages and ADO recordset paging routine not working correctly

Status
Not open for further replies.

MisterMo

Programmer
Mar 18, 2002
564
GB
Dear all,

I have written a routine that retrieve records from the main database using ADO with ActiveX file.

This routine is designed to give me the number of pages with a given search based on the number of records I choose to view per page.

In my case I want my routine to get 20 records at a time.

If I use ASP to create a ADODB connection and Recordset and give the PageSize and CacheSize on the Recordset everything works fine, but because of the number of users performing searches I am forced to use a DLL file with MTS.

The Code is exactly the same but is executed from the DLL file instead of the ASP page.

Here is the code
‘************************* Declare Variables *******************************
Dim iPageSize 'How big our pages are
Dim iPageCount 'The number of pages we get back
Dim iPageCurrent 'The page we want to show
Dim stSQL 'SQL command to execute
DIM stID 'Person/organisation flag
Dim I 'Standard looping var
Dim rs 'ADO DB recordset
Dim cn 'ADO DB Connection
Dim stSearch ' The text being looked for
Dim stURL ' The URL of this page so the form will work
IPageSize = 20

' Retrieve page to show or default to 1
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If

' Retreive the URL of this page from Server Variables
stURL = Request.ServerVariables("URL")

stSearch = Request.Form ("txtsearch")'the txt input from the Form Page

stSql = "SELECT ORGANISATION.SUB_NUM, ORGANISATION.NAME " _
& "FROM ORGANISATION " _
& "WHERE (Upper(ORGANISATION.NAME) LIKE ('%" & ucase(kwd3) & "%')) " _
& "ORDER BY ORGANISATION.NAME"

This is when I call the DLL file to get the records

Set cn = server.CreateObject("ConflictSearch.Search")

Set rs = cn.ConflictRS(stSql, iPageSize)
Set cn = Nothing 'close the connection

Now rs is the object which inherit the all the information from the ConflictRS Object which is an ADODB.RecordSet

And this is where I get the number of pages

iPageCount = rs.PageCount.

This is when everything goes bananas because the page count is totally wrong.

I know that the code is correct because I tested before placing it on my DLL file.

I just wonder if anybody out there has encountered the same problem and if so is there a fix.

I need this very badly and I don’t want to run the code from the ASP page.

Please can you help?????!!!!!!

Thanks in advanced

MisterMo
Life is like a box of Chocolates..... So is Microsoft
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top