如何在c#asp.net中创建按钮,在该按钮中创建自动增量编号并且标志随之运行 [英] How do I create button in c#asp.net in which it create auto increment number and flag is running along with that

查看:66
本文介绍了如何在c#asp.net中创建按钮,在该按钮中创建自动增量编号并且标志随之运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.





我的尝试:



请帮我们点击按钮创建自动增量编号和其他文本存档注册这个特定的数字,如果它停止任何点,下次当用户想要存储另一个条目首先你必须c对该号码的完整请求,否则生成下一个号码。



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.

推荐答案

你的问题的结构意味着同时有多个进程正在进行,但它根本没有很明显这些过程是如何分配的 - 甚至是他们正在做什么 *

所以除了说:可能,不要之外,几乎不可能给你一个确定的答案。 t。

预分配顺序号通常是一个坏主意 - 在用户环境中总是一个坏主意,ASP.NET暗示 - 而是指定一个临时数字您正在处理ID值(GUID是一个不错的选择),并且只在所有处理完成并且正在进行最终存储时分配序列号。任何其他方法都会出现问题,例如多个用户试图以相同的数字存储,以及当处理因任何原因失败时出现间隙。



如果你真的需要这个,您需要更详细地解释与此要求相关的整个应用程序的结构,或者我们无法提供帮助!请记住,我们无法看到您的屏幕,访问您的硬盘或阅读您的想法 - 我们只能准确地输入您要输入的内容。





*将来,投资标点符号也是一个好主意,并且还要更正句子以提高问题的可读性 - 你有一个充满字符的键盘,所以不使用它们会让你看起来喜欢孩子。
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.


你没有做任何事情来获得自动递增的身份证号码。这最好留给你存储所有内容的数据库。



用户提供了一些打开投诉的详细信息,然后将这些详细信息保存到数据库中,数据库会生成自动编号,您可以将该编号返回给用户显示。



为什么要这样做呢?那么,在多用户环境中,如果两个用户同时启动投诉过程会发生什么?他们可以同时生成相同的增量值。
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.


Quote:

我如何在c#asp.net中创建按钮,在该按钮中创建自动增量编号并且标志正在运行

How do I create button in c#asp.net in which it create auto increment number and flag is running along with that



首先,通过分离关注点来简化操作。 />
任何GUI控件都可以通过调用代码与你的app进行交互,代码是什么并不重要。

所以你的问题是我如何在c#asp中创建函数。它创建自动增量数字和标志的网络正在运行,无论谁调用代码。


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



网页意味着多用户,除了服务器之外生成自动增量编号是一个坏主意,生成数字在需要它之前也是一个坏主意。

坏主意迟早会意味着您最终将拥有多个具有相同编号的用户。

SQL自动增加一个字段 [ ^ ]

一般解决方案是在真正需要它之前不生成数字,让服务器处理细节因为每个用户都引用服务器。


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.


这篇关于如何在c#asp.net中创建按钮,在该按钮中创建自动增量编号并且标志随之运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆