Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Random Image Path Static on Delivery of Page

New Here ,
Jul 16, 2006 Jul 16, 2006

Copy link to clipboard

Copied

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
%>
TOPICS
Server side applications

Views

253
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2007 Feb 05, 2007

Copy link to clipboard

Copied

I seem to be having the same problem. I'm trying to present a random image on the home page of a site from a series of about 1600 records in a database.

I'm using MS Access and VBScript. I have successfully created an sql query in the database and the code on the page (I've tried both ways - ie. by creating a separate table in the database and also embedding the query in the asp code).

Each time I evaulate the query in the database or test it in the recordset creation dialogue it the result is different so I know the query works. But once I've uploaded the page to the server the query doesn't seem to be re-evaulated when the page is reloaded. It originally retrieved a random image but the image has not changed.

I'm thinking some sort of server caching issue?

Any suggestions?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 06, 2007 Feb 06, 2007

Copy link to clipboard

Copied

LATEST
Certainly sounds like a caching issue. You could add a no-cache instruction
in the header to the page.

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"boycetrus" <webforumsuser@macromedia.com> wrote in message
news:eq91sm$jc4$1@forums.macromedia.com...
>I seem to be having the same problem. I'm trying to present a random image
>on
> the home page of a site from a series of about 1600 records in a database.
>
> I'm using MS Access and VBScript. I have successfully created an sql query
> in
> the database and the code on the page (I've tried both ways - ie. by
> creating a
> separate table in the database and also embedding the query in the asp
> code).
>
> Each time I evaulate the query in the database or test it in the recordset
> creation dialogue it the result is different so I know the query works.
> But
> once I've uploaded the page to the server the query doesn't seem to be
> re-evaulated when the page is reloaded. It originally retrieved a random
> image
> but the image has not changed.
>
> I'm thinking some sort of server caching issue?
>
> Any suggestions?
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines