In Hour 2, you saw how to work with DataSet s by creating a few DataTable s and manually adding columns and rows. This is a terrific way to learn how DataSet s work. However, most often data is retrieved from a database and used to populate a DataSet , automatically creating a copy of the database schema and adding the requested data.
However, before you can retrieve anything from your database using ADO.NET, you must create and open a connection to the database using the Connection object. The Connection object uses a database connection string to locate and connect a data source. The exposed properties and methods of the Connection object have changed very little since the days of ADO 2.6.
This hour discusses the properties, methods, and various uses of the Connection object. Specifically, at the end of this hour, you will know how to
Use the Connection object to connect to your data source
Identify all important parts of a connection string
Build a connection string for your data source