PRB: Visual Basic String (BSTR) in Variant Field in ADO Recordset Cannot Be Persisted to ADTG (288403)
The information in this article applies to:
- Microsoft Data Access Components 2.1
- Microsoft Data Access Components 2.1 (GA)
- Microsoft Data Access Components 2.1 SP1
- Microsoft Data Access Components 2.1 SP2
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.5 SP1
- Microsoft Data Access Components 2.6
- Microsoft Data Access Components 2.7
This article was previously published under Q288403 SYMPTOMS
If you create an ActiveX Data Objects (ADO) or ADOR recordset with a field of type adVariant, and populate that field with a Microsoft Visual Basic string value, then call the Recordset's Save method, specifying ADTG as the persistence format, the Save method appears to work with MDAC 2.1, but fails under MDAC version 2.5 or later with the following error message:
Run time error -2147217891 (80040e1d)
Requested conversion is not supported
CAUSE
The ADTG persistence format available for ADO Recordsets does not support the following Variant field types: VT_RECORD, VT_ILLEGAL, VT_VARIANT, VT_UNKNOWN, VT_BSTR, and VT_DISPATCH. These variant subtypes are explicitly disallowed by the persistence provider for ADTG. The XML persistence format supports a slightly different set of types.
RESOLUTION
Because Visual Basic strings cannot be persisted to ADTG format in a field of ADO datatype adVariant, a string datatype such as adChar or adVarchar must be used for Visual Basic string fields.
STATUS
This behavior is by design and is now more clearly documented in the MDAC 2.5 documentation than in previous MDAC documentation versions.
Modification Type: | Major | Last Reviewed: | 5/8/2003 |
---|
Keywords: | kbprb KB288403 |
---|
|