Begin and commit transaction

  • Thread starter Thread starter Ken Tucker [MVP]
  • Start date Start date
K

Ken Tucker [MVP]

Hi,

http://msdn.microsoft.com/library/d...stemdatasqlclientsqltransactionclasstopic.asp

Ken
----------------
Hello

I am writing an ASP.NET / SQL-Server application and wanting to know when to
connect/begin-transaction and commit/disconnect.

I have a common module which I call at the beginning of Page_Load which,
when instantiated performs the connect/begin-transaction. The page then
does what it has to do (eg when a Save button is clicked it will do a
read/write to the database within the btnSave_Clicked event). At the end of
the 'event' (eg btnSave_Clicked) I then do a commit/disconnect.

My question is, is this when the commit/disconnect should be called or is
there an event within the page that gets fired after all click events have
been run and just before the page displays. I know there's a finalize but
is this where these types of tasks are performed.

Or is there another easier/standardized way this is all done.

Cheers
Horace
 
Hello

I am writing an ASP.NET / SQL-Server application and wanting to know when to
connect/begin-transaction and commit/disconnect.

I have a common module which I call at the beginning of Page_Load which,
when instantiated performs the connect/begin-transaction. The page then
does what it has to do (eg when a Save button is clicked it will do a
read/write to the database within the btnSave_Clicked event). At the end of
the 'event' (eg btnSave_Clicked) I then do a commit/disconnect.

My question is, is this when the commit/disconnect should be called or is
there an event within the page that gets fired after all click events have
been run and just before the page displays. I know there's a finalize but
is this where these types of tasks are performed.

Or is there another easier/standardized way this is all done.

Cheers
Horace
 
Back
Top