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

The Connection Object

The Connection object is the way ADO.NET's built-in data providers connect to a data source. There are two Connection objects that ship with the ADO.NET: OleDbConnection and SqlConnection. As you might have guessed, the OleDbConnection object is used to create a connection to any valid OLE DB data source and the SqlConnection object is used to connect to Microsoft SQL Server versions 7.0 and up.

Just as in ADO, ADO.NET uses connection strings to connect to various data sources. The next section discusses connection string syntax and gives you several examples enabling you to connect to several types of databases.

Anatomy of a Connection String

A connection string is a semicolon-delimited set of name-value pairs that define ...

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