I am trying to use the ADO library in order to communicate with an MDB file. At this moment I am able to read all the columns. My code relies on other libraries that expect a wstring as an argument. The following code returns a _variant_t data type, however the argument that the function is expected to receive is of the type wstring. I have tried several conversion methods, but none have seemed to work.
wstring effectDescription = recordset->Fields->GetItem("effectDescription")->Value
The builder outputs: no operator found which takes a right-hand operand of type '_variant_t' (or there is no acceptable conversion)
Any help would be appreciated!
_variant_t
can hold many types, but presumably it holds something string-like. In that case _variant_t::operator _bstr_t
will give you a _bstr_t
, which in turn has a operator const wchar_t*
, and finally the ctor for wstring
will take taht. Note that you don't get only one implicit conversions in C++, so that's why it doesn't compile. Make the conversions explicit.