Losing records in recordset??

Discussion in 'ASP General' started by kinane3@yahoo.com, Jul 15, 2005.

  1. Guest

    I'm guessing this has something to do with my cursor but I'm not sure.
    this is for a picture gallery app and when I upload pictures some
    pictures or records don't show up. this is what ia have so far. any
    thoughts? this only works with an adOpenKeyset cursor by the way. use
    any others any it spits out errors.

    thanks!!!

    <%
    'If this is the first time the page is displayed then set the record
    position is set to page 1
    If Request.QueryString("PagePosition") = "" Then
    intRecordPositionPageNum = 1
    'Else the page has been displayed before so the news item record
    postion is set to the Record Position number
    Else
    intRecordPositionPageNum = CInt(Request.QueryString("PagePosition"))
    End If

    Set rsGallery = Server.CreateObject("ADODB.Recordset")
    gallerySQL = "SELECT fld_picture_fileName, fld_picture_altTag FROM
    tbl_pictures ORDER BY fld_picture_DateTime DESC;"
    rsGallery.Open gallerySQL, objConn, adOpenKeyset, adLockOptimistic,
    adCmdText

    'Set the number of records to display on each page
    rsGallery.PageSize = 16

    'Get the record postion to display from
    If NOT rsGallery.EOF Then rsGallery.AbsolutePage =
    intRecordPositionPageNum


    'If there are no pictures in the database display an error message
    If rsGallery.EOF Then
    'Tell the user there are no pictures to display
    Response.Write "There are no pictures to display"
    Response.End


    Else
    'Count the number of pictures in database
    picCount = rsGallery.RecordCount

    'Count the number of pages of pictures there are in the database
    calculated by the PageSize attribute set above
    galleryPage = rsGallery.PageCount

    Response.write _
    "<table cellspacing='5' cellpadding='0' border='0'>"
    'For....Next Loop to display pictures in the database
    For rowCounter = 1 to 4
    If rsGallery.EOF Then Exit For
    Response.write _
    "<tr>"
    For cellCounter = 1 to 4
    If rsGallery.EOF Then Exit For
    Response.write _
    " <td valign='top'>" & _
    " <img src='/NewSite/thumbs/" & rsGallery("fld_picture_fileName") &
    "_thumbnail.jpg' alt='" & rsGallery("fld_picture_altTag") & "'>" & _
    " </td>"
    If rsGallery.EOF Then Exit For
    rsGallery.MoveNext
    Next
    Response.write _
    "</tr>"
    If rsGallery.EOF Then Exit For
    rsGallery.MoveNext
    Next
    Response.write "</table>"
    End If

    'Paging code here

    Response.write _
    "<table border='0' width='100%'>" & _
    "<tr>" & _
    " <td align='center'>"
    If intRecordPositionPageNum > 1 Then
    Response.Write "<a href=""/NewSite/photo_galleries.asp?PagePosition=" &
    intRecordPositionPageNum - 1 &
    """>&lt;&lt;&nbsp;Prev</a>&nbsp;&nbsp;"
    End If

    'If there are more pages to display then display links to all the pages
    If intRecordPositionPageNum > 1 or NOT rsGallery.EOF Then


    For intLinkPageNum = 1 to galleryPage

    'If the page to be linked to is the page displayed then don't make it
    a hyper-link
    If intLinkPageNum = intRecordPositionPageNum Then
    Response.Write "&nbsp;<strong>" & intLinkPageNum & "</strong>"
    Else
    Response.Write "&nbsp;<a
    href=""/NewSite/photo_galleries.asp?PagePosition=" & intLinkPageNum &
    """>" & intLinkPageNum & "</a>"
    End If
    Next
    End If


    'if this is not the last page display
    If NOT rsGallery.EOF then
    Response.Write "&nbsp;&nbsp;&nbsp;<a
    href=""/NewSite/photo_galleries.asp?PagePosition=" &
    intRecordPositionPageNum + 1 & """>Next&nbsp;&gt;&gt;</a>"
    End If


    Response.write _
    " </td>" & _
    "</tr>" & _
    "</table>"
    rsGallery.Close
    Set rsGallery = nothing
    %>
     
    , Jul 15, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. J. Muenchbourg
    Replies:
    0
    Views:
    286
    J. Muenchbourg
    Jul 11, 2003
  2. Hung Huynh
    Replies:
    8
    Views:
    347
    Bob Barrows
    Sep 24, 2003
  3. mgm

    counting records in a recordset

    mgm, Oct 22, 2004, in forum: ASP General
    Replies:
    8
    Views:
    179
    Ben Strackany
    Oct 28, 2004
  4. Infused
    Replies:
    3
    Views:
    302
    Infused
    Jun 27, 2007
  5. Jason C
    Replies:
    4
    Views:
    706
    Morty Abzug
    Jun 26, 2012
Loading...

Share This Page