varaint type conversion
-
In ADO you usually get all your values as Variants, Is there a easy way to convert any type into a string or BSTR
-
In ADO you usually get all your values as Variants, Is there a easy way to convert any type into a string or BSTR
Yes, var.bstrVal returns a BSTR type. Cheers!!!! Carlos Antollini.
-
In ADO you usually get all your values as Variants, Is there a easy way to convert any type into a string or BSTR
Look for this article in the MSDN:
VARIANT and VARIANTARG
Best Regards!!! Carlos Antollini. -
Yes, var.bstrVal returns a BSTR type. Cheers!!!! Carlos Antollini.
No! I meant is there functionality that can convert any variant type e.g. int, long, double, currency to a BSTR. A microsoft Example has a CrackStrVariant function, but this does not cover all types.
-
No! I meant is there functionality that can convert any variant type e.g. int, long, double, currency to a BSTR. A microsoft Example has a CrackStrVariant function, but this does not cover all types.
I came across this problem recently, and found the perfect solution use _variant_t wrapper class e.g. converting a long to a BSTR
_variant_t vLongVal((long)100);
vLongVal.ChangeType(VTV_BSTR);// now you can use the bstr, that the ChangeTypr has converted
_bstr_t vBstrValue(vLongVal.valbstr);This can be applied to any type I hope this helps :cool: