Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8221271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:51:12+00:00 2026-06-07T13:51:12+00:00

Which one of the following two methods has better performance ? using( var DB_Connection_s

  • 0

Which one of the following two methods has better performance ?

using( var DB_Connection_s = new DBConnection() )
{
 //todo: interact with database connection
}

or just :

DB_Connection_s.Close();

at the end.

Does the first method make the pooling concept useless? Because if I dispose the connection with each use, then I have to open a new connection every time (and there won’t be any connections in the pool).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T13:51:14+00:00Added an answer on June 7, 2026 at 1:51 pm

    Connections are released back into the pool when you call Close or Dispose on the Connection…

    source = SQL Server Connection Pooling (ADO.NET)

    So, remove any worry about performance loss caused by missed pooled connections.
    From the code standpoint the difference should be so minimal that the using statement should always be used

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following extJs window which has two tabs in it. One of
which one of the following is better? <c:set var=var1 value=false scope=request/> <c:if test=${someCondition}> <c:set
I am using the FluentValidation framework in C# which has the following two method
I have the following two queries which I want to get in one query.
Please see following examples first, and which one is better? Could you compare some
I've one interface which has following method signatures: public interface ITag { int M_Id
From the following list of frameworks, which one would you use to develop a
I have the following code which swaps out one divs innerHTML for the others
One of the following pieces of code generates a memory leak, any idea which
I had a question answered which raised another one, why following does not work?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.