ASP as well

March 27, 2008 by Web Developer

Thanks for that, that was a great help. Here is an example of retrieving the records from a database using ASP.

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/mydns.asp" -->
<%
Dim myimages__MMColParam
myimages__MMColParam = "1"
If (Request.QueryString("category")  <> "") Then
  myimages__MMColParam = Request.QueryString("category")
End If
%>
<%
Dim myimages
Dim myimages_cmd
Dim myimages_numRows
Set myimages_cmd = Server.CreateObject ("ADODB.Command")
myimages_cmd.ActiveConnection = MM_mydns_STRING
myimages_cmd.CommandText = "SELECT * FROM myimages WHERE category = ?"
myimages_cmd.Prepared = true
myimages_cmd.Parameters.Append myimages_cmd.CreateParameter("param1", 5, 1, -1, myimages__MMColParam) ' adDouble
Set myimages = myimages_cmd.Execute
myimages_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
myimages_numRows = myimages_numRows + Repeat1__numRows
%>
<imageflow
 autoFlip="true"
 flipInterval="3"
 flipSpeed="4"
 useMotionBlur="true"
 dofStrength="2"
 angle="56"
 depth="734"
 spaceMain="156"
 spaceBack="104"
 descColor="0xAAAAAA"
 descSize="12"
 hasReflection="true"
 reflectionStrength="60"
 reflectionSize="30"
 reflectionBackground="000000"
 startImage="0"
 imgWidth="266"
 imgHeight="146"
 quality="1"
 fogStrength="40">
<title color="0xAAAAAA" size="12"><![CDATA[Your gallery title here]]></title>
<%
While ((Repeat1__numRows <> 0) AND (NOT myimages.EOF))
%>
<image url="mypics/<%=(myimages.Fields.Item("myimage_pic").Value)%>" target="_blank" width="450" height="200"><![CDATA[<%=(myimages.Fields.Item("myimage_title").Value)%>]]></image>
<%
  repeat1__index="Repeat1__index+1"
  repeat1__numrows="Repeat1__numRows-1"
  myimages.MoveNext()
Wend
%>
</imageflow>
<%
myimages.Close()
Set myimages = Nothing
%>

Its just an example you will have to change the database connections and the database field names but you get my meaning by it.