i am using ADO, and one of the "native" drivers (e.g. SQLNCLI, SQLNCLI10, SQLNCLI11) to connect to SQL Server (rather than the legacy SQLOLEDB driver).
ADO does not understand the XML SQL Server data type that the native drivers expose:
field: ADOField;
field := recordset.Fields.Items["SomeXmlColumn"];
Attempting to access field.Value throws an EOleException:
- Source: Microsoft Cursor Engine
- ErrorCode: 0x80040E21 (E_ITF_0E21)
- Message: Multiple-step operation generated errors. Check each status value
The native client drivers (e.g. SQLNCLI, SQLNCLI10, SQLNCLI11) present an Xml data type to ADO as
field.Type_ = 141 //???
while the legacy SQLOLEDB driver presents an Xml data type to ADO as adLongVarWChar, a unicode string:
field.Type_ = 203 //adLongVarWChar
And the VARIANT contained in field.Value is a WideString (technically known as a BSTR):
TVarData(field.Value).vtype = 8 //VT_BSTR
Seems to me that this is a bug in ADO (Windows 7 SP1), and not something i can fix.
How can i fix it?