Microsoft KB Archive/310374

= Error message when you try to use the OleDbConnection.Open method: &quot;The .Net Data OLE DB Provider(System.Data.Oledb) does not support the MSDASQL Provider, Microsoft OLE DB Provider for ODBC Drivers.&quot; =

Article ID: 310374

Article Last Modified on 3/9/2006

-

APPLIES TO


 * Microsoft .NET Framework 1.1 Service Pack 1
 * Microsoft ADO.NET 2.0

-



This article was previously published under Q310374



This article refers to the following Microsoft .NET Framework Class Library namespace:
 * System.Data.Oledb



SYMPTOMS
The OleDbConnection class specifically prohibits you from using MSDASQL or data source names (DSNs) when you connect to your data sources in ADO.NET. If you try to use MSDASQL or DSNs, you receive the following error message:

An unhandled exception of type 'System.NotSupportedException' occurred in systemldata.dll. Additional information: The .Net Data OLE DB Provider(System.Data.Oledb) does not support the MSDASQL Provider, Microsoft OLE DB Provider for ODBC Drivers.



RESOLUTION
To resolve this problem, use an OLE DB Provider rather than an ODBC driver. Alternately, download, reference, and use the ODBC Managed Provider.



STATUS
This behavior is by design.



MORE INFORMATION
The ODBC .NET Data Provider is an add-on component to the Microsoft .NET Framework Software Development Kit (SDK). The ODBC .NET Data Provider provides access to native ODBC drivers in the same way that the OLE DB .NET Data Provider provides access to native OLE DB providers.

The ODBC .NET Data Provider should work with most ODBC drivers. However, only the following drivers have been tested with and are known to be compatible with the ODBC .NET Data Provider:
 * Microsoft SQL ODBC Driver
 * Microsoft ODBC Driver for Oracle
 * Microsoft Jet ODBC Driver

The ODBC .NET Data Provider also requires that you install Microsoft Data Access Components (MDAC) version 2.6 or later on the computer where the Web release will be downloaded. You can download the latest version of MDAC from the following Microsoft Web site:

http://msdn.microsoft.com/dataaccess

Steps to Reproduce the Behavior
 Start Microsoft Visual Studio .NET. Create a new Visual Basic .NET Windows Application project. Form1 is added to the project by default. Add a Button control to Form1. Switch to Code view.  At the top of the Code window, add the following code: Imports System.Data.Oledb </li>  Add the following code to the click event handler.

Note You must change User ID and password = to the correct values before you run this code. Make sure that User ID has the appropriate permissions to perform this operation on the database. Dim myConnString As String = _ &quot;Provider=MSDASQL;Data Source=Witster;User Id= ;Password= ;&quot; & _ &quot;Initial Catalog=Northwind;&quot; Dim myConnection As New OleDbConnection(myConnString) myConnection.Open MessageBox.Show(&quot;ServerVersion: &quot; + myConnection.ServerVersion + ControlChars.Cr + _                    &quot;DataSource: &quot; + myConnection.DataSource.ToString) myConnection.Close </li> Press the F5 key to compile and run the application. You receive the above-mentioned error message.</li> To resolve this problem, change the provider to SQLOLEDB.</li></ol>

<div class="references_section">