MDAC Technical Articles

Appendix

Troubleshooting Q&A

Q: I can save the Recordset into XML, but I can't read it back in using ADO. I keep receiving errors such as "Class not registered" or "The application requested an operation on an object with a reference to a closed or invalid connection object" or "Unable to find the specified provider." What am I doing wrong?

A: Check to make sure that both Msdaprst.dll and Msxml.dll are on your computer and registered. Be sure to use the adCmdFile flag when opening the Recordset so that ADO can give you a better runtime error in case the file is missing or corrupt. That is, instead of writing

rs.Open "myfile.sav"

try

rs.Open "myfile.sav",,,,adCmdFile.

Q: I registered the required files, made sure my file is present, and now I receive "Unspecified error" when trying to open the Recordset. Now what?

A: Remember that the Persistence Provider requires the XML parser in Msxml.dll to be version 2.5 (from Internet Explorer 5) or later. Most likely the Persistence Provider can't load the XML parser because it is requesting a version that is not on your computer.

Q: I saved the file but when I try to look at it using WordPad, it's all garbage! What is wrong with the XML format?

A: Remember that the default format for Recordsets when saving is adPersistADTG, which is a binary format. Be sure to save with adPersistXML.

Q: I know that I am persisting into XML, but some of my text seems unreadable now (especially my umlauts and accent characters).

A: The XML written out is UTF-8 encoded. This means that characters greater than 0x007f are encoded so that they may be safely transmitted over the wire. Also remember that characters reserved by XML are substituted with character entities. See the section on string data types earlier in this paper.

Q: Why can't the Internet Explorer 5 XML parser validate the XML as generated by ADO?

A: The "extends" clause has been added so that rowset schemas could be legally validated. The row definition must extend the rs:rowbase element defined by Microsoft's rowset schema by including the <s:extends type="rs:rowbase"/> construct. However, the shipped version of the Microsoft XML parser doesn't support the "extends" clause, so this is now redundant and actually fails on validation.

Definition of urn:schemas-microsoft-com:rowset

<s:Schema xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
    xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
    <!-- rowset level properties -->
    <s:AttributeType name="updatable" dt:type="boolean"/>
    <s:attribute type="updatable"/>
    <s:AttributeType name="updateresync" dt:type="i4"/>
    <s:attribute type="updateresync"/>
    <s:AttributeType name="uniquetable" dt:type="string"/>
    <s:attribute type="uniquetable"/>
    <s:AttributeType name="uniqueschema" dt:type="string"/>
    <s:attribute type="uniqueschema"/>
    <s:AttributeType name="uniquecatalog" dt:type="string"/>
    <s:attribute type="uniquecatalog"/>
    <s:AttributeType name="customresync" dt:type="string"/>
    <s:attribute type="customresync"/>
    <s:AttributeType name="irowsetchange" dt:type="boolean"/>
    <s:attribute type="irowsetchange"/>
    <s:AttributeType name="irowsetupdate" dt:type="boolean"/>
    <s:attribute type="irowsetupdate"/>
    <s:AttributeType name="commandtimeout" dt:type="i4"/>
    <s:attribute type="commandtimeout"/>
    <s:AttributeType name="batchsize" dt:type="i4"/>
    <s:attribute type="batchsize"/>
    <s:AttributeType name="updatecriteria" dt:type="i4"/>
    <s:attribute type="updatecriteria"/>
    <s:AttributeType name="reshapename" dt:type="string"/>
    <s:attribute type="reshapename"/>
    <s:AttributeType name="autorecalc" dt:type="i4"/>
    <s:attribute type="autorecalc"/>

    <!-- column level properties -->
    <s:AttributeType name="autoincrement" dt:type="boolean"/>
    <s:AttributeType name="baseschema" dt:type="string"/>
    <s:AttributeType name="basetable" dt:type="string"/>
    <s:AttributeType name="basecolumn" dt:type="string"/>
    <s:AttributeType name="basecatalog" dt:type="string"/>
    <s:AttributeType name="number" dt:type="i4"/>
    <s:AttributeType name="name" dt:type="string"/>
    <s:AttributeType name="precision" dt:type="ui1"/>
    <s:AttributeType name="scale" dt:type="ui1"/>
    <s:AttributeType name="fixedlength" dt:type="boolean"/>
    <s:AttributeType name="long" dt:type="boolean"/>
    <s:AttributeType name="nullable" dt:type="boolean"/>
    <s:AttributeType name="maybenull" dt:type="boolean"/>
    <s:AttributeType name="keycolumn" dt:type="boolean"/>
    <s:AttributeType name="writeunknown" dt:type="boolean"/>
    <s:AttributeType name="write" dt:type="boolean"/>
    <s:AttributeType name="rowid" dt:type="boolean"/>
    <s:attribute type="number"/>
    <s:attribute type="name"/>
    <s:attribute type="precision"/>
    <s:attribute type="scale"/>
    <s:attribute type="fixedlength"/>
    <s:attribute type="long"/>
    <s:attribute type="nullable"/>
    <s:attribute type="maybenull"/>
    <s:attribute type="keycolumn"/>
    <s:attribute type="write"/>
    <s:attribute type="writeunknown"/>
    <s:attribute type="rowid"/>
    <s:attribute type="baseschema"/>
    <s:attribute type="basetable"/>
    <s:attribute type="basecolumn"/>
    <s:attribute type="basecatalog"/>

    <!-- baserow definition -->
    <s:ElementType name="baserow" content="eltOnly">
        <s:attribute type="updatable"/>
    </s:ElementType>
    <s:element type="baserow"/>

    <!-- update definitions -->
    <s:ElementType name="original" content="eltOnly">
        <s:element type="rowbase" minOccurs="1" maxOccurs="1"/>
    </s:ElementType>
    <s:ElementType name="update" content="eltOnly">
        <s:element type="original" minOccurs="1" maxOccurs="1"/>
        <s:element type="rowbase" minOccurs="1" maxOccurs="1"/>
    </s:ElementType>
    <s:ElementType name="insert" content="eltOnly">
        <s:element type="rowbase" minOccurs="1" maxOccurs="*"/>
    </s:ElementType>
    <s:ElementType name="delete" content="eltOnly">
        <s:element type="rowbase" minOccurs="1" maxOccurs="*"/>
    </s:ElementType>
    <s:element type="original"/>
    <s:element type="update"/>
    <s:element type="delete"/>
    <s:element type="insert"/>

    <!-- data definition -->
    <s:ElementType name="data" content="eltOnly">
        <s:element type="baserow" minOccurs="0" maxOccurs="*"/>
        <s:element type="update" minOccurs="0" maxOccurs="*"/>
        <s:element type="insert" minOccurs="0" maxOccurs="*"/>
        <s:element type="delete" minOccurs="0" maxOccurs="*"/>
    </s:ElementType>
    <s:element type="data"/>
</s:Schema>