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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:20:30+00:00 2026-05-24T16:20:30+00:00

I have a question regarding datasets in windows forms applications. Part 1: Question: 1)

  • 0

I have a question regarding datasets in windows forms applications.

Part 1:

Question:

1) Is a dataset hitting the database every time it is instantiated.

Part 2:

Assumptions:

  • The answer to my first question is true
  • That the dataset I’m working with has a relatively small amount of data, and the application itself wont have a high number of concurrent users.
  • Number of forms may be quite high but requiring the same dataset.

Question:

1) Is it a bad idea to store a static version of the dataset in memory.

Options (rate these possible solutions):

Option 1: Create a static class that acts as a container for the dataset.

Option 2: Create a dataset inside the form where its’ needed, then create a property for any subsequent forms that depend on that dataset and passing the reference to that dataset to that particular form thereby preventing the GC from reallocating the memory (and reducing number of database calls).

Pseudo-code: This is parent form that instantiates the dataset.

public partial class ParentForm: Form
{
   private DataSet dataset;

   public ParentForm()
   {
   //logic that populates dataset
   }

   Button_Click(object sender, EventArgs e)
   {
       DependentOnDataSetForm dependent = new DependentOnDataSetForm(dataset);
   }
}

Pseudo-code: This is a form that is dependent on that same dataset.

public partial class DependentOnDataSetForm : Form
{
   private DataSet dataset;

   public DependentOnDataSetForm (DataSet dataset)
   {
      this.dataset = dataset;
   }

   // Another from that depends on the same dataset.
   Button_Click(object sender, EventArgs e)
   {
       DependentOnDataSetForm2 dependent = new DependentOnDataSetForm2(dataset);
   }
}

Bonus Question: (doesn’t apply to my current situation, but good to know for future reference).

Is it a good/bad idea to create more than one DataSet.xsd file that is only responsible for certain data required by certain forms. For example (purely hypothetical): lets say I have an orders service that is responsible for filling orders, this particular service would need access to a orders table, customers table, shipping table, etc. So is creating a .xsd file that housed only the needed tables a good idea?

  • 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-24T16:20:31+00:00Added an answer on May 24, 2026 at 4:20 pm

    Answer to question #1 is no. A DataSet object is considered an ADO.NET disconnected object. Therefore it does not hit the database. You may instantiate a DataSet with results from an ADO Connected object (i.e. DataAdapter) but the DataSet itself does not connect to a database.

    I would choose Option 2 but be aware it’s a reference object and changes in one form may affect another.

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

Sidebar

Related Questions

I have seen a couple of question regarding creating datasets in DbUnit here on
I have question regarding the CreateWindowEx function. I have 2 windows, a main one
I have a question regarding the two additional columns (timeCreated, timeLastUpdated) for each record
I have a question regarding an update function I created... CREATE OR REPLACE FUNCTION
I have a question regarding handling errors in a J2EE application. Our current application
I'm writing a small webapp in Grails and I have the following question regarding
Following on from my recent question regarding parsing XML files in Java I have
I have a question about best practices regarding how one should approach storing complex
I have a simple question and wish to hear others' experiences regarding which is
I have a question regarding a unified insert query against tables with different data

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.