3

Possible Duplicate:
Why always close Database connection?

I usually use VS2010 and ASP.NET to develop my web projects, also my host providers often give me access to SQL Server 2008, I have a general question regarding connection close, should I always close my SQL connection after I'm done with SQL? what happens if I do NOT close my connection? is it harmful?

thanks

Community
  • 1
  • 1
Ali_dotNet
  • 3,219
  • 10
  • 64
  • 115

3 Answers3

2

Microsoft strongly recommends that you always close the connection when you are finished using it so that the connection will be returned to the pool. You can do this using either the Close or Dispose methods of the Connection object, connections are released back into the pool when they are closed or disposed.

Read about connection pooling

CloudyMarble
  • 36,908
  • 70
  • 97
  • 130
1

I think you might get your appropriate answer here, thanks for your time.

Community
  • 1
  • 1
Elias Hossain
  • 4,410
  • 1
  • 19
  • 33
1

if we don't close the connection , it wil lead to connection memory leakage.unless until application server/web server is shut down ,connection wil remain activate even though the user logs out .

Terry chan
  • 106
  • 7