Click here to Skip to main content
15,893,337 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
please help me guys on click button create auto increment number and other text filed register on this particular number and if it halt any point and next time when user want to store another entry first you have to complete request on that number otherwise next number generated.

This is basically complaint register web page with one login where i want to generate auto increment complaint number in each entry along with these text box (name,empid,prob,description ).however because of some reason if this one process is not complete on particular complaint number then its generate a flag in back end so that complaint number will not get incremented for next entry.


What I have tried:

please help me guys on click button create auto increment number and other text filed register on this particular number and if it halt any point and next time when user want to store another entry first you have to complete request on that number otherwise next number generated.
Posted
Updated 6-May-19 4:34am
v2
Comments
Christian Graus 6-May-19 2:47am    
Just to add, are you REALLY using ASP.NET and not MVC?
F-ES Sitecore 6-May-19 6:45am    
MVC is also asp.net. You're getting asp.net and webforms mixed up.
Dave Kreskowiak 6-May-19 10:03am    
I'll say Christian isn't getting it confused.
F-ES Sitecore 6-May-19 11:05am    
Thanks for sharing your opinion ;)
Christian Graus 6-May-19 18:22pm    
Well, sure. MVC is built on ASP.NET, and you can host both in the one place. I know all that. I was using ASP.NET in 2001

The structure of your question implies that there are multiple processes in play at teh same time, but it's not at all obvious how these processes are distributed - or even what they are doing*
So it's pretty much impossible to give you a definitive answer, except to say: "probably, don't".
It's generally a bad idea to "pre-assign" sequential numbers - and always a bad idea in a multi-user environment, which "ASP.NET" implies - instead, assign a temporary ID value (A GUID is a good choice) while you are processing, and only assign a sequence number when all processing is complete and final storage is being done. Any other approach gives problems such as multiple users trying to store under the same number, and "gaps" when the processing fails for whatever reason.

If you genuinely need this, you will need to explain in much better detail the structure of your whole app that relates to this requirement or there isn;t much we can do to help! Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.


* In future, it's a good idea to invest in punctuation, and also correct sentence case to improve the readability of your question - you have a keyboard full of characters so not using them makes you look like a child.
 
Share this answer
 
Comments
abhipagal10 6-May-19 6:53am    
This is basically complaint register web page with one login where i want to generate auto increment complaint number in each entry along with these text box (name,empid,prob,description ).however because of some reason if this one process is not complete on particular complaint number then its generate a flag in back end so that complaint number will not get incremented for next entry.
YOU don't do anything to get an auto-incremented Id number. That is best left up to the database you're storing everything in.

The user gives you some details to open the complaint, you then save those details to the database, the database generates the auto-number, and you can get that number back to show to the user.

Why should it be done like this? Well, in a multi-user environment, what happens if two users start the complain process at the same time? There is a decent chance they can BOTH generate the same incremented value at the same time.
 
Share this answer
 
Quote:
How do I create button in c#asp.net in which it create auto increment number and flag is running along with that

First of all, simplify things by separating concerns.
Any GUI control interact with your app by calling code, it doesn't matter what do the code.
So your problem is "How do I create function in c#asp.net in which it create auto increment number and flag is running along with that", no matter who call the code.
Quote:
This is basically complaint register web page

Web page imply multiuser, and generating an "auto increment number" otherwise than "by server" is a bad idea, generating the number before needing it is also a bad idea.
Bad idea mean that sooner or later, you will end up with multiple users having same number.
SQL AUTO INCREMENT a Field[^]
The general solution is to not generate the number before you really need it, and let the server handling details because every user refer to server.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900