views:

47

answers:

1

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?

+2  A: 

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.

Jamie Ide
Thanks, I'll go with it, I'll try and confirm what you have said as I go along. Thanks for your help.
Richbits