473,287 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Random record each day

Hi,

I need to display a different random record or link each day. I have the
random part working so that if the browser is refreshed a new record will
display. I'm not sure however how to specify that it only happens once a
day. This is the select statement I'm using to generate a random record.

Dim queryString As String = "SELECT Top 1 [tbllinks].[link] FROM [tbllinks]
ORDER BY NEWID()"

Thanks

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #1
2 1439
You'll have to store a "date" value somewhere (DB, File, etc) and check this
when it loads to determine if you need the call to the DB for a new record.
I would store the Date & the ID of the record in a table, you can have a
history that way too :}

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Pete via DotNetMonster.com" <fo***@DotNetMonster.com> wrote in message
news:29******************************@DotNetMonste r.com...
Hi,

I need to display a different random record or link each day. I have the
random part working so that if the browser is refreshed a new record will
display. I'm not sure however how to specify that it only happens once a
day. This is the select statement I'm using to generate a random record.

Dim queryString As String = "SELECT Top 1 [tbllinks].[link] FROM
[tbllinks]
ORDER BY NEWID()"

Thanks

--
Message posted via http://www.dotnetmonster.com

Nov 19 '05 #2
Thanks so much

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Keith Griffiths | last post by:
I'm trying to do a search under a set criteria followed by a selection of random entries meeting this criteria. But I don't seem to be able to achieve this. The idea being to search on say...
10
by: Stefanie | last post by:
Hi, I have a question about declaring variables for writing data to a file for random access. I have two string variables declared in a module (user-defined types). The point is that for one of...
2
by: Ini | last post by:
Hi, Is there an easy way to pick at random one record out of a recordset and then leave this recordset? I was thinking about doing a recordcount of the recordset, then find at random the...
7
by: Bill | last post by:
Hello, I am trying to use a SQL Query to return a random record from an Access 2000 Database. I am using: SELECT TOP 1 Example FROM TABLE ORDER BY Rnd;
4
by: anita | last post by:
I had posted this question before, but did not hear from anybody. Can somebody pls help me out. I am creating a table with two fields F1, F2 and F2 has about 50,000 randomly generated alphanumeric...
2
by: sugaray | last post by:
I want to write a school computer billing system, one of the function is to distribute machine id using rand() for each student log on, suppose there's 100 machines, when each person log on, the...
26
by: Jimmy | last post by:
ill have a database with 1 table and 3 fields: ID FIRSTNAME LASTNAME (the ID field will be the auto incrementing index) there might be 10 records in the DB, there might be 10,000. i...
48
by: Jimmy | last post by:
thanks to everyone that helped, unfortunately the code samples people gave me don't work. here is what i have so far: <% Dim oConn, oRS, randNum Randomize() randNum = (CInt(1000 * Rnd) + 1) *...
3
by: John Fairhurst | last post by:
Hi, The following code should select the specified number of records randomly from the database <% .... query = "SELECT FROM " Set RS = Server.CreateObject("ADODB.Recordset")
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.