none
ADO.Net Disconnecting Before Insert Command Kicks off Triggers RRS feed

  • Question

  • I have a bit of code that inserts a row within a table.  The code is not disconnecting and closing until the triggers that are associated with the table run.

     

    Is there anyway in my Code to insert the row of data and disconnect before the triggers run?

     

    Thank you!

    Tuesday, January 4, 2011 1:21 AM

Answers

  • i don't think this is possible, because once query is fired from ADO.Net  rest of the control is with DBServer. Triggers are associated with DB Services so  there is no way you can control it from ADO.net.  You can put additional validation in Trigger to restrict it being fired in such situation. Or is it something like, Trigger executing something unexpected due to ADO.Net operation?, are you thinking the sequence of query being fired from Adapter causing problem?, if yes you can control the execution sequence. there are ways!
    Tuesday, January 4, 2011 3:42 AM
  • I believe Yes, Triggers are being executed as part of Delete/Update and Insert command.
    Tuesday, January 4, 2011 4:07 AM

All replies

  • i don't think this is possible, because once query is fired from ADO.Net  rest of the control is with DBServer. Triggers are associated with DB Services so  there is no way you can control it from ADO.net.  You can put additional validation in Trigger to restrict it being fired in such situation. Or is it something like, Trigger executing something unexpected due to ADO.Net operation?, are you thinking the sequence of query being fired from Adapter causing problem?, if yes you can control the execution sequence. there are ways!
    Tuesday, January 4, 2011 3:42 AM
  • so just for clarification.. my vb.net app this is inserting a record in a table cannot disconnect before the trigger executes

     

    Because the vb.net app is not closing until all of the triggers execute...once they are completed the vb.net app closes

     

    So this is normal?


    Daniel Stiefel
    Tuesday, January 4, 2011 3:46 AM
  • I believe Yes, Triggers are being executed as part of Delete/Update and Insert command.
    Tuesday, January 4, 2011 4:07 AM
  • Thank you so much!!!
    Daniel Stiefel
    Tuesday, January 4, 2011 4:21 AM