Dataset problem - Northwind Database

Hello fellow experts,

This is one problem I'm trying to solve to help my brother, but I'm out of ideas since I'm new to C#. He is trying to learn something and I'm trying to help him but with not much luck for now. I can only apply logic from another languages but obviously that's not enough.
We are talking about famous Northwind database in SQL server.
Here is the thing, in one form there is one combobox with the list of last names from table Employees and two date fields where you can select date range.
He wants to create Report, not Crystal one. In report he wants to display:

Order Details.Quantity

To sum it all, he wants to display every single order which is associated with selected employee and within  selected date range.
What he managed to do is to create dataset with these tables and associated relations: Orders, Customers, Products and Order Details.
Initially, I thought it is possible to create dataset and fill it with data from SQL query which would get all required data. However, while I browsed through examples on the internet I realized he needs to use foreach loops and that is the point where Im stumped.
Im sure that some of you find this easy, but since this is not my area of expertise I am not able to help my brother which is beginner in C#.
I hope that someone will be able to help us here.
Thanks in advance for any help.

LVL 14
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What reporting tool does he want to use?

He could use a datagrid linked to the query to display the data.

Gustav BrockCIOCommented:
You may study the project:


and the nice reports within this, all created with the native report designer.

AndyAinscowFreelance programmer / ConsultantCommented:
Just an aside:
Based on what you say I think it should be possible to get the information completely with SQL (no foreach loops).
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

R-ByterAuthor Commented:
@mlmcc and cactus_data:

Will review it and get back with the results. Thanks for your answers. I'm trying to help him since he is beginner and I do have very limited knwoledge about C#.


That was just my thinking, I didnt say it is possible, just a thought. Its quite possible that I didnt really understand what dataset means. I thought of it merely as a container which holds data to be used in application with no need for database connection.

It truly means something when I can have help from such experienced experts (looking at your badges and registration date). Thanks again guys.

Gustav BrockCIOCommented:
My advice would be to leave the low-level SQL stuff and use at least Datatable Adapters and datasets or the Entity Framework (EF) as shown in the Northwind.NET project.

It of course takes something to begin with but it pays off in the end.

Don't look for code examples, look for tutorials. There are many of these, also as videos. That's what I did.

R-ByterAuthor Commented:
Could you point me to the right ones? The ones that are easy to follow. Thanks
Gustav BrockCIOCommented:
Here are enough to keep you busy for a while ...:

“How Do I?” Videos for Visual C#

AndyAinscowFreelance programmer / ConsultantCommented:
>>I thought of it merely as a container which holds data to be used in application with no need for database connection.

That is pretty much what it is.

What I meant is that you can
either: Create multiple datsets, each based on part of the data you want and then loop through to extract it.  
or: Create one datset and let SQL collect all the data together for you.  (You could even view the results at the database to confirm it is working as you expect before writing the C# code).
R-ByterAuthor Commented:
Thanks guys for your replies. Once again, give me a day to check all this. I know its good to give replies as soon as possible but day at least is as fast as I can.

AndyAinscow, Im very interested to see how to do this:

"Create one dataset and let SQL collect all the data together for you."

Im a little bit puzzled there on hot to do that exactly. First create SQL and then dataset or the other way around? Keep in mind that Im talking about one single query with data from multiple tables, just as I wrote in my question.

Once again, thanks to all, you already helped us to learn something.

AndyAinscowFreelance programmer / ConsultantCommented:
You can create a query which is based upon many tables.
Eg. If a Customer has many orders you can join a customer table to the order table, use a where condition to select customer xyz and see a list of all the orders they have.
Further (eg. working from child to parent) if each order can have many products (a third table) you could create a query joining all three to view all the customers that have at some time purchased a FooBar

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
R-ByterAuthor Commented:
SQL would be easy to write since I have experience in that. The problem started when i tried to find out how to fill Dataset with returned data. Is it possible for you to give me some piece of code?

R-ByterAuthor Commented:
Sorry guys for not replying sooner.
AndyAinscow, your answers gave the best way to find solution, and I'll give some points to others if you dont mind.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.