21.8. Understanding the Connected Layer of ADO.NET

Recall that the connected layer of ADO.NET allows you to interact with a database using the connection, command, and data reader objects of your data provider. You have already used these objects in the previous DataProviderFactory application, now you'll walk through the process again, this time using an expanded example. You need to perform the following steps when you wish to connect to a database and read the records using a data reader object:

  1. Allocate, configure, and open your connection object.

  2. Allocate and configure a command object, specifying the connection object as a constructor argument or with the Connection property.

  3. Call ExecuteReader() on the configured command class.

  4. Process each ...

Get Pro C# 2010 and the .NET 4 Platform, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.