O'Reilly logo

Sams Teach Yourself ADO.NET in 24 Hours by Paul Bertucci, Jason Lefebvre

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hour 5. Connecting to a Data Source

In Hour 2, you saw how to work with DataSets by creating a few DataTables and manually adding columns and rows. This is a terrific way to learn how DataSets 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required