Solved

VBScript should generater random names but it selects the same peole each time

Posted on 2009-05-11
4
191 Views
Last Modified: 2012-05-06
Hello, the attached vbscript is supposed to generate a random selection of names each time. Instead it is selecting the same names.

Thank you for your help.

Wendy
code-Random.txt
0
Comment
Question by:SimonSaysSQL
  • 2
4 Comments
 
LVL 25

Expert Comment

by:SStory
ID: 24356095
I see nothing in your solution that would make anything random.  It goes to a table and gets data.  The data is the same.  You should either write a stored procedure if this is SQL Server that gets a random number of rows, or if the list isn't very long, you could get all of rows and use the basic RND function to choose random numbers and get those elements of the local collection or array where you stored the incoming rows.
0
 

Author Comment

by:SimonSaysSQL
ID: 24356487
S Story,
You are correct It is pulling data from a View. Apparently when you run the View in a Query it works and gives random data but when it is run with this code it keeps giving the same names.
I just found this out or I would have included it in the original message.
Thanks.
 
0
 
LVL 25

Accepted Solution

by:
SStory earned 500 total points
ID: 24359266
Well your code just says get the top x results from that table or view. That will always get the same top x results unless there is some radomizing code in the view because the CODE you showed doesn't randomize.  I think a stored procedure that can be called that does the randomization might be better.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now