What are the best practices for using, and differences of, DataSet, DataView and DataTable?

I have been a programmer since 1968 and I am learning VS2015 VB.NET. I have read three solid books on the subject and am writing code as an exercise to learn this VB.NET language.

After making the connection and creating an adapter to read the data, Then, I believe that the next step is to populate the dataset object.

Some books then suggest creating a DataView or DataTable. Some just work with the dataset. I am an MSDN subscriber/partner but their write-ups leave a lot to be desired at times.

What is the difference between the three? What are the conditions that you would use one over the other?

I will follow-up with another question so that you can get more points.

Thanks, in advance.
Lenny GrayAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Fernando SotoRetiredCommented:
To your question, "What is the difference between the three?".
A DataSet is a container which holds one or more DataTable and can store relationships between multiple DataTables, these relationships are manually setup in the DataSet.
A DataTable is a container that holds data from a data source.
A DataView can be customized to show a subset of the data from the DataTable object. It allows you to have two controls bound to the same DataTable, but that show different versions of the same data.

To your question, "What are the conditions that you would use one over the other?", Any one of the three are NOT replacements for the others. For example if you only have data from one source you would not need to use a DataSet although you can still use it if you wanted. Also if you do not need to modify the default view then you would not need to create a custom view  but if you wanted to change the default view then you would or if you wanted to show the same data source in two or more controls differently.
In any case you will always need a DataTable because it is the container that holds the data.
0

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
Lenny GrayAuthor Commented:
Fernando, you are a natural teacher.

I am grateful for your explanation. It was really clear.

Lenny
0
Fernando SotoRetiredCommented:
Not a problem Lenny, glad I was able to help.
0
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
Visual Basic.NET

From novice to tech pro — start learning today.