且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Vb.net自动增量和SQL SERVER身份增量

更新时间:2023-02-12 08:15:54

显然,您需要编写代码来支持多用户/多线程环境.由于您没有说这是用于Windows还是Web,因此很难给出确切的建议,但是,使用单例模式进行数据访问将为添加记录和获取新ID提供一个位置.您还可以并且应该使用存储过程返回SCOPE_IDENTITY().
Well you obviously need to write your code to support multi-user/multi-threading environment. Since you didn''t say if this was for Windows or Web its difficult to give exact advice, however, using a singleton pattern for data access will give one place to add records and get new id''s. You could also, and should be using, a stored procedure the returns SCOPE_IDENTITY().