S
simon
I have:
public class Triggers
{
[SqlTrigger (Name="TrrPerson.ContactType", Target="Person.ContactType", Event="FOR INSERT")]
public static void MyTrigger()
{
SqlTriggerContext oTriggerContext = SqlContext.GetTriggerContext();
SqlPipe sPipe = SqlContext.GetPipe();
SqlCommand sqlCmd = SqlContext.GetCommand();
if (oTriggerContext.TriggerAction == TriggerAction.Insert)
sqlCmd.CommandText = "select * FROM inserted";
sPipe.Execute(sqlCmd);
}
}
If I click: Build - Deploy MyCLRDLL i get message:
Deploy failed.
If I comment the line:
//[SqlTrigger (Name="TrrPerson.ContactType", Target="Person.ContactType", Event="FOR INSERT")]
and deploy again it works.
If I execute the statement:
CREATE TRIGGER MyTrigger ON Person.ContactType
FOR INSERT
AS
EXTERNAL NAME MyCLRDLL.Triggers.MyTrigger
than it works, the trigger is added. Why?
Than if I insert something:
insert INTO Person.ContactType
VALUES(21,'Big boss','20040503')
the insert executes but I don't get a contents of the inserted row in my mesage window of SQL server management studio.
I think I should.
Thank you,
Simon
public class Triggers
{
[SqlTrigger (Name="TrrPerson.ContactType", Target="Person.ContactType", Event="FOR INSERT")]
public static void MyTrigger()
{
SqlTriggerContext oTriggerContext = SqlContext.GetTriggerContext();
SqlPipe sPipe = SqlContext.GetPipe();
SqlCommand sqlCmd = SqlContext.GetCommand();
if (oTriggerContext.TriggerAction == TriggerAction.Insert)
sqlCmd.CommandText = "select * FROM inserted";
sPipe.Execute(sqlCmd);
}
}
If I click: Build - Deploy MyCLRDLL i get message:
Deploy failed.
If I comment the line:
//[SqlTrigger (Name="TrrPerson.ContactType", Target="Person.ContactType", Event="FOR INSERT")]
and deploy again it works.
If I execute the statement:
CREATE TRIGGER MyTrigger ON Person.ContactType
FOR INSERT
AS
EXTERNAL NAME MyCLRDLL.Triggers.MyTrigger
than it works, the trigger is added. Why?
Than if I insert something:
insert INTO Person.ContactType
VALUES(21,'Big boss','20040503')
the insert executes but I don't get a contents of the inserted row in my mesage window of SQL server management studio.
I think I should.
Thank you,
Simon