|
 |
asp_databases thread: Re: random numbers
Message #1 by "Vincent Vandermeeren \(mailinglists Only\)" <vinnie@j...> on Tue, 2 Jul 2002 18:22:55 +0200
|
|
You can read the last ID nr of that field and add 1 number to it ...
Greetings,
Vinnie
----- Original Message -----
From: "arshad siddiqui" <ash_arshad@y...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, July 02, 2002 12:13 PM
Subject: [asp_databases] random numbers
> Hi,
> How can I generate a random no.
> Suppose I want to make a form in which if a particular
> field is left blank then the program should generate a
> unique no and if possible the number should be in a
> particular format i.e like 00000001 and this no will
> be stored in the database.next time it should generate
> a differnt number like 00000002.
> can any body give me some ideas.
> Thanks
> Regards
> --Arshad--
>
> __________________________________________________
> Do You Yahoo!?
> Sign up for SBC Yahoo! Dial - First Month Free
> http://sbc.yahoo.com
>
>
Message #2 by d.van.herk@w... on Tue, 2 Jul 2002 12:21:57 +0200
|
|
It's better that you set up a column in the database which is
controlled by the database. This column has to use an identity.
This means it automaticaly generates a number which is unique.
The format you can handle in your ASP-page.
In this case it should be possible to remove the field as the
database controls the number from now on.
Greetings Dennis
ps I hope you'll understand.
> Hi,
> How can I generate a random no.
> Suppose I want to make a form in which if a particular
> field is left blank then the program should generate a
> unique no and if possible the number should be in a
> particular format i.e like 00000001 and this no will
> be stored in the database.next time it should generate
> a differnt number like 00000002.
> can any body give me some ideas.
> Thanks
> Regards
> --Arshad--
>
> __________________________________________________
> Do You Yahoo!?
> Sign up for SBC Yahoo! Dial - First Month Free
> http://sbc.yahoo.com
>
>
>
Message #3 by "Kim Iwan Hansen" <kimiwan@k...> on Tue, 2 Jul 2002 14:07:39 +0200
|
|
00000001, 00000002, 00000003 is *not* a random number sequence (or at least
does not appear to be - it could happen).
If you want a random number, look up the Rnd() function in the vbscript
documentation.
If you don't want random numbers, but instead the 01, 02 ,03 etc. sequence,
you should do Dennis suggests.
-Kim
> -----Original Message-----
> From: d.van.herk@w... [mailto:d.van.herk@w...]
> Sent: 2. juli 2002 12:22
> To: ASP Databases
> Subject: [asp_databases] Re: random numbers
>
>
> It's better that you set up a column in the database which is
> controlled by the database. This column has to use an identity.
> This means it automaticaly generates a number which is unique.
> The format you can handle in your ASP-page.
>
> In this case it should be possible to remove the field as the
> database controls the number from now on.
>
> Greetings Dennis
>
> ps I hope you'll understand.
>
>
> > Hi,
> > How can I generate a random no.
> > Suppose I want to make a form in which if a particular
> > field is left blank then the program should generate a
> > unique no and if possible the number should be in a
> > particular format i.e like 00000001 and this no will
> > be stored in the database.next time it should generate
> > a differnt number like 00000002.
> > can any body give me some ideas.
> > Thanks
> > Regards
> > --Arshad--
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Sign up for SBC Yahoo! Dial - First Month Free
> > http://sbc.yahoo.com
> >
> >
> >
>
>
>
>
Message #4 by arshad siddiqui <ash_arshad@y...> on Tue, 2 Jul 2002 03:13:50 -0700 (PDT)
|
|
Hi,
How can I generate a random no.
Suppose I want to make a form in which if a particular
field is left blank then the program should generate a
unique no and if possible the number should be in a
particular format i.e like 00000001 and this no will
be stored in the database.next time it should generate
a differnt number like 00000002.
can any body give me some ideas.
Thanks
Regards
--Arshad--
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
Message #5 by arshad siddiqui <ash_arshad@y...> on Mon, 8 Jul 2002 00:51:59 -0700 (PDT)
|
|
Hi,
I got few answers.
Thanks for that but it is still not clear to
me.Actually I want to generate a unique random number
whenever user submits the form if one of the field in
the form(user no) is left blank and this random number
will go into the database so there should not be
duplicate entries into the table.
can anyone suggest me what to do in this regard.
Thank You all in advance
Regards
--Arshad--
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
Message #6 by "Mark Anderson" <marke.anderson@b...> on Mon, 8 Jul 2002 09:14:34 +0100
|
|
You could try using the SessionID, although not Random it is fairly unique!
Mark Anderson
01202 775483
07802 404838 mob
Web Development and database design
mailto:mark@a...
http://www.anderson.uk.com
-----Original Message-----
From: arshad siddiqui [mailto:ash_arshad@y...]
Sent: 08 July 2002 08:52
To: ASP Databases
Subject: [asp_databases] Random Numbers
Hi,
I got few answers.
Thanks for that but it is still not clear to
me.Actually I want to generate a unique random number
whenever user submits the form if one of the field in
the form(user no) is left blank and this random number
will go into the database so there should not be
duplicate entries into the table.
can anyone suggest me what to do in this regard.
Thank You all in advance
Regards
--Arshad--
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
|
|
 |