Goal: To generate 6 random images on a webpage using the
image path to the server and provide a link to the website of all
of the images.
Background:
The images are on our server and a record is created for each
in an MS Access database.
The records contain:
Record ID (autonumber)
Name
Path to Server
Path to Images’ Website
More..
Created a query that generates random records:
--
SELECT TOP 4 tblOutsideLinks.LinkName,
tblOutsideLinks.AdroitServerLocation, tblOutsideLinks.WebsiteLink,
tblOutsideLinks.ContactName, tblOutsideLinks.ContactEmail,
tblOutsideLinks.LinkNo
FROM tblOutsideLinks
ORDER BY Rnd([LinkNo]) DESC;
--
This works fine. Even though it isn’t truly random I am
okay with the results.
I created a recordset query in Dreamweaver using the query
and when testing the results using the button in the recordset
dialogue they show the same results as the MS Access Database.
I tried to display the results on an asp page and they are
static.
I started reading posts (dozens of them) to try to figure the
issue out, but no one seems to be doing the same thing so I
extracted the rand functions and created a random variable before
the sql is run on the page. I then incorporated the variable in the
dialogue window and tried to let it run. I can see the variable
changing on the page, but the records are still static.
I also played with the cursortype and some other things, but
nothing appears to get this train moving.
When I get the random records I would like to attach each one
to an image using the record source function. I tested this method
before going to the random records and it works quite nicely.
I would be happy to supply any other information or code you
may need, but as you can tell I am a novice, so I am not so sure
what else you would need.
Thanks for the help,
Keith
BELOW IS SECTIONS OF PAGE CODE
<%
RANDOMIZE
Dim rsRandomNumber
rsRandomNumber =(INT((6)*RND()))
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_adroit_STRING
Recordset1.Source = "SELECT TOP 4 tblOutsideLinks.LinkName,
tblOutsideLinks.AdroitServerLocation, tblOutsideLinks.WebsiteLink,
tblOutsideLinks.ContactName, tblOutsideLinks.ContactEmail,
tblOutsideLinks.LinkNo FROM tblOutsideLinks ORDER BY Rnd([LinkNo])
DESC;"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>