Click to See Complete Forum and Search --> : Problem with fetching data with ADO


KYG
August 15th, 2000, 12:48 PM
Hi All!

I need to get data from database using ADO.
When I get numbers or short strings, I use:



_variant_t v;
v = rs->Fields->Item[(long)0]->Value;
v.ChangeType(VT_BSTR); // here I get assertion
int iLVItem = lst->InsertItem(0, (LPCTSTR)(CString)v.bstrVal);



It works.
But when I need to get data from the field contains varchar2(1000), I get an assertion.

Can you help me? How should I get such kind of data?

Thanks.
KYG.

chakree d rani
October 13th, 2000, 02:06 AM
When you retrieve a string you will have a BSTR. Then why do you need to convert it into VT_BSTR again?
Moreover, you can simply use v.bstrVal to get the string value, irrespective of the size of the text.

Hope this helps,

Rani