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 355109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:59:14+00:00 2026-05-12T11:59:14+00:00

For example, I need to fill lots of DataTables with SQLDataAdapter’s Fill() method: DataAdapter1.Fill(DataTable1);

  • 0

For example, I need to fill lots of DataTables with SQLDataAdapter’s Fill() method:

DataAdapter1.Fill(DataTable1);
DataAdapter2.Fill(DataTable2);
DataAdapter3.Fill(DataTable3);
DataAdapter4.Fill(DataTable4);
DataAdapter5.Fill(DataTable5);
....
....

Even all the dataadapter objects use the same SQLConnection, each Fill method will open and close the connection unless the connection state is already open before the method call.

What I want to know is how does unnecessarily opening and closing SQLConnections affect the performance of the application. How much does it need to scale to see the bad effects of this problem (100,000s of concurrent users?). In a mid-size website (daily 50000 users) does it worth bothering and searching for all the Fill() calls, keeping them together in the code and opening the connection before any Fill() call and closing afterwards?

  • 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-05-12T11:59:14+00:00Added an answer on May 12, 2026 at 11:59 am

    ADO.NET has connection pooling, e.g. when you close a connection, it’s not really completely closed, but “recycled” if you ask for a new connection with exactly the same connection string.

    Nevertheless – if you already know ahead of time that you’ll have to call these five Fill methods one by one, I would definitely recommend

    • opening the connection
    • reading all five data tables from the database
    • closing the connection again right away

    It’s accepted best practice to do it this way, it doesn’t hurt you – so just do it! 🙂

    Marc

    PS: Connection pooling in ADO.NET of course only works if you haven’t turned it off ! 🙂 It’s on by default – you’d have to explicitly disable it.

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

Sidebar

Related Questions

I need a method for adding business days in PHP. For example, Friday 12/5
I need an example algorithm that will draw pixels one at a time on
I need a basic example of how to use the IComparable interface so that
I need a very simple and clear example of how to create an OCX
I need to set/get the cookies stored at first.example while browsing second.example , I
For example, I rarely need: using System.Text; but it's always there by default. I
I need your help, For example I have a decimal type variable and I
If I need a varchar(30) field, for example, that needs to contain several different
I need to call a const function from a non-const object. See example struct
I need a function that I can call when somthing is done, for example

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.