Databases Reference
In-Depth Information
Notice the similarity between the two data providers, SqlClient and OleDb . The differ-
ences in their implementations are transparent, and the user interface is fundamentally
the same.
The ADO.NET OLE DB data provider requires that an OLE DB provider be specified
in the connection string. Table 9-4 describes some OLE DB providers.
Table 9-4. Some OLE DB Providers
Provider
Description
DB2OLEDB
Microsoft OLE DB provider for DB2
SQLOLEDB
Microsoft OLE DB provider for SQL Server
Microsoft.Jet.OLEDB.4.0
Microsoft OLE DB provider for Access (which uses the Jet engine)
MSDAORA
Microsoft OLE DB provider for Oracle
MSDASQL
Microsoft OLE DB provider for ODBC
Let's use the OLE DB data provider (SQLOLEDB) to access the Northwind database,
making a few straightforward changes to the code in Listing 9-1. (Of course, you'd use the
SQL Server data provider for real work since it's more efficient.)
Try It Out: Creating a Simple Console Application Using the
OLE DB Data Provider
In this example, you'll see how to access Northwind with OLE DB.
1. In Solution Explorer, add a new C# Console Application project named
OleDbProvider to the Chapter09 solution. Rename the Program.cs file to
OleDbProvider.cs . In the code editor, replace the generated code with the code in
Listing 9-2, which shows the changes to Listing 9-1 in bold.
Listing 9-2. OleDbProvider.cs
using System;
using System.Data;
using System.Data.OleDb;
Search WWH ::




Custom Search