 |
<%
' this code opens the database
myDSN="DSN=renegades"
set conntemp=server.createobject("adodb.connection")
conntemp.open myDSN
pic_var=request.querystring("picvar")
if pic_var = "" then
pic_var = 1
end if
mySQL="select imagenumber,caption from pictures where imagenumber=" & pic_var & ""
set rstemp=conntemp.execute(mySQL)
' this code detects if data is empty
If rstemp.eof then
response.write "No records matched "
response.write mySQL & " So cannot make table..."
rstemp.close
set rstemp=nothing
response.end
end if
mySQL2="select count(imagenumber) as imgcount from pictures"
set rstemp2=conntemp.execute(mySQL2)
' this code detects if data is empty
If rstemp2.eof then
response.write "No records matched "
response.write mySQL2 & " So cannot make table..."
rstemp2.close
set rstemp2=nothing
response.end
end if
pic_caption=rstemp("caption")
img_count=rstemp2("imgcount")
response.write "| "
for x = 1 to img_count
if x = cInt(pic_var) then
response.write "" & x & " "
else
response.write "" & x & " "
end if
next
response.write " | "
if pic_var > 1 then
response.write "| Previous Pic | "
else
response.write " |   | "
end if
response.write "Some pictures | "
if cInt(pic_var) < img_count then
response.write "Next Pic | "
else
response.write " | "
end if
response.write " "
response.write " | "
response.write " "
response.write "" & pic_caption & " | "
response.write " "
' Now close and dispose of resources
rstemp.close
set rstemp=nothing
conntemp.close
set conntemp=nothing
%>
|
 |
|