A "No mapping exists from DbType Object to a known OdbcType" error occurs when you configure the OdbcDataAdapter by using the Data Adapter Configuration Wizard (816802)



The information in this article applies to:

  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Academic Edition
  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual C# .NET (2003)
  • Microsoft ADO.NET (included with the .NET Framework 1.1)

SYMPTOMS

When you configure the OdbcDataAdapter using the Data Adapter Configuration Wizard, you may receive the following error message after you specify the SQL query string:
No mapping exists from DbType Object to a known OdbcType.

CAUSE

The problem occurs because the query string that is specified in the SELECT command of the Data Adapter Configuration Wizard is incorrect. When the query string is incorrect, the Data Adapter Configuration Wizard incorrectly generates the error message that is specified in the "Symptoms" section instead of one of the following error messages:
Invalid column name.
-or-
Invalid table name.

RESOLUTION

To resolve this problem, specify a valid query string on the Generate the SQL statements page when you configure the OdbcDataAdapter using the Data Adapter Configuration Wizard.

STATUS

This behavior is by design.

MORE INFORMATION

Steps To Reproduce the Behavior

  1. In Visual Studio .NET, create a new Visual Basic .NET or Visual C# .NET Windows Application project.
  2. In the ToolBox, double-click OdbcDataAdapter.
  3. The Data Adapter Configuration Wizard starts. Click Next.
  4. In Which data connection should the data adapter use?, click the Northwind database of your SQL Server.

    Note: If the connection does not exist, click New Connection to create a new connection.
  5. Click Next.
  6. Click the Use SQL statements option in the next page of the wizard, and then click Next.
  7. In the Generate the SQL statements page, type the following SQL statement:
     SELECT * FROM CUSTOMER WHERE CUSTOMERID = ?
  8. Click Next. You receive the error message that is described in the "Symptoms" section of this article.

REFERENCES

For more information, visit the following .NET Framework SDK v1.1 Documentation: Note: To access this link, you must install the .NET Framework SDK v1.1 Documentation

Modification Type:MinorLast Reviewed:3/10/2006
Keywords:kbtshoot kberrmsg kbDatabase kbProgramming kbprb KB816802 kbAudDeveloper