Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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 January 22nd, 2008, 06:11 AM
Registered User
 
Join Date: Oct 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Incrementing numbers

Hi

Looking for a bit of help. I have a request form that when a user opens a new request it populates the ref number straight away. What I'd like it to do it check the db to see what the last number was and increment it by 1 and that is the new ref number, they can then fill it out and submit it.

However there is also another part where if there was an original request that was rejected, a user can go back and re-submit that request with changes however they don't want it to overwrite the original request so what they'd like to happen is the user can search for their previous request and select it. What it needs to do then is take the original ref number, ie 1001 and add an a, b, c etc on the end to show it is a re-submitted request.

I thought about using auto increment in sql however as I've also got to user alphanumeric characters on the ref numbers I don't think this will allow it. I'm a complete newbie so any help would be greatly appreciated

Thanks


 
Old January 22nd, 2008, 01:22 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

I'm sure there's lots of ways to do this. Here's one idea. Create a table with in SQL with an autoincrement column and a column to insert the users userid, [IDTable], so when the form opens you have the incremented value and its association to the user. When you save the form, save all of the data on the form to a second table [Requests]. The Requests table will have a column for the SubmissionID and a column to mark the resubmissions, Resubmissions, making both the SubmissionID and Resubmissions columns ints.

How many resubmissions are you allowed? The alphabet only has 26 letters and you could possibly run out. Whether there is a finite number of submissions or not you could build an alphabet table with an AlphaID column, int (increment). Make an entry with the ID of 0 with nothing in the Alphabet column before turning on autoincrement. That way on the first submission INSERT in the Requests table the AlphaID column will be 0. Successive submissions will find the matching row for the SubmissionID column. If you get a hit then you know this is a resubmit. Then you can add one (1) to the AlphaID column and insert the second (?) resubmission. When you display the reference number you can cast the SubmissionID as a varchar and concatenate the Alphabet column from the Alphabet table.

Hope this helps.

Richard

 
Old January 30th, 2008, 12:16 AM
Friend of Wrox
 
Join Date: Oct 2007
Posts: 130
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via AIM to urtrivedi
Default

please refer following for identity creation
http://p2p.wrox.com/topic.asp?TOPIC_ID=67898

urt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Incrementing the variable value Swetha XSLT 2 April 28th, 2008 04:43 PM
Incrementing Job Order Numbers marclf Access VBA 3 February 29th, 2008 12:34 PM
Incrementing attribute value Pankaj C XSLT 4 October 31st, 2007 05:40 AM
reading and incrementing a value phantom3008 ASP.NET 1.0 and 1.1 Basics 0 April 18th, 2007 10:29 AM
Incrementing a value within a template Tre XSLT 1 March 21st, 2007 09:31 AM





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