MDAC 2.5 SDK - OLE DB Programmer's Reference
Appendix A: Data Types


 

Conversions Involving VARIANTs

The following table describes conversions to and from VARIANTs. Type indicator X can be modified by DBTYPE_ARRAY or DBTYPE_BYREF. No conversions are supported when it is modified by DBTYPE_VECTOR.

Source type indicator Target type indicator Notes
X DBTYPE_VARIANT If X is a valid VARENUM value (that is, it is a type indicator that can be used in a VARIANT), the provider sets vt in the target VARIANT to X and transfers the data to the corresponding element of the union.

If X is not a valid VARENUM value, it is provider-specific whether the provider supports the conversion and what type it uses in the VARIANT. Any such conversions must follow the rules in this appendix.

DBTYPE_VARIANT X If the type indicator specified in the source VARIANT is X, the provider transfers the data.

If the type indicator specified in the VARIANT is not X, it is provider-specific whether the provider supports the conversion. Any such conversions must follow the rules in this appendix.

DBTYPE_VARIANT DBTYPE_VARIANT The provider sets vt in the target VARIANT to the same value as vt in the source VARIANT. It transfers the data from the union element in the source VARIANT to the same element in the target VARIANT.