Click to See Complete Forum and Search --> : [ADO] Error on LongVarChar


reverse
April 9th, 1999, 06:37 AM
I wrote some code like below using Visual C++.

<CODE>

_RecordsetPtr rst
FieldsPtr fields;
FieldPtr field;

fields = rst->GetFields();
field = fields->GetItem(0);
_bstr_t str = _bstr_t(field->Value); // <-- Error occur

The field 0's type is adLongVarChar.
And this is terminated by error occurrence.
How to fit a _variant_t of adLongVarChar into a _bstr_t variable?

I'll be happy to receive your answer.


A programmer who loves Goethe.

Bob Place
April 13th, 1999, 05:56 AM
Could it be that the value that youare returning is VT_NULL? I have found that it is always a good idea to check for vt!=VT_NULL prior to doing anything with character string