Microsoft Knowledge Base Email Alertz

KBAlertz.com: (310374) - 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...

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **


Bug Tracking Software
For bug tracking software or defect tracking software or issue tracking software, visit Axosoft.


Community Site



We Send hundreds of thousands of emails using ASP.NET Email



Expert Web Design & Graphic Design
Design44.com

ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 310374 - Last Review: March 9, 2006 - Revision: 3.2

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

This article was previously published under Q310374
This article refers to the following Microsoft .NET Framework Class Library namespace:
  • System.Data.Oledb

On This Page

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 (http://msdn.microsoft.com/dataaccess)

Steps to Reproduce the Behavior

  1. Start Microsoft Visual Studio .NET.
  2. Create a new Visual Basic .NET Windows Application project. Form1 is added to the project by default.
  3. Add a Button control to Form1.
  4. Switch to Code view.
  5. At the top of the Code window, add the following code:
    Imports System.Data.Oledb
    					
  6. Add the following code to the click event handler.

    Note You must change User ID <username> and password =<strong 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 = _
               "Provider=MSDASQL;Data Source=Witster;User Id=<username>;Password=<strong password>;" & _
               "Initial Catalog=Northwind;"
         Dim myConnection As New OleDbConnection(myConnString)
         myConnection.Open()
         MessageBox.Show("ServerVersion: " + myConnection.ServerVersion + ControlChars.Cr + _
                         "DataSource: " + myConnection.DataSource.ToString())
         myConnection.Close()
    					
  7. Press the F5 key to compile and run the application. You receive the above-mentioned error message.
  8. To resolve this problem, change the provider to SQLOLEDB.

REFERENCES

You can download the ODBC Provider from the following Microsoft Web site:
http://msdn.microsoft.com/dataaccess (http://msdn.microsoft.com/dataaccess)
For additional information ODBC .NET Data Provider, click the article number below to view the article in the Microsoft Knowledge Base:
310985  (http://kbalertz.com/Feedback.aspx?kbNumber=310985/EN-US/ ) HOW TO: Use the ODBC .NET Managed Provider in Visual Basic .NET and Connection Strings

APPLIES TO
  • Microsoft ADO.NET (included with the .NET Framework)
  • Microsoft ADO.NET 2.0
Keywords: 
kbprb kbsystemdata KB310374
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Anonymous User Report As Irrelevant  
Written: 11/2/2004 5:30 PM
error: an exception of type: {System.NotSupportedException} occurred also happens with a streamwriter when trying to write to an Applicaiton text box...

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please