Chapter 10: Using Dataset Objects to Store Data

Overview

In this chapter, you'll learn the details of using DataSet objects to store results returned from the database. DataSet objects allow you to store a copy of the information from the database, and you can work with that local copy while disconnected from the database. Unlike managed provider objects such as the SqlDataReader, a DataSet is generic and therefore works with any database. A DataSet object also allows you to read rows in any order and modify rows-unlike a SqlDataReader, which allows you to read rows only in a sequential forward direction. That's not to say SqlDataReader objects are bad: as you learned in Chapter 9, they offer very fast access to data.

You'll also learn the details of using a DataAdapter object to read rows from the database into a DataSet. The DataAdapter is part of the managed provider classes, and there are three DataAdapter classes: SqlDataAdapter, OleDbDataAdapter, and OdbcDataAdapter.

You use a DataAdapter to copy rows from the database to your DataSet and also push any changes you make to the rows in your DataSet to the database. You'll see how to make changes to the rows in a DataSet and push those changes to the database in Chapter 11, "Using DataSet Objects to Modify Data." In this chapter, you'll focus on copying rows from the database and storing them in a DataSet.

Featured in this chapter:

  • The SqlDataAdapter class

  • Creating a SqlDataAdapter object

  • The DataSet class

  • Creating a DataSet object

  • Populating a DataSet object

  • Using the Merge() method

  • Writing and reading XML using a DataSet object

  • Mapping tables and columns

  • Creating and using strongly typed DataSet classes

  • Creating a DataAdapter object and DataSet object using Visual Studio .NET




Mastering C# Database Programming
Mastering the SAP Business Information Warehouse: Leveraging the Business Intelligence Capabilities of SAP NetWeaver
ISBN: 0764596373
EAN: 2147483647
Year: 2003
Pages: 181

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net