Rotating Search...

Results 1 to 3 of 3

Thread: Rotating Search...

  1. #1
    Join Date
    Dec 1969

    Default Rotating Search...

    I want to build a search with rotating capabilities. For example, I have a datbase of 100 clients and the search has a rotation of 10 users for each search. After a client is found using the search he/she will be flagged and won't show up on the next rotation until the whole database cycle has been rotated and hit. After they all have been hit and flagged, the flags will be reset and the whole cycle starts over again. Do you think you can help me with this? I have tried a couple of logic, but they don't seem to have the out come I like. Please help. Thank you very much for your time.

  2. #2
    Join Date
    Dec 1969

    Default Pretty easy...

    &#060;%<BR>... make your DB connection ...<BR><BR>basequery = "SELECT TOP 10 * FROM table WHERE flagged=0 ORDER BY recID"<BR>Set RS1 = conn.Execute(basequery)<BR>If RS1.EOF Then<BR>&nbsp; &nbsp; &#039; everybody must be flagged, since we get no records!<BR>&nbsp; &nbsp; &#039; so set *all* flags back to zero...<BR>&nbsp; &nbsp; conn.Execute("UPDATE table SET flagged=0")<BR>&nbsp; &nbsp; &#039; and try again...<BR>&nbsp; &nbsp; Set RS1 = conn.Execute(basequery)<BR>End If<BR>&#039; mark those 10 as flagged...<BR>conn.Execute( "UPDATE table SET flagged=1 WHERE recID IN( " _<BR>&nbsp; &nbsp; &nbsp; & "SELECT TOP 10 recID FROM table WHERE flagged=0 ORDER BY recID )" )<BR>...<BR>%&#062;<BR><BR>You might want to lock the db or app for the length of time it takes to do that, else two users hitting at the same time *could* mess you up.<BR><BR>But if you truly have only 100 records you want to this to, I&#039;d do it all in Application variables and avoid the hit of going to the DB each time. See the ASPFAQs and the category "Application Object".<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: Rotating Search...


Posting Permissions

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