Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.
This is my update command used on the front end Gridview that that is associated to a drop down that a user selects within the griview:
USE [Abc] GO /****** Object: Trigger [dbo].[EmailRule1] Script Date: 3/3/2014 4:18:49 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER TRIGGER [dbo].[EmailRule1] ON [dbo].[Demographics1] AFTER UPDATE AS -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; --Makes sure that the decision was changed IF NOT UPDATE(DDecision) RETURN IF EXISTS(SELECT * FROM inserted a join deleted b on a.RFSID=b.RFSID WHERE ((B.DDecision <> 'RuleA' OR B.DDecision <> 'RuleB') AND b.IsComplete = 0) AND ((A.DDecision='RuleA' or A.DDecision='RuleB') AND A.IsComplete = 0)) BEGIN DECLARE @newDEmail varchar(64) DECLARE @newDFirst varchar(64) DECLARE @newDLast varchar(64) DECLARE @EmailBody varchar(MAX) -- Insert statements for trigger here SELECT @newDEmail=a.DEmail, @newDFirst=a.DFirst,@newDLast=a.DLast from inserted a join deleted b on a.RFSID=b.RFSID WHERE (B.DDecision <> 'RuleA' OR B.DDecision <> 'RuleB') and (a.DDecision='RuleB' or a.DDecision='RuleA') SET @EmailBody = ' Dear '+ @newDFirst + ' '+ @newDLast + ', Email message ' EXEC msdb.dbo.sp_send_dbmail @profile_name ='Abc', @from_address = '"Abc" <firstname.lastname@example.org>', @reply_to = email@example.com', @copy_recipients = ‘firstname.lastname@example.org', @blind_copy_recipients = ‘email@example.com’, @recipients = @newDEmail, @subject = 'Abc Application Eligibility', @body =@EmailBody END
UpdateCommand="UPDATE [Demographics1] SET [DWID] = @DWID, [DFirst] = @DFirst, [DLast] = @DLast, [DSubmitDate] = @DSubmitDate, [DDecision] = @DDecision, [DIsActive] = @DIsActive, [IsComplete] = @IsComplete WHERE [RFSID] = @RFSID">
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
17 Experts available now in Live!