By Dan Mabbutt Much of Microsoft's data technology, ADO. This object reads the database and creates an in-memory copy of that part of the database that your program needs. NET), it's a little (but only just a little) like the old Recordset object. A Data Set object will usually correspond to a real database table or view (or perhaps several).
If you need to update the database after changing the Data Set, you can use the Update method of the Data Adapter object, but you have to make sure that the Data Adapter properties are set correctly with Sql Command objects. Data Adapter figures out what has changed and then executes an INSERT, UPDATE, or DELETE command.
Although the Data Set is easy to use, if raw performance is the goal, you might be better off writing more code and using the Data Reader instead.
Here's an example showing how to display a field.
This code creates a Data Set with one table, one column and two rows: Dim ds As New Data Set Dim dt As Data Table Dim dr As Data Row Dim cl As Data Column Dim i As Integer dt = New Data Table() cl = New Data Column( "the Column", Type.
In summary, Data Set is the most likely object you will use for programs that reference a database. NET and is designed to be used in a disconnected mode.
You can quickly serialize a Data Set to XML by calling the Write XML method.
But as with all database operations, updates to the database can run into problems especially when the database is being updated by other users so you often need to include code to anticipate and solve problems when changing the database. If you need a collection, for example if you're serializing the data, a Data Set is the tool to use.
For a more complete discussion of database processing, you might want to try the series here about databases: A Database Centered Tutorial for Beginners You can create your own unique views of a database using Data Set.
Relate Data Table objects to each other with Data Relation objects.