954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Random Number Code

Hi,

I need a vb.net code that will give me random numbers, which i will save in a database column in a primary key field.

But the code should surely generate the random number.

Thanx & Regards

Anup

anup.maverick
Newbie Poster
16 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

RandomNumber = New System.Random().Next(1, 100);

You'll have to check for duplicates yourself. Any particular reason you want to use this as a PK ?

pritaeas
Posting Expert
Moderator
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

Thats what i am doing now. CHECK FOR DUPLICATES.

If you can tell me the code How to check for Duplicates in vb.net, then i can save my time...


Thanx

anup.maverick
Newbie Poster
16 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: