• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2909
  • Last Modified:

dataset and datatable in vb.net

can someone clarify  the difference between Dataset and DataTable?

thanks
0
jskfan
Asked:
jskfan
2 Solutions
 
Éric MoreauSenior .Net ConsultantCommented:
Hi jskfan,

a DataTable contains the result of a SELECT query.

A DataSet contains DataTables, DataRelations.

Cheers!
0
 
Arthur_WoodCommented:
a Dataset is an 'in-memory' representation of all, or part, of a database - just as a Database is composed of tables and relations, so too, a dataset is composed of DataTables and DataRelations.

A Dataset can be made up of one or more DataTables.

Your question is sort of like askling what is the difference between a HOUSE, and a ROOM.

AW
0
 
jskfanAuthor Commented:
Because I have seen some codes like this one, I hope I am correct.

sqldataAdpater.fill(dataset1.datatable1)

I have also  seen :

SqldataAdapter.fill(dataset1)


if you notice 2 different ways.

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Éric MoreauSenior .Net ConsultantCommented:
>>SqldataAdapter.fill(dataset1)

Adds or refreshes rows in the DataSet to match those in the data source using the DataSet name, and creates a DataTable named "Table".  

>>sqldataAdpater.fill(dataset1.datatable1)

Adds or refreshes rows in a DataTable to match those in the data source using the DataTable name.  
0
 
jskfanAuthor Commented:
I am raising the points to 400 pts

emoreau : Can you please rephrase your statement into an example please?

0
 
Éric MoreauSenior .Net ConsultantCommented:
>>SqldataAdapter.fill(dataset1)

The dataset named dataset1 is filled with a datatable named "Table" containing the result of the query SqlDataAdapter.

this is the regulare syntax.


>>sqldataAdpater.fill(dataset1.datatable1)

a specific datatable is filled in the dataset.
0
 
Éric MoreauSenior .Net ConsultantCommented:
have you read the help file on these 2 syntax? do you have any particular problem?
0
 
jskfanAuthor Commented:
Let me see if I understood the difference

<<<sqldataAdpater.fill(dataset1.datatable1)>>>>

You use this statement above to fill dataset1 with a specific datatable named datatable1. Correct?


SqldataAdapter.fill(dataset1)

You use this statement above to fill dataset1 with a any datatable used in the SqlDataAdapter(s) it could be one or more  . Correct?

0
 
Éric MoreauSenior .Net ConsultantCommented:
>>You use this statement above to fill dataset1 with a specific datatable named datatable1. Correct?

I am not sure of what the name will be. I think it will still be "Table" but you will have only one datatable.


>>You use this statement above to fill dataset1 with a any datatable used in the SqlDataAdapter(s) it could be one or more  . Correct?

Yes. If your SelectCommand contains multiple SELECT statement, you will get more then one Datatable.
0
 
lp_meteoraCommented:
A DataSet is an in-memory representation of one or multiple DataTables, relations, and constraints. (Applied ADO.NET)

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now