ADO CreateParameter fails with 0x800A0D5D when attempting to write to Oracle's RAW(16) field from C++

StackOverflow https://stackoverflow.com/questions/18872015

  •  29-06-2022
  •  | 
  •  

Question

I am attempting to write a Guid into a RAW(16) field in Oracle using a parameterized SQL query.

Having previously read the RAW(16), it comes off the database as a variant array of bytes (type VT_ARRAY | VT_UI1). Therefore I am now attempting to write back a value as an array of bytes.

My variant is set to VT_ARRAY | VT_UI1 again, and CreateParameter is called with adUnsignedTinyInt | adArray.

Unfortunately this throws the 0X800A0D5D code.

I have also tried writing the parameter using "HEXTORAW('0000000000000000')" as a BSTR parameter, using adBSTR in the call to CreateParameter. This time CreateParameter succeeded, but the call Execute on the _ADODB::CommandPtr then threw an error.

Please could someone guide me as to how I should write a Guid into Oracle's RAW(16) using a parameterized SQL query (ideally using ADO through C++)?

Was it helpful?

Solution

I have got this to work using VT_ARRAY | VT_UI1 in my variant, passing adBinary as the data-type to CreateParameter.

There is also a chance (from other things I've read) that Oracle would be happy with a plain BSTR parameter containing just the binary data in HEX notation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top