Help needed...error in page display

  • 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.

  • When there is data less than 50 records, what will the request("pagenum") contain (0 or 1 or empty)?

  • no display....just an error page

    eat when you can and not when you cannot.


    eat when you can and not when you cannot.

  • 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

  • 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