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.QuerySt ring("PagePosit ion") = "" Then
intRecordPositi onPageNum = 1
'Else the page has been displayed before so the news item record
postion is set to the Record Position number
Else
intRecordPositi onPageNum = CInt(Request.Qu eryString("Page Position"))
End If
Set rsGallery = Server.CreateOb ject("ADODB.Rec ordset")
gallerySQL = "SELECT fld_picture_fil eName, fld_picture_alt Tag FROM
tbl_pictures ORDER BY fld_picture_Dat eTime DESC;"
rsGallery.Open gallerySQL, objConn, adOpenKeyset, adLockOptimisti c,
adCmdText
'Set the number of records to display on each page
rsGallery.PageS ize = 16
'Get the record postion to display from
If NOT rsGallery.EOF Then rsGallery.Absol utePage =
intRecordPositi onPageNum
'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.Recor dCount
'Count the number of pages of pictures there are in the database
calculated by the PageSize attribute set above
galleryPage = rsGallery.PageC ount
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_fileNam e") &
"_thumbnail.jpg ' alt='" & rsGallery("fld_ picture_altTag" ) & "'>" & _
" </td>"
If rsGallery.EOF Then Exit For
rsGallery.MoveN ext
Next
Response.write _
"</tr>"
If rsGallery.EOF Then Exit For
rsGallery.MoveN ext
Next
Response.write "</table>"
End If
'Paging code here
Response.write _
"<table border='0' width='100%'>" & _
"<tr>" & _
" <td align='center'> "
If intRecordPositi onPageNum > 1 Then
Response.Write "<a href=""/NewSite/photo_galleries .asp?PagePositi on=" &
intRecordPositi onPageNum - 1 &
"""><<&nb sp;Prev</a> "
End If
'If there are more pages to display then display links to all the pages
If intRecordPositi onPageNum > 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 = intRecordPositi onPageNum Then
Response.Write " <strong> " & intLinkPageNum & "</strong>"
Else
Response.Write " <a
href=""/NewSite/photo_galleries .asp?PagePositi on=" & intLinkPageNum &
""">" & intLinkPageNum & "</a>"
End If
Next
End If
'if this is not the last page display
If NOT rsGallery.EOF then
Response.Write " &n bsp;<a
href=""/NewSite/photo_galleries .asp?PagePositi on=" &
intRecordPositi onPageNum + 1 & """>Next & gt;></a>"
End If
Response.write _
" </td>" & _
"</tr>" & _
"</table>"
rsGallery.Close
Set rsGallery = nothing
%>