A Data Set object usually corresponds to a real database table or view, but Data Set is a disconnected view of the database. NET creates a Data Set, there is no need for an active connection to the database, which helps in scalability because the program only has to connect with a database server for microseconds when reading or writing.

This object reads the database and creates an in-memory copy of that part of the database that your program needs.

vb net dataset not updating-58

Vb net dataset not updating video

Relate Data Table objects to each other with Data Relation objects.

You can even enforce data integrity using the Unique Constraint and Foreign Key Constraint objects.

For example, if you call Delete on a row on the Data Set, then when Update is called on the Data Adapter, the Delete Command of the Data Adapter will be called using the particular row in the Data Set.

Note: Keep in mind that this Update is different than a SQL UPDATE statement.

The Find method returns the row with Customer Id = Tst ID.

After that I assign values of the row and call the Data Adapter's Update method. Updating data using the Data Adapter's Update method Deleting a row is simple.

Listing 5-50 deletes the row with the value Tst ID.

As you can see from the code, I called the Find method to find the row and called the Delete method of the Data Row.

Data Set is the most likely object you will use for programs that reference a database. NET, and it is designed to be used in a disconnected mode.