Trying to get a random rand

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Trying to get a random rand

    I have an interesting problem. Im trying to get a range
    of random rows from an access db. I have no problems in
    returning the random range the problem is that it is
    always the same random rand in the same random order.


    What becomes interesting is that if I use the DTC record
    with the implementation/no Cache selected.

    The random query returns truly random and different
    results to all users.

    What is the DTC doing and what can I do the the following
    to get it to return truly random results instead of
    pedictable random results:

    sql="SELECT top 5 someID " &_
    "FROM sometable " &_
    "ORDER BY rnd(someID) "

    dbname = "\thedb.mdb"

    ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;data
    source="
    ConnStr = ConnStr & Server.MapPath("theDBlocation")
    & dbname

    set connection=Server.CreateObject("ADODB.Connection")
    Set recordset=Server.CreateObject
    ("ADODB.Recordset")
    connection.open ConnStr
    recordset.Open sql,connection,1,2

    marcel Guest

  2. Similar Questions and Discussions

    1. rand()
      I've built a page in Dreamweaver (php) pulling records from mysql with rand() order, displaying 1 record at a time with a navigation pane, it...
    2. what is rand?
      Often, I see something called "rand" or ".rand" or "rnd" in url query parameter, for example in yahoo mail url. E.g. ...
    3. Using Math.random to go to random frames
      Hello everyone. My cerebral density is preventing me from seeing the solution to this problem. I have the following code which causes the user to...
    4. Using rand() for 10 digit numbers????
      Hi! I looked at the rand() at php.net which spoke about min and max random number. So, I use rand(0,9999999999) to get a 10 digit random number...
    5. Random image in a random place.
      Anyone know javascript? I have a grid(4 x 4) of 16 spacer images and a few text links on the side. Each text link represents a different folder of...
  3. #2

    Default Re: Trying to get a random rand

    I don't think that works because the random number seed is cached, and
    re-used for each subsequent query...

    I'm not sure what information is being transmitted using the DTC (the
    no-cache option looks like what you need!)

    Cheers
    Ken

    "marcel" <marcel@edmedia.com.au> wrote in message
    news:052d01c36531$c4ad4b00$a101280a@phx.gbl...
    : I have an interesting problem. Im trying to get a range
    : of random rows from an access db. I have no problems in
    : returning the random range the problem is that it is
    : always the same random rand in the same random order.
    :
    :
    : What becomes interesting is that if I use the DTC record
    : with the implementation/no Cache selected.
    :
    : The random query returns truly random and different
    : results to all users.
    :
    : What is the DTC doing and what can I do the the following
    : to get it to return truly random results instead of
    : pedictable random results:
    :
    : sql="SELECT top 5 someID " &_
    : "FROM sometable " &_
    : "ORDER BY rnd(someID) "
    :
    : dbname = "\thedb.mdb"
    :
    : ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;data
    : source="
    : ConnStr = ConnStr & Server.MapPath("theDBlocation")
    : & dbname
    :
    : set connection=Server.CreateObject("ADODB.Connection")
    : Set recordset=Server.CreateObject
    : ("ADODB.Recordset")
    : connection.open ConnStr
    : recordset.Open sql,connection,1,2
    :


    Ken Schaefer Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139