Home > DeveloperSection > Blogs > What is DataSet?

What is DataSet?

ADO.Net ADO.Net 
2 Comment(s)
 3100  View(s)
Rate this:

The DataSet, which is anin-memory cache of data retrieved from a data source, is a major component ofthe ADO.NET architecture. The DataSet consists of a collection of DataTable objects that you can relate toeach other with DataRelation objects.

A DataSet can read and writedata and schema as XML documents. The data and schema can then be transportedacross HTTP and used by any application, on any platform that is XML-enabled.You can save the schema as an XML schema, and both schema and data can be saved.To read an XML document that includes both schema and data, use the ReadXMLmethod.

Herefirst we will see how we can create dataset:

               DataSet datasetobjectname = new DataSet();  

Herewe can add table in the DataSet:


Herehow we can delete DataTable from dataset:


Setting primary key for a Datatable:

 datatable.PrimaryKey = new DataColumn[] { datatable.Columns["ID"]};



By Uttam Misra on   6 years ago
John, really useful for the beginners.

Nice blog.

By marcel ethan on   4 years ago
Nice blog.

Don't want to miss updates? Please click the below button!

Follow MindStick