Multi-User ASP.NET App and the connection object

  • Thread starter Thread starter klj_mcsd
  • Start date Start date
K

klj_mcsd

Alright just to get this clear in my head. Which construct is better?


Function getData1()

'Open New Connection object

......


'Close New Connection object

End function


Or


Function getData2()

'Get Shared Connection object


If cn.State = "Open" then


'Use Connection

'Close shared connection

end function

I think you understand where I'm getting at. Thanks
 
Alright just to get this clear in my head. Which construct is better?


Since connection objects are pooled, I'd say split the logic up into tiers..
:P Maybe not the answer you were looking for...

Anywho, create a new connection and open it everytime you need access to a
database record. Unless you are doing mass updates at once, this is the
recommended way of doing it ;)

Mythran
 
Thanks! That is what I thought but I read somewhere that you should be
using a shared connection object throughtout your application.
 
Back
Top