添加觸發器
右擊顼目添加一個觸發器
The file Trigger1.cs:
添加下面的代碼到Trigger1.cs文件中,確保俘的數據庫中存在Person數據表,或者用你數據庫的表替換Person.
using System;
using System.Data;
using System.Data.SqlClIEnt;
using Microsoft.SqlServer.Server;
public partial class Triggers
{
// Enter existing table or vIEw for the target and uncomment the attribute line
[Microsoft.SqlServer.Server.SqlTrigger (Name="Trigger1", Target="Person", Event="FOR UPDATE")]
public static void Trigger1()
{
// Replace with your own code
SqlContext.Pipe.Send("Trigger FIRED");
}
}