I am using ADO in C++ for creating a connection,command, and
parameters.
VARIANT par;
par.vt = VT_UI1;
par.pbVal = (BYTE*)pBuffer;
pCommand->Parameters->Append(pCommand-
>CreateParameter("test",DataTypeEnum::adArray,
ParameterDirectionEnum::adParamInput,strlen(pBuffer),par));
pRecordset = pCommand-
>Execute(NULL,NULL,CommandTypeEnum::adCmdStoredProc);
where
_CommandPtr pCommand;
pCommand->CommandText = (_bstr_t)procedureName;
pCommand->CommandType = CommandTypeEnum::adCmdStoredProc;
When I append the created parameter, in comutil.h, at these lines :
namespace _com_util {
inline void CheckError(HRESULT hr) throw(...)
{
if (FAILED(hr)) {
_com_issue_error(hr);
}
}
}
I get an exception : m_hresult 0x80020008 Bad variable type.
If I try to insert a string or an number, it works. But with BYTE* it
dosen't.
Can someone help me?
Thanks