By: Steven Holzner in VB.net Tutorials on 2009-02-24
A dataset is a cache of data retrieved from a database, and, as we know, it's the major component of ADO.NET. A DataSet object is made up of a collection of DataTable objects that you can relate to each other using DataRelation objects. You also can guarantee data integrity with the UniqueConstraint and ForeignKeyConstraint objects.
A dataset reads and writes data and schema as XML documents, which can be transported using the HTTP protocol, which makes it great for the Internet. You can save the schema as an XML schema with the WriteXmlSchema method, and the schema and data can be saved using the WriteXml method. If you need to read an XML document that includes both schema and data, use the ReadXml method that infers and creates a schema from the document.
When the user edits data in data-bound controls (or when you change data values in code), changes are made to the dataset's data immediately. You can use the GetChanges method to get a new dataset holding only the rows that have changed, and you typically send this new dataset to the database in the data provider with the data adapter's Update method. The data provider may make changes itself in the dataset of changes you send it (such as updating fields that hold calculated values, or adding primary keys) and return a new dataset, which you can then merge into the dataset you're working with, using the dataset's Merge method. Then you use the AcceptChanges method on the original dataset to accept the changes (or use RejectChanges to cancel the changes).
Datasets can be typed or untyped; usually, datasets are typed in Visual Basic. A typed dataset is a dataset that is derived from the DataSet class and uses information in an XML schema file (an XSD file). An untyped dataset, on the other hand, has no built-in schema. An untyped dataset can contain tables, columns, and rows, but those are exposed only as collections.
You also can easily navigate through a dataset that's been bound to controls
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
- Although the administrator will attempt to moderate comments, it is impossible for every comment to have been moderated at any given time.
- You acknowledge that all comments express the views and opinions of the original author and not those of the administrator.
- You agree not to post any material which is knowingly false, obscene, hateful, threatening, harassing or invasive of a person's privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Most Viewed Articles (in VB.net )
Latest Articles (in VB.net)
- Data Science
- React Native
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews