%
if IsObject(Session("steel_con")) then
Set Conn=Session("steel_con")
Else
Set conn= Server.CreateObject("ADODB.Connection")
conn.open "steel006","",""
Set Session("steel_con")=conn
end if
sql4="select * from hot"
Set RS4 = Server.CreateObject("ADODB.RecordSet")
RS4.Open sql4, Conn, 3,3
%>
<% ' Constant representing the number of images.
' This is used in Methods 1 and 2.
Const NUMBER_OF_IMAGES = 3
' Initialize the random number generator. This is the
' command that tells the computer to give us psedo-random
' numbers when we use Rnd later.
Randomize
Dim intImageIdToShow
' Random Id we generate
Dim arrImages(2,4)
' Array to hold image parameters
' Set up our 2D array with the values
' In my setup the first number is basically representing
' an image id and each image has an associated filename,
' width, height, and alt tag text.
rs4.movefirst
For i=0 to 2
sql5="select img1,img2,img3,img4,img5 from hot where id like "&rs4.fields("id")
Set RS5 = Server.CreateObject("ADODB.RecordSet")
RS5.Open sql5, Conn, 3,3
arrImages(i,0) = rs5.fields("img1")
arrImages(i,1) = rs5.fields("img2")
arrImages(i,2) = rs5.fields("img3")
arrImages(i,3) = rs5.fields("img4")
arrImages(i,4) = rs5.fields("img5")
rs4.movenext
next
' Generate a random number based on the bounds of the
' array we just set up. Notice the ", 1" in the LBound
' and UBound calls. This indicates I want to use the
' bounds from the first dimension. It's the default so I
' could have left it off, but I thought I should include
' it for reference in case you decide to use the array
' differently then I did and need the bound from a
' different dimension.
intImageIdToShow = Int((UBound(arrImages, 1) - LBound(arrImages, 1) + 1) * Rnd + LBound(arrImages, 1))
' Show the image:
%>
<%
sql="select * from steel where type like 'Full Face Helmets' ORDER BY id"
Set RS = Server.CreateObject("ADODB.RecordSet")
RS.Open sql, Conn, 3,3
%>
Steelbird Hi-Tech India Ltd-Products: Full Face Helmets
HOT MODELS
 |
|
|
<%
For im=0 to 4
sql6 = "select name from steel where id like '"&arrImages(intImageIdToShow, im)&"'"
Set RS6 = Server.CreateObject("ADODB.RecordSet")
RS6.Open sql6, Conn, 3,3
response.write("")
response.write rs6.fields("name")
response.write(" | ")
Next
%>
|
|
| Image |
Name |
Colours * Colours subject to change as per fashion |
<%
rs.movefirst
do while not rs.eof
response.write("&".jpg)
| ")
response.write("")
response.write(""&rs.fields("name")&" | ")
response.write(""&rs.fields("color")&" | ")
rs.movenext
Loop
%>
|