增加功能:Proc_SaveUsers新建用户增加事务处理

This commit is contained in:
Argo-MacBookPro 2018-09-13 14:44:21 +08:00
parent eb45837bda
commit 7bc98fb336
1 changed files with 4 additions and 2 deletions

View File

@ -192,8 +192,10 @@ BEGIN
begin
if(not exists (select 1 from Users Where UserName = @userName))
begin
Insert Into Users (UserName, [Password], PassSalt, DisplayName, RegisterTime, ApprovedBy, ApprovedTime, [Description]) values (@userName, @password, @passSalt, @displayName, GETDATE(), @approvedBy, @approvedTime, @description)
insert into UserRole (UserID, RoleID) select @@IDENTITY, ID from Roles where RoleName = N'Default'
begin tran
Insert Into Users (UserName, [Password], PassSalt, DisplayName, RegisterTime, ApprovedBy, ApprovedTime, [Description]) values (@userName, @password, @passSalt, @displayName, GETDATE(), @approvedBy, @approvedTime, @description)
insert into UserRole (UserID, RoleID) select @@IDENTITY, ID from Roles where RoleName = N'Default'
commit tran
end
end
END