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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:19:18+00:00 2026-05-11T08:19:18+00:00

I use C# and SQL Server 2005 and I need a recommendation on how

  • 0

I use C# and SQL Server 2005 and I need a recommendation on how to populate my objects.

I have a Customers collection containing a collection of customer objects. Each customer object contains a Orders collection, containing a collection of orders.

I use a public Fetch() method on my Customers collection to populate the customers and their orders.

You can only have one DataReader open per connection, right. So that would mean that I need one connection for the ‘SELECT * Customers’ reader, and while I iterate through the customers reader I would need another connection for each ‘SELECT * Orders WHERE CustomerId_fk = @Id’.

My question : Would you recommend I use the above way or just plain DataSets ?

EDIT

I had ‘SELECT * Customers WHERE Id = @Id’ Instead of ‘SELECT * Customers’.

  • 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. 2026-05-11T08:19:19+00:00Added an answer on May 11, 2026 at 8:19 am

    Actually, your assertion (‘You can only have one DataReader open per connection’) is incorrect; you can enable MARS (Multiple Active Result Sets) via a tweak to the connection string, and job done; except of course that you’ll still have lots of round-trips (n+1).

    I also don’t think that the immediate alternative is datasets. Personally, I’d use two result grids (either from a single query or 2 queries) and stitch them together back at the caller.

    Alternatively, use something like LINQ-to-SQL with LoadWith<Customer>(c=>c.Orders); (DataLoadOptions). Even without LoadWith, it’ll do the same n+1 behaviour automatically simply by loading the collection for each Customer (navigation properties are loaded lazily by default).

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

Sidebar

Related Questions

We have customers who, for unassailable reasons, cannot use SQL Server's built-in backup features
We use SQL Server 2000/2005 and Vault or SVN on most of our projects.
SQL Server 2005 has great sys.XXX views on the system catalog which I use
Is there any way to use inheritance in database (Specifically in SQL Server 2005)?
Has anyone attempted to use SQL Server Database as a Subversion file system back
I usually do not use Sql Server Management Studio, I usually use Linqpad to
I'm trying to use SQL Server 2000 DTS Package to download a file from
What is the best way to use SQL Server 2008 as a development database,
Possible Duplicate: Internationalization in SSRS We use SQL Server Reporting Services for our web
Does it make sense to use SQL Server Compact for a desktop application? How

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.