Generating a unique random number
<p>I am entering student id as a randon number into the DB </p>

<pre><code>  int num = r.Next(1000);
  Session["number"] = "SN" + (" ") + num.ToString();
</code></pre>

<p>But is there any chance of getting a duplicate number?How can i avoid this?</p>

<p>EDIT :: I have a identity column and the student id is separate from the ID,i am going to enter a random student id into the DB from UI. </p>
