Data Type Conversion
Collapse the table of content
Expand the table of content

Data Type Conversion

Providers must be able to convert bound data values as follows:

  • To the native type used by the provider for the column or parameter, as returned by IColumnsInfo::GetColumnInfo or ICommandWithParameters::GetParameterInfo. Such transfers must be performed without loss of data.

  • To and from DBTYPE_WSTR if such a conversion is defined by OLE DB. For more information, see Conversion Tables in Appendix A: Data Types. Conversions to and from DBTYPE_WSTR are defined for virtually all types.

Support for additional conversions is optional and might result in truncation of data or a conversion error. The consumer can determine what conversions a provider supports by calling IConvertType::CanConvert with the indicators for the "to" and "from" types. If a provider offers additional functions that the consumer can call to convert data types, these functions are described in a type library pointed to by the PROVIDER_TYPES schema rowset.

For more information about how data is converted, see Data Type Conversion Rules in Appendix A: Data Types.

© 2016 Microsoft