create procedure AddUserInfo
@LoginName varchar(50),
@Password varchar(50),
@Remark varchar(200),
@RealName varchar(50),
@RoleID int,
@lastID int output
as
begin tran
insert into dbo.SysUserInfo(LoginName,[Password],Remark,RealName) values(@LoginName,@Password,@Remark,@RealName)
select @lastID=scope_identity()
insert into UserRoleInfo(UserInfoAutoID,RoleInfoAutoID) values(@lastID,@RoleID)
if @@error<>0
begin
rollback tran
end
else
begin
commit tran
end
go
@LoginName varchar(50),
@Password varchar(50),
@Remark varchar(200),
@RealName varchar(50),
@RoleID int,
@lastID int output
as
begin tran
insert into dbo.SysUserInfo(LoginName,[Password],Remark,RealName) values(@LoginName,@Password,@Remark,@RealName)
select @lastID=scope_identity()
insert into UserRoleInfo(UserInfoAutoID,RoleInfoAutoID) values(@lastID,@RoleID)
if @@error<>0
begin
rollback tran
end
else
begin
commit tran
end
go