O'Reilly logo

Visual Basic® .NET by Example by Bob Donald, Gabriel Oancea

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using a DataSet to Read and Modify Data

In the previous chapter, we showed how to read data from a database using a DataReader object. Here we show how to read data using a DataSet object. The difference here is that the DataSet object is populated with data from the database and then used for managing the data. The DataSet object keeps track of any changes made to the data in the DataSet. The DataSet modifications can be saved back to the database at any point.

When reading data into a DataSet, the idea is to use a DataAdapter object to fill the DataSet. The DataAdapter uses a Connection object and a query string (SQL statement) for retrieving the desired rows from the database. After the DataSet is populated with data, the database connection ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required