Wednesday, March 7, 2012

RDA Push to a table that has an INSERT Trigger

Hello,

I posted under the Smart Devices VB and C# Projects forum as well, but since my question relates to SQL Server Triggers, I thought I might get some help here too. I apologize if this is not the correct forum.

I am using SQL Server 2005 Standard.

On my PC, on the table that I Push to from the device, I have a Trigger that sends an e-mail upon INSERT.

This trigger works (sends e-mail) when I run an INSERT against the table within management studio, or when I run an INSERT against the table from a web app on the same PC. (I also tested using an UPDATE, and the trigger worked.)

Here is my problem:

The trigger does not kick off after I successfully Push records from the device to the table on my PC.

Here is my c# Push code on the device:

rda.Push("tablename", rdaOleDbConnectString, RdaBatchOption.BatchingOn);

NOTE: I am not having a problem with the actual Push itself. That is working just fine.

On the surface it seems like an INSERT is happening (a new row appears in the table with the trigger), but does the Push do some other kind of action other than a true INSERT?

I can't seem to find anything about what exactly the Push is doing behind the scenes.

Can triggers be set for anything other than UPDATE, INSERT, DELETE?

Any insight would be appreciated.

Thank you.

Patrick

According to this article: http://msdn2.microsoft.com/en-us/library/aa225639(SQL.80).aspx it should work, but you might have to use SET NOCOUNT ON in your trigger (if you already haven't)

If that doesn't work, try using profiler and see what commands are actually being sent.

|||

I realized that the Trigger on the table was causing problems. I decided to remove the trigger on the table I Push into. I then wrote a stored proc to INSERT INTO another table that contains a trigger. This trigger successfully sends the single e-mail.

Now, I want to send multiple e-mails. I'll enter another post.

No comments:

Post a Comment