Users Pricing

blog

Home Blogs What is DataSet? – MindStick

What is DataSet?

John Smith 5498 27 Sep 2010 Updated 18 Sep 2014

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:

Syntax:

               DataSet datasetobjectname = new DataSet();  

Herewe can add table in the DataSet:

Syntax:
               datasetobjectname.Tables.Add(datatable);

Herehow we can delete DataTable from dataset:

Syntax:
               Datasetname.Tables.Remove(datasetobjectname.Tables[position]);

Setting primary key for a Datatable:

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


John Smith

Sr. Software Developer

I am best.


3 Comments


Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md