Workaround use SQLConnect to configure ODBC links to use the/C + + return-1

Source: Internet
Author: User
Tags odbc odbc connection

Vs in establishing an empty project when using an ODBC connection, the SQLConnect function always returns -1,MYSQL and the command-line connection database is fine.

Retcode = SQLConnect (HDBC, (sqlchar*)"test", Sql_nts, (sqlchar*)"root ", Sql_nts, (sqlchar*)"", sql_nts);

Originally because my mysql is installed 64 bit, in the ODBC setting is also 64 bit, then vs in the compiler is 32 bit, so will compile to 64 bit just fine,

On the right-hand side of the debug x86, open it.

Select Configuration Manager, enter, and change to x64 on the platform.

After the change is complete, compile again, the system appears "SQLCHAR *" type of the actual participation "Sqlwchar *" type of parameter incompatible "error (¬^?? ¬☆)

The solution to this problem is:

In the debug--Properties--general--character set there, it's good to have multibyte character sets.

This step is changed, debugging runs again, debugging succeeds, SQLConnect also returns 0.

Success

Workaround use SQLConnect to configure ODBC links to use the/C + + return-1

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.