请教触发器语句
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
[Microsoft.SqlServer.Server.SqlTrigger(Name="Trigger1",Target="Orders",Event="For DELETE")]
public Static void Trigger1()
{
SqlTriggerContext triggContext=SqlContext.TriggerContext;
SqlParameter MYID=new SqlParamter("@OrderID",System.Data.SqlDbType.BigInt);
if(triggContext.TriggerAction==TriggerAction.Delete)
{
using (SqlConnection conn=new Sqlconnection("context connection=true"))
{
conn.Open();
SqlCommand sqlComm=new SqlCommand();
sqlComm.Connection=conn;
sqlComm.CommandText="SELECT OrderID from DELETED";
MYID.Value=sqlComm.ExecuteScalar().ToString();
sqlComm.CommandText="DELETE FROM [Order Details] WHERE OrderID=@OrderID";
sqlComm.Parameters.Add(MYID);
sqlContext.pipe.send(sqlComm.CommandText);
SqlContext.pipe.ExexuteAndSend(sqlComm);
}
}
}
}
}
请教一下,语句错在那啊
------解决方案--------------------
因为你的结贴率,付出没有回报,俺才不告诉你呢