Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 4th, 2007, 02:30 PM
Registered User
 
Join Date: Mar 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to ceate a unique number on a web form

hi im a student n makin a web site in which i want to display a unique identification number on page load...
also this number generated should be posted n saved to database as a recipt number...
i m not getting a way out of creation of this number trap...
can anyone help me out so that i may be able to create this number on top of the page...
any help would be gr8..

thanks
abhishek
 
Old March 4th, 2007, 03:52 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

You can use the Random class, however, you are bound to have duplicate ids since the random is just that, random.

I would suggest using an auto number from a database as your recipet number.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old March 5th, 2007, 05:26 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hey Parsons

How bout using GUID, to test, an example is as below:

Response.Write(System.Guid.NewGuid());



Regards
Mike

Fortune favours the brave, so don't regret on missed oppurtunities.
 
Old March 5th, 2007, 07:10 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

A GUID would work, however, that is not a very user friendly number to present to a user as a recipet number.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old March 5th, 2007, 07:47 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Ya

I agree with you, its really odd to display such a huge combination of alphanumeric string, & I agree that auto number should be used to maintain this requirement.

Regards
Mike

Fortune favours the brave, so don't regret on missed oppurtunities.





Similar Threads
Thread Thread Starter Forum Replies Last Post
unique attribute names for form elements fishmonkey XSLT 3 March 16th, 2008 07:46 PM
passing unique record from form to form Baconant Beginning VB 6 1 January 2nd, 2008 06:20 PM
how to display a unique number in a web form abhishek0807 ASP.NET 2.0 Professional 0 March 4th, 2007 02:12 PM
Copy auto number value to another form bamajog Access 11 February 10th, 2006 10:24 AM
unique name for Web site anshul Linux 0 December 30th, 2004 07:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.