none
BCP with ODBC Native driver RRS feed

  • Question

  • We are using Visual Studio 2003 to develop a VC++ application to support SQL Server 2000 and 2005 through ODBC driver. I was able to successfully test the application with ODBC driver for 2000. But when it comes to the SQL Server 2005 using native ODBC driver it fails with "ODBCBCP.dll is not compatible with 'SQL Native Client' driver. Please configure 'SQL Server' driver for the DSN or connection string.

     

    Then I tried to use the sqlncli.h inplace of odbcss.h and replaced the odbcbcp.lib with sqlncli.lib pointing to the C:\Program Files\Microsoft SQL Server\90\SDK\Lib\x86 folder.

     

    Code Snippet

    #include <sql.h>

    #include <sqlext.h>

    #include <sqltypes.h>

    #define _SQLNCLI_ODBC_

    #include <sqlncli.h>

     

     

    Now I can not compile the program. The errors I am getting are as follows:

     

    c:\Program Files\Microsoft SQL Server\90\SDK\Include\sqlncli.h(2894): error C2061: syntax error : identifier 'DB_UPARAMS'

    c:\Program Files\Microsoft SQL Server\90\SDK\Include\sqlncli.h(2901): error C2061: syntax error : identifier 'DB_UPARAMS'
    etc

    c:\Program Files\Microsoft SQL Server\90\SDK\Include\sqlncli.h(2938): error C2061: syntax error : identifier 'HCHAPTER'
    c:\Program Files\Microsoft SQL Server\90\SDK\Include\sqlncli.h(2944): error C2061: syntax error : identifier 'HCHAPTER'
    etc

     

    The same code just works fine in the Visual Studio 2005, but we need the dll in Visual studio 2003.

     

    I think I am missing pretty obvious. Your help is appreciated.

     

    Tuesday, September 18, 2007 6:40 PM

Answers