Author |
Topic  |
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 27 December 2002 : 21:04:44
|
yes, still getting the timeout. |
 |
|
GauravBhabu
Advanced Member
    
4288 Posts |
Posted - 27 December 2002 : 21:20:00
|
does eliminating the maxpages stops timing out. or Assign a numeric value to maxpages and see if it passes thru that statement. for example: maxpages = 500 |
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 27 December 2002 : 21:28:44
|
yes it does. I know that the maxpages should be 676 so I changed:
maxpages = cLng(rs.pagecount)
to:
maxpages = 676 'cLng(rs.pagecount)
and as you can see, members.asp doesn't timeout anymore. |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 27 December 2002 : 21:28:56
|
One alternative would be to count the records with an explicit sql statement just for that purpose, and then use it coupled with strPageSize to get the number of pages. Should avoid the timeouts, hopefully. |
Snitz 3.4 Readme | Like the support? Support Snitz too |
 |
|
GauravBhabu
Advanced Member
    
4288 Posts |
Posted - 27 December 2002 : 21:32:14
|
It could be that clng is causing the timed out error. As wew now know the statement which is causing the error. let us try without clng
maxpages = (rs.pagecount)
|
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 27 December 2002 : 21:32:29
|
I've been doing some research and have found a couple of different ways to handle it, this page shows 3 different ways:
www.adopenstatic.com/experiments/recordsetpaging.asp |
 |
|
GauravBhabu
Advanced Member
    
4288 Posts |
Posted - 27 December 2002 : 21:39:17
|
quote: Originally posted by ruirib
One alternative would be to count the records with an explicit sql statement just for that purpose, and then use it coupled with strPageSize to get the number of pages. Should avoid the timeouts, hopefully.
Richard tried the rs.recordcount with strPageSize and it timed out |
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 27 December 2002 : 21:42:06
|
quote: Originally posted by GauravBhabu
It could be that clng is causing the timed out error. As wew now know the statement which is causing the error. let us try without clng
maxpages = (rs.pagecount)
I did, it still timed out. |
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 27 December 2002 : 21:43:15
|
quote: Originally posted by GauravBhabu
quote: Originally posted by ruirib
One alternative would be to count the records with an explicit sql statement just for that purpose, and then use it coupled with strPageSize to get the number of pages. Should avoid the timeouts, hopefully.
Richard tried the rs.recordcount with strPageSize and it timed out
I think what ruirib meant was to use the same method that we use for MySQL to get the total # of pages. |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 27 December 2002 : 21:47:28
|
quote: Originally posted by GauravBhabu
quote: Originally posted by ruirib
One alternative would be to count the records with an explicit sql statement just for that purpose, and then use it coupled with strPageSize to get the number of pages. Should avoid the timeouts, hopefully.
Richard tried the rs.recordcount with strPageSize and it timed out
I was not suggesting using rs.recordcount. I meant something like:
strSql = "SELECT COUNT(MEMBER_ID) AS TotalMembers FROM FORUM_MEMBERS WHERE...."
set rsCount= my_conn.Execute(strSql)
intTotalMembers = rsCount("TotalMembers")
...
Then use intTotalMembers with strPageSize. Anyway at least one of the methods Richard found looks interesting...
P.S.: Richard was faster than I was. And yes, I could just have said to do it the way it is done with MySQL . |
Snitz 3.4 Readme | Like the support? Support Snitz too |
Edited by - ruirib on 27 December 2002 21:49:30 |
 |
|
GauravBhabu
Advanced Member
    
4288 Posts |
Posted - 27 December 2002 : 21:53:37
|
It seems that accessing the pagecount property is causing the error. I don't know why it would happen but doing some tests might help to determine the cause of error.
What comes to my mind is using clng(strPageSize) instead of strPageSize
Checking the result of Response.write "PageCount " & rs.PageCount
|
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 27 December 2002 : 22:02:52
|
it shows the pagecount but only after the script times out.
I added the following:
Response.Write "Pagecount = " & rs.pagecount Response.End
right above this line:
maxpages = 676 'cLng(rs.pagecount)
|
 |
|
GauravBhabu
Advanced Member
    
4288 Posts |
Posted - 27 December 2002 : 22:18:47
|
Just an effort to determine the cause of error, you may please check if we can access pagesize or other properties correctly
rs.pagesize = clng(strPageSize)
Response.write "RecCount : " & rs.recordcount & "<BR>"
Response.write "PageSize: " & rs.PageSize & "<BR>"
Response.write "PageCount: " & rs.PageCount & "<BR>"
maxpages = (rs.pagecount)
rs.absolutepage = mypage '** |
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 27 December 2002 : 22:24:39
|
ok, here is what I have changed, and it seems to work without any errors:
I replaced this:
set rs = Server.CreateObject("ADODB.Recordset")
rs.cachesize = strPageSize
rs.open strSql & strSql2 & strSql3 & strSql4, my_Conn, adOpenStatic
If not (rs.EOF or rs.BOF) then
rs.movefirst
rs.pagesize = strPageSize
rs.absolutepage = mypage '**
maxpages = cLng(rs.pagecount)
arrMemberData = rs.GetRows(strPageSize)
iMemberCount = UBound(arrMemberData, 2)
else
iMemberCount = ""
end if
rs.Close
set rs = nothing with this:
'## Forum_SQL - Get the total pagecount
strSql1 = "SELECT COUNT(MEMBER_ID) AS PAGECOUNT "
set rsCount = my_Conn.Execute(strSql1 & strSql2 & strSql3)
iPageTotal = rsCount(0).value
rsCount.close
set rsCount = nothing
if iPageTotal > 0 then
maxpages = (iPageTotal \ strPageSize )
if iPageTotal mod strPageSize <> 0 then
maxpages = maxpages + 1
end if
else
iPageTotal = 0
maxpages = 0
end if
if iPageTotal > 0 then
set rs = Server.CreateObject("ADODB.Recordset")
rs.cachesize = strPageSize
rs.open strSql & strSql2 & strSql3 & strSql4, my_Conn, adOpenStatic, adLockReadOnly, adCmdText
rs.pagesize = strPageSize
rs.absolutepage = mypage '**
arrMemberData = rs.GetRows(strPageSize)
iMemberCount = UBound(arrMemberData, 2)
rs.Close
set rs = nothing
else
iMemberCount = ""
end if |
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 27 December 2002 : 22:29:31
|
quote: Originally posted by GauravBhabu
Just an effort to determine the cause of error, you may please check if we can access pagesize or other properties correctly
rs.pagesize = clng(strPageSize)
Response.write "RecCount : " & rs.recordcount & "<BR>"
Response.write "PageSize: " & rs.PageSize & "<BR>"
Response.write "PageCount: " & rs.PageCount & "<BR>"
maxpages = (rs.pagecount)
rs.absolutepage = mypage '**
It shows the RecCount, but not the PageSize or PageCount, you can test it here on this site. Just let me know after you have seen it so I can change the code in the file. |
 |
|
Topic  |
|