SQL触发器不会通过asp.net应用程序触发

时间:2014-04-23 12:19:10

标签: asp.net sql triggers

触发器不会触发。一个asp.net应用程序试图插入一个记录,该记录应该触发此触发器,但它无法触发。使用Windows 2008R2,框架4.5。这是触发器:

ALTER TRIGGER [dbo].[trgAfterInsert] ON [dbo].[AspNetUsers] 
with execute as owner
FOR INSERT
AS

declare @email nvarchar(128),
@ID nvarchar(128)

select @email = i.Email,
@ID = i.Id 
from inserted i;    

insert into LoginHistory
([Email],[LoginID])
Values 
(@email, @ID)

insert into AspNetUserRoles
(userID,RoleID)
select @ID, AspNetRoleID from ConfirmedRoles
where email = @email

上运行alter database TestDB set trustedworthy

0 个答案:

没有答案