Using DataAdapters and DataSets

If you need more flexibility than a DataReader offers, you can use a DataSet object as a container for records from the database. In Figure 10.2, you saw where the DataSet fits in a disconnected data access scenario. The DataSet itself doesn't connect to a database; it simply holds data and table information in its DataTables collection. To get data into a DataSet, you use a DataAdapter. The DataAdapter supplies the methods and properties to connect to a database, retrieve data, and populate the DataSet with that data. There are two key methods of the DataAdapter object: Fill and Update. The Fill method takes a DataSet and DataTable parameter to fill the records from a Command object's SQL statement. You still ...

Get Sams Teach Yourself Visual Studio® .NET 2003 in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.