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

  • SEARCH
  • Home
  • 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 8616985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:44:58+00:00 2026-06-12T05:44:58+00:00

I’m trying to figure out the correct way to use .NET DataSets. Are you

  • 0

I’m trying to figure out the correct way to use .NET DataSets. Are you supposed to create a DataTable for every table in your database and create relationships in the DataSet? It seems crazy to me to reconstruct your entire database structure in the DataSet.

I’ll use a simplified example of my database.
Lets say I have a CompanyEquipment table. Each piece of equipment belongs to a cost center, and the cost center data is stored in the CostCenter table and is related to the CompanyEquipment table. Lets say I have a stored procedure that returns CompanyEquipment data already joined with the CostCenter table to return all the info in one query. I could use the stored procedure to populate a DataTable, but how would this de-normalized result table be saved back to the database? I don’t know if this is a good way to do it. Querying many-to-many relationships that make use of association (bridge) tables would require multiple queries anyway I think. For example, I have an EquipmentRole table, that stores different equipment usages, and an EquipmentRoleAssignment table where multiple roles can be assigned to pieces of equipment.

Alternatively, if I have DataTables that mimic the database, I would have to query each table separately using DataAdapter.Fill() on each table to put the related data in each DataTable. So I would have something like select * from CompanyEquipment where equipID = 1234 and I would use that with an adapter to fill a CompanyEquipment DataTable, and then I would have to use another query select * from CostCenter where costCenterID = <costcenterID from the companyequipment record> and fill the CostCenter DataTable. With this approach I have to hit the database twice, and I lose the power of the DBMS to perform joins.

I’m new to data driven applications, so I’m not familiar with the workflow; especially how many times I should hit the database to get one representation of data. Any help is appreciated. I’m working in C#.

  • 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-12T05:45:00+00:00Added an answer on June 12, 2026 at 5:45 am

    I have used Datasets in the past (way long ago though) and this is my 0.02$ based on my experience

    Both your option 1 as well as Option 2 are valid scenarios as to how datasets could be used.

    For Retrieval Scenarios :-
    It depends on how you are using the data.

    For example, in a scenario where you know that all the main table + related table data is being for eg displayed to the user immediately, option 1 is probably preferable.

    However, in a scenario, where you might show a table with main table data and only on click of a row, show the related table information, it might be preferable to go with option 2 instead as it allows you to get the data as requested.

    For Insert / Update Scenarios

    Option 2 works best in such scenarios as your in-memory structure mimics your database. So, using an adapter or even the commandbuilder objects and the datarow state (Inserted / Updated / Deleted), you could easily insert / update / delete the appropriate data without too much hassle. If you were to use Option 1, you will need to write the logic to split it up and save into the separate tables yourself.

    Hope this is useful. However, like most real life scenarios, it really depends

    Note: I totally avoid datasets / datatables and i have for a while due to them being quite heavy objects and hence tend to be a bit of a drain on resources. If you do use them, make sure you test for performance – based on your performance requirements to ensure that they dont end up being unsuitable in the long term

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am confused How to use looping for Json response Array in another Array.

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.