I've created a table with a varchar(255) field with the default
character set. I'm using Windows for the server and application
development with ODBC. I am doing something like:
std::wstring SqlStatement = L"SELECT * FROM blah WHERE blahField LIKE ?";
SQLPrepare(....)
SQLBindParameter(hstmnt, 1, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_WCHAR,
255, 0, const_cast<LPWSTR>(L"TestStr"), 7, 0);
SQLExecute(hstmnt);
SQLFetchNext(hstmnt);
I end up getting SQL_NO_DATA returned even though I can use the MySQL
command line client to do a select and see that said row exists. I've
tried SQL_WCHAR, SQL_CHAR, SQL_VARCHAR, SQL_WVARCHAR for that 5th
parameter, and none of them work. But if I use SQL_C_CHAR, SQL_CHAR,
and "TestStr" (no wide charaters), it works just fine.
Any help?
Connector and Server are 5.1 community editions.
Thanks,
Torin Ford
| Thread |
|---|
| • Connector, C++, SQLBindParameter, SQL_C_WCHAR Not Working? | garbage | 1 Oct |