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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top