What is the difference between DataTable and DataSet?

Posted by Gaddad under ASP.NET on 7/7/2009 | Views : 86215 | Status : [Member] | Replies : 17
I am confusing with datatable and dataset when can we use datatable and dataset. Please explain with example...

Thanks in Advance......




Responses

Posted by: Akiii on: 5/6/2011 [Member] Bronze | Points: 25

Up
0
Down
@Vuyiswamb ......

Sir, could you please explain why dataset has an overhead performance hit ?

Thanks and Regards
Akiii

Gaddad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 5/6/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Every Technology that is being created by Microsoft is good for certain situation. I have used a Dataset for a long time and i never had a problem with any overhead. The problem comes when the technology is abused or maybe someone made a bad decision in the Design of the application. a Dataset is not meant to carry 1 000 000 records , there are applications that does that and the performance problems are then experienced after that. If you want to use a Dataset effectively , you must only bring back data that you only need.

Thank you for posting at Dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Gaddad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 5/6/2011 [Member] Bronze | Points: 25

Up
0
Down
Thank you sir for the reply....

Sir, suppose i have a database and it contains huge records (approx 100,000) then what is the effective way to manage this kind of situation ?

Thanks and Regards
Akiii

Gaddad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 5/6/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
hi Akiii

Remember that the users will not work with 100 000 data at the same time, so when you want to give the user to work with data, you must always filter the data and give only what is needed at that time.

I once worked on the a timetabling System, the Mistake they made when they design the system , is that they brought unneccessary data, at first there was no problem with perfomance because few people accesed , but when it was requested that the whole University(More than 300 000 Students) should access the data, it was a problem, because students could see other students timetable, that is "Information Oveloading" , the Solution to this problem , brought us back to the basics. You must only show people what they need , not extra.

So to finnaly asnwer your question. You must always filter your data.

Thank you for posting at Dotnetfunda


Vuyiswa Maseko


Thank you for posting at Dotnetfunda
[Administrator]

Gaddad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 5/6/2011 [Member] Bronze | Points: 25

Up
0
Down
Thank you very much sir for answering my question. Yes, you are absolutely right that we should filter the data and show the users what they need at that point of time.

I hope i can gain many more knowledge from you in future...

Regards
Akiii

Gaddad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 5/7/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Good Day

I hope so too.

Thank you for posting at Dotnetfunda

Please mark your post as asnwered if you have received the answer that you want.

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Gaddad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 5/7/2011 [Member] Bronze | Points: 25

Up
0
Down
hi sir......

this post is from Gaddad .....
i cannot mark it as an answer on behalf of him....

regards
Akiii

Gaddad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Susanthampy on: 5/19/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
DataSet and DataTable are the key components in ADO.NET programming. This mean that DataTable represents an in memory representation of the database. We can load a single Table from the database into a DataTable and manipulate the data in memory. DataTable can be used as a DataSource and used it if we are going to fetch data in a single database table only. While DataSet on the other hand can define DataRelations - which define the relationship between DataTables, much like a foreign key relationship can be set up between tables in a database. DataSets, themselves DOES NOT Contain any Data. DataSets contain DataTables (which is where any data actually resides),DataRelations, etc, but no data.

Regards,
Susan

Gaddad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Susanthampy on: 5/19/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi,

Refer this link,

http://www.codeproject.com/KB/database/DataTableToDataBase.aspx

Regards,
Susan

Gaddad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 5/20/2011 [Member] Bronze | Points: 25

Up
0
Down
Excellent link susan....

Thanks and Regards
Akiii

Gaddad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakn2 on: 5/20/2011 [Member] Starter | Points: 25

Up
0
Down
dataset nothing but disconnected architecure of database. Means like database we can create,modify data tables in dataset. without effecting database.At last we are sending all data to database. more clearly dataset is frontend and database is backend. coming to datatable like a view we can put database table in it and we can create and modify only sinlge table.

Thanks&Regards
LakshmiNarayana Nalluri.

Gaddad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shanky11 on: 9/4/2012 [Member] Starter | Points: 25

Up
0
Down
then what is the exact difference b/w dataset and datatable in practically and to give benifits of both of them respectively

Gaddad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Maheshvishnu on: 9/4/2012 [Member] Starter | Points: 25

Up
0
Down
we can load single table data into datatable i.e for small amount of data operations we use datatable.

dataset: we can load multiple tables data into dataset i.e huge data can be placed in dataset.More over we can establish relationships between tables using dataset.

mahesh

Gaddad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhsinathk on: 9/5/2012 [Member] Bronze | Points: 25

Up
0
Down
DataSet:

1.A DataSet object represents a schema (either an entire database or a subset of one). It can contain tables and relationships between those tables.
2.Data set is a collection of data table it is based on xml format ,it is used for data storing in cache as a disconnected recordset.
3.Dataset is using data manipulation in cache wthout connection to database.


DataTable:

1.A DataTable object represents a single table in the database. It has a name, rows, and columns.
2.A Datatable is an in-memory representation of a single database table.
3.The DataTable is a central object in the ADO.NET library. Other objects that use the DataTable include the DataSet and the DataView.

Gaddad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vijay.K on: 9/6/2012 [Member] Starter | Points: 25

Up
0
Down
DataSet:

*Dataset is collection of data table and it is provide interface between database and datatable
*one dataset consist multiple table.
*Represents an in-memory cache of data.


Datatable:
*Data table is a collection of record's that consist the single table
*Represents one table of in-memory data.

EX:

DataTable dt1 = new DataTable();
DataTable dt2 = new DataTable();
DataSet ds = new DataSet();
ds.Tables.Add(dt1);
ds.Tables.Add(dt2);

vijay.k

Gaddad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Syedshakeer on: 7/7/2009 [Member] Starter

Up
0
Down
Hi Gaddad
Check the Following Link for more details.
http://www.codeproject.com/KB/grid/practicalguidedatagrids1.aspx

Syed Shakeer Hussain

Gaddad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 7/7/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Good Morning Gaddad

That is a Good Question and it should go to the interview section. now to my experience i have used Datatable and Dataset interchangeably. A Dataset has an overhead perfomance hit when its loaded with a lot of Data. Now let me be more clearer, a Dataset can Contain a lot of Datatable :) A Dataset is like a Container for Datatables because every dataset has a datatable contained inside it and a Datatable is like a table you have in SQL and a Dataset its like a Database that contain table(Datatable)

Thank you for posting in .NEtFunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Gaddad, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response