Download CD Content
In this chapter, you will learn how to:
Connect to a Microsoft Access database
Execute SQL statements to query the database
Execute SQL statements to update the database
Create disconnected applications, which use a DataSet to cache tables in memory
Create a report displaying data from the database
ADO.NET is the data access API from Microsoft for the Microsoft Windows .NET Framework 1.1. ADO.NET has been optimized to work with .NET to enable distributed applications and services to exchange data easily and reliably.
ADO.NET offers two distinct programming models, depending on the type of application you need to build:
If your application can obtain and maintain a direct connection to a data source, you can use classes such as OleDbConnection, OleDbCommand, and OleDbDataReader to exchange data with the data source. These classes are superficially similar to previous versions of ADO, but you’ll find many differences when you look into the details.
If your application is disconnected from a data source, you can use a DataSet to represent an in-memory cache of data from the data source. DataSet is the most important new class in ADO.NET because it enables you to freely pass data between applications and services residing on different tiers in your architecture.
In this chapter, you will learn how to use ADO.NET to connect to a data source, execute queries, and perform database update operations. You will also learn how to use a DataSet in a disconnected application. You will see how to fill a DataSet with data from a database and display the data in a DataGrid.
ADO.NET provides access to any kind of relational database. The examples in this chapter describe how to use Microsoft Access.