
.NET Framework Data Provider for SQL Server (SqlClient)
The .NET Framework Data Provider for SQL Server (SqlClient) uses its own protocol to communicate with SQL Server. It is lightweight and performs well because it is optimized to access a SQL Server directly without adding an OLE DB or Open Database Connectivity (ODBC) layer. The following illustration contrasts the .NET Framework Data Provider for SQL Server with the .NET Framework Data Provider for OLE DB. The .NET Framework Data Provider for OLE DB communicates to an OLE DB data source through both the OLE DB Service component, which provides connection pooling and transaction services, and the OLE DB provider for the data source.
Note: |
|---|
The
.NET Framework Data Provider for ODBC has a similar architecture to the .NET Framework Data Provider for OLE DB; for example, it calls into an ODBC Service Component.
|
Comparison of the dnprdnshort Data Provider for ssNoVersionr and the dnprdnshort Data Provider for OLE DB
.gif)
To use the .NET Framework Data Provider for SQL Server, you must have access to SQL Server 7.0 or later versions. The .NET Framework Data Provider for SQL Server classes are located in the System.Data.SqlClient namespace. For earlier versions of SQL Server, use the .NET Framework Data Provider for OLE DB with the SQL Server OLE DB provider System.Data.OleDb.
The .NET Framework Data Provider for SQL Server supports both local and distributed transactions. For distributed transactions, the .NET Framework Data Provider for SQL Server, by default, automatically enlists in a transaction and obtains transaction details from Windows Component Services or System.Transactions. For more information, see Transactions and Concurrency (ADO.NET).
The following code example shows how to include the System.Data.SqlClient namespace in your applications.
|
Imports System.Data.SqlClient
|
|
using System.Data.SqlClient;
|