This is my very first trigger and I'm not sure I have it set up correctly. I have a table called PayTypes. Here is my trigger syntax:

ALTER trigger payTypes_trigger
    on PayTypes
    AFTER INSERT, UPDATE, DELETE
    s
    PRINT 'AFTER TRIGGER EXECUTED SUCESSFULLY'

I run this with a breakpoint on the first line, update my VB.NET datagridview (which updates and saves just fine), but the breakpoint never gets hit.

Am I going about the setup of the trigger incorrectly?

What do you mean you run this with a breakpoint?
Are you inserting,deleting,updating,altering the trigger?

I inserted a breakpoint into the procedure in Visual Studio, just like I insert breakpoints into my VB code when I want to see if something fires. Then I run the program, insert something into the table, and the breakpoint never gets hit.

Can I expect a breakpoint to hit in a trigger procedure? I assumed so since Visual Studio let me put one in there...

I was doing some research and got to the point where it looks like it is firing, but I am getting "no symbols have been loaded for this document" as a warning box on the procedure. I'm in the middle of looking into that now...

Sorry Chris. Bad copy/paste.

I created a stored procedure to go along with this, but am unsure how to go about getting the trigger to fire. Does it have to be called from the stored procedure?

Yeah, I'm getting the feeling I am going about this incorrectly. I see lots of syntax in the examples you sent, but I am still a little dense on the subject. How do I test to find out why the trigger isn't firing if I can't set breakpoints?

Since you've started on the wrong foot, I'd suggest you verify that you've created your trigger in the target table. To do that use management studio.
If the trigger is there, try it by inserting something from the management studio using an insert query (and not the GUI). It might be the case that you are expeting the message to return where it can't (not listening for a result like with an executenonquery).

Edited 4 Years Ago by adam_k: n/a

This article has been dead for over six months. Start a new discussion instead.