Passing around a SqlConnection

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-05-20T20:48:38Z Indexed on 2010/05/20 20:50 UTC
Read the original article Hit count: 185

Filed under:
|

I have created a TransactionScope and within the scope various items are created and updated in the database. During this process I make a lot of calls to the database. Originally I opened a SqlConnection in the beginning of the TransactionScope and passed it around to any function that made a DB call then I closed the connection after all the calls are made and before the transaction commits. Is it better to do this or to open and close a connection for each call?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about sqlconnection