An odbc connection mysql program. Use the unicode character set in the project property, return IM002, and connect successfully without using it
.related environment W1064Magi VS2015Mysql8.0
related codes
the connection code using the unicode character set is as follows:
SQLConnect (hdbc, (SQLWCHAR*) "mysql", SQL_NTS, (SQLWCHAR*) "root", SQL_NTS, (SQLWCHAR*) "123456", SQL_NTS);
the connection code that does not apply to the unicode character set is as follows:
SQLConnect (hdbc, (SQLCHAR*) "mysql", SQL_NTS, (SQLCHAR*) "root", SQL_NTS, (SQLCHAR*) "123456", SQL_NTS)
compare the code at both ends, the only difference is the difference between WCHAR and CHAR in the connection field. I tried Google and didn"t get a direct answer, but everything told me about character encoding
so I tried to add
setlocale (LC_ALL, ") to the code;
still didn"t work.