How do I ensure that a table triggered SP has completed to use the data?


I have within my Sql Server 2008 database a trigger which will run on insert and update to populate a calendar table with dates calculated from the date info in the first table. (i.e. start date, end date, repeating sequence information).

I am using ASP.Net MVC using Linq to Sql to access the Database. My first view is collecting the data to populate the input information, and then I am looking to redirect to a second "results" view which will include the calculated dates.

How do I ensure that the triggered update has completed prior to accessing the database to populate my "results" view?

Is there a better way?

By : Richbits

The trigger operation will be part of the same transaction as the original insert or update that caused the trigger to fire. I don't know Linq2Sql well enough to advise you on how to determine if an operation has completed. With ADO.NET, I believe that the next line of code following an ExecuteNonQuery will not be hit until ExecuteNonQuery completes. I don't think you need to worry about this.

By : Jamie Ide

This video can help you solving your question :)
By: admin