I try to set up a testing sample table which contain one integer project_ID field for table Sample around 500 records, and want the project_ID to be random number within 1 to 99, how to implement script todo it?
thanks!
Here you go !using System
namespace x {
classe y {
public y () {}
public int getRandomID () {
Random r = new Random()
return r.Next(1,99); // this indicates the start and end limit of the random function
}
}
}
then use the returned value into your SQL query to generate the records... make sure you dont have the project_ID as primary key as this above code does not check for uniqueness of the generated number....
HTH
No comments:
Post a Comment