thats fine..
how could i generate unique reference number for each users
please tel me knw

thank u
On Aug 12, 12:24 am, The_Fruitman <[email protected]> wrote:
> I would be careful in using a random number as a reference number.
> Generally, reference numbers must be unique in order to be
> meaningful.  The random class does not guarantee uniqueness.
>
> http://msdn.microsoft.com/en-us/library/system.random.aspx
>
> "The random number generation starts from a seed value. If the same
> seed is used repeatedly, the same series of numbers is generated."
>
> While Microsoft suggests: "One way to produce different sequences is
> to make the seed value time-dependent, thereby producing a different
> series with each new instance of Random. By default, the parameterless
> constructor of the Random class uses the system clock to generate its
> seed value, while its parameterized constructor can take an Int32
> value based on the number of ticks in the current time."
>
> They also note: "However, because the clock has finite resolution,
> using the parameterless constructor to create different Random objects
> in close succession creates random number generators that produce
> identical sequences of random numbers."
>
> You could generate the reference number multiple other ways such as
> hashing the user's information along with the datetime, GUIDs, etc.
> You should also add checking to verify that you have generated a
> unique reference number before displaying it to the user.
>
> On Aug 11, 10:10 am, zuma <[email protected]> wrote:
>
>
>
> > hi nelson u can do it using random class
>
> > Random ref=new Random();
> > string reference=Convert.ToString(ref.next());
>
> > now u have the reference number
>
> > now u want to display it
>
> > if u will display it in other page sure u will send it using querystring
> > response.redirect("~/page.aspx?ref="+ reference);
>
> > else if u want to display it on the same page
> > so u can assign a label control to ur reference number
>
> > i hope this helped u
>
> > On Tue, Aug 11, 2009 at 3:52 PM, Nelson <[email protected]> wrote:
>
> > > hi friends
> > > im new to .net
> > > i hve a form in which user wil fill and the fields like
> > > fname,lmane,address ..etc when user click submit i want to genarate
> > > and display referance number in a user form for particualar user
>
> > > please help me
>
> > --
> > there's nothing worse than having to get up and moving early

Reply via email to