May 1, 2003 at 6:39 pm
DIM pagenum, rowcount, i
id=Request.QueryString("ID")
set connection=Server.CreateObject("ADODB.Connection")
set checkRec=Server.CreateObject("ADODB.recordset")
connection.open = "DSN=tnb_ztmy;" & "uid=xpower; pwd=xpower"
checkRec.PageSize=50
checkRec.CacheSize=50
checkRec.CursorLocation=adUseClient
sql ="SELECT DISTINCT a.classid, a.label, b.name FROM LOCMAPPOINT a, SYSCLASS b WHERE a.classid="&id&" AND b.name='"& request("name") &"'"
checkRec.Open sql,connection, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect
if Len(request("pagenum"))=0 then
pagenum=1
Else
if Cint(Request("pagenum"))<=checkRec.PageCount then
checkRec.AbsolutePage=request("pagenum")
else
checkRec.AbsolutePage=1
End If
End if
rowcount=0
while not checkRec.eof and rowcount < checkRec.PageSize
%>
My problem is that the page will not display the data if it is less than 50 pr page. It will only display data if it is 50 only.
I have tried changing the
CInt(Request("pagenum"))<= checkRec.PageCOunt...
but it did not work either....any ideas?
eat when you can and not when you cannot.
eat when you can and not when you cannot.
May 2, 2003 at 5:18 am
When there is data less than 50 records, what will the request("pagenum") contain (0 or 1 or empty)?
May 4, 2003 at 9:52 pm
no display....just an error page
eat when you can and not when you cannot.
eat when you can and not when you cannot.
May 5, 2003 at 6:02 am
Can you run the code in debug mode and find out which line the error is appearing and what the error message is. This might give an hint to solve the error.
I can see one possibility of error
1. suppose that pagenum is set to 0 when calling this page.
2. In this case Len(request("pagenum")) will return 1 and not 0. The else condition tries to set .Absolutepage = 0. This might give an error (I am not sure as valid values for AbsolutePage are 1 to n).
Hope this helps
May 5, 2003 at 7:38 am
Shouldn't you add Request.Querystring("Pagenum")?
Are you sure that the 'PageCount' that is calculated in the database is correct? I.e. 1 if there are less than (or equal to) 50 records, 2 if there are between 50 and 100 (inclusive) and so on?
And of course, what is the exact error message? Maybe we can get some pointers from there...
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply