jasonsalas
IS-IT--Management
Hi everyone,
I wrote something yesterday:
thread333-157833 returning a random record. I modified my script so that I'm just returning a random number.
<%
Randomize
Dim TotalWinners
Dim random
TotalWinners = CInt(10) ' this would be the total number of winning records..this will be variable
random = Int((TotalWinners - 1 + 1) * Rnd + 1)
' formula:
' Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
Response.Write("This is the winning record's Nth value: " & random)
I was wondering if anyone has any idead on how to return a "Nth" record from a recordset, and not necessarily the precise record by ID. For example, if the total number of records in the my script generates the number "10", I want to have a SQL statement pull the 10th record in the recordset, and not necessarily the record with ID "10" as the unique key field. Thus, that paerticular record may have ID 7,895, or 13...it won't matter, because the record will be precise.
Something like this:
SELECT * FROM tblEntries WHERE EntryID = '" & random & "'"
Thanks!
I wrote something yesterday:
thread333-157833 returning a random record. I modified my script so that I'm just returning a random number.
<%
Randomize
Dim TotalWinners
Dim random
TotalWinners = CInt(10) ' this would be the total number of winning records..this will be variable
random = Int((TotalWinners - 1 + 1) * Rnd + 1)
' formula:
' Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
Response.Write("This is the winning record's Nth value: " & random)
I was wondering if anyone has any idead on how to return a "Nth" record from a recordset, and not necessarily the precise record by ID. For example, if the total number of records in the my script generates the number "10", I want to have a SQL statement pull the 10th record in the recordset, and not necessarily the record with ID "10" as the unique key field. Thus, that paerticular record may have ID 7,895, or 13...it won't matter, because the record will be precise.
Something like this:
SELECT * FROM tblEntries WHERE EntryID = '" & random & "'"
Thanks!