Help and Support

Article ID: 318917 - Last Review: March 9, 2006 - Revision: 1.1

You may receive an error message when you use the ODBC .NET data provider in WebForm applications

This article was previously published under Q318917

On This Page

Expand all | Collapse all

SYMPTOMS

When you use the ODBC .NET data provider in an ASP.NET page, you may receive one of the following error messages:
Type 'OdbcConnection' is not defined.
-or-
File or assembly name System.Data.Odbc, or one of its dependencies, was not found.
-or-
Namespace or type 'ODBC' for the Imports 'Microsoft.Data.ODBC' cannot be found

RESOLUTION

To work around this problem, use one of the following methods:
  • Include the <CompilerOptions> attribute before you import the namespace for the ODBC .NET data provider. For example:
    <%@ CompilerOptions='/R:"C:\Program Files\Microsoft.NET\Odbc.Net\Microsoft.data.odbc.dll"' %>
    					
  • Create a folder that is named bin in your application directory, and then paste the Microsoft.Data.ODBC.dll file into the bin folder.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Start Notepad, and then paste the following code:
    <%@ Import Namespace = "System.Data" %>
    <%@ Import Namespace = "Microsoft.Data.Odbc" %>
    <%
    Dim objConn As OdbcConnection
    %>
    					
  2. Save the file as OdbcCon.aspx in the C:\Inetpub\wwwroot directory.
  3. Open the OdbcCon.aspx page in your browser. Notice that you receive an error message.
  4. To work around this problem, copy and paste the <CompilerOptions> attribute code before you import namespaces for the Microsoft.Data.Odbc namespace:
    <%@ CompilerOptions='/R:"C:\Program Files\Microsoft.NET\Odbc.Net\Microsoft.data.odbc.dll"' %>
    <%@ Import Namespace = "Microsoft.Data.Odbc" %>
    					

REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
313480  (http://support.microsoft.com/kb/313480/EN-US/ ) INFO: Roadmap for .NET Data Providers

APPLIES TO
  • Microsoft ADO.NET (included with the .NET Framework)
Keywords: 
kbmanaged kbprb kbsystemdata KB318917
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.

Article Translations