K
kinane3
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 &
"""><< Prev</a> "
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 " <strong>" & intLinkPageNum & "</strong>"
Else
Response.Write " <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 " <a
href=""/NewSite/photo_galleries.asp?PagePosition=" &
intRecordPositionPageNum + 1 & """>Next >></a>"
End If
Response.write _
" </td>" & _
"</tr>" & _
"</table>"
rsGallery.Close
Set rsGallery = nothing
%>
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 &
"""><< Prev</a> "
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 " <strong>" & intLinkPageNum & "</strong>"
Else
Response.Write " <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 " <a
href=""/NewSite/photo_galleries.asp?PagePosition=" &
intRecordPositionPageNum + 1 & """>Next >></a>"
End If
Response.write _
" </td>" & _
"</tr>" & _
"</table>"
rsGallery.Close
Set rsGallery = nothing
%>