C++ SQLBindParameter

为君一笑 提交于 2019-12-04 08:38:51

MSDN documentation for SQLBindParameter says you are meant to pass a buffer containing the data for ParameterValuePtr and the length of the buffer in bytes for BufferLength:

retcode = SQLBindParameter(StatementHandle, 1, SQL_PARAM_INPUT, SQL_C_CHAR,
   SQL_LONGVARCHAR, 50, 0, strFirstName.c_str(), strFirstName.length(), NULL);

ParameterValuePtr [Deferred Input] A pointer to a buffer for the parameter's data. For more information, see "ParameterValuePtr Argument" in "Comments."

BufferLength [Input/Output] Length of the ParameterValuePtr buffer in bytes. For more information, see "BufferLength Argument" in "Comments."

It looks like the api, wants an unsigned char * try passing in a c string, using the c_str() method call.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!