如何根据前一个实例增加字段值 [英] How to increment the field value based on the previous instance
问题描述
我有一个要求,在应用程序中,无论何时用户创建新实例,它都应自动分配数字值。例如,如果我们填写一些细节并保存。稍后另一个人将创建一个新实例填充详细信息并保存。那么,对于当前实例,它应该将Instance字段值赋值为2(前一个为1)。
它应该根据之前的值递增。
请告诉我工作流程或如何操作?
我尝试过:
我不确定如何把这些东西连成一个。任何帮助将不胜感激,并提前感谢。
Hi,
I have a requirement where in an application, whenever user creates a new instance, it should assign the number value automatically. For Example, If we fill some details and save. Later another person will create a new instance fill the details and save it. then, for the current instance it should the assign the Instance field value to 2 (as previous one is 1).
It should increment based on the previous value.
Please let me know the workflow or how to do it?
What I have tried:
I'm not sure on this how to link up these all thing into one. Any help will be appreciated and thanks in advance.
推荐答案
一般来说,不要。
这是可能的,但在大多数情况下它是一个坏主意。我假设您正在使用某种形式的数据库,如果是这样,那么您将发现数据库中内置的功能:复制,这是软件投入生产后真正问题的处方。对于数据库,请参阅SQL IDENTITY字段: IDENTITY(属性)(Transact-SQL) [ ^ ]
Generally speaking, don't.
It's possible, but in most cases it's a bad idea. I assume you are using a database of some form, and if so then you will find the capability built into the DB: duplicating that is a recipe for real problems once software gets into production. For a DB, see the SQL IDENTITY field: IDENTITY (Property) (Transact-SQL)[^]
>
这篇关于如何根据前一个实例增加字段值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!