Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 293856 - Last Review: May 8, 2003 - Revision: 2.1
FIX: XML File Shows Cached Data When You Use ADO Recordset to Open the File over HTTP
This article was previously published under Q293856
When you use the
Open method of the ActiveX Data Objects (ADO)
Recordset object to open an XML file over HTTP, if you make changes within the XML file, the data that appears does not contain the new modifications. In other words, the browser only displays the data that is cached from the first time you opened the XML file.
The same behavior occurs if you delete the XML file completely and run the same code. In this case, you do not receive an error message, and the browser displays the same data from the first time the XML file was opened.
The
OpenURLBlockingStream method opens HTTP files. By default, this method always uses cached data if it is available. There is no way to customize this method.
To work around this problem, use a straight file path, for example:
rs.Open "c:\testdata.xml"
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
This bug was corrected in Microsoft XML (MSXML) 3.0 and Microsoft Data Access Components (MDAC) versions 2.5 or later.
Steps to Reproduce Behavior
- Create a new Active Server Pages (ASP) page named ADOTest.asp, and paste the following code:
<%@Language=VBScript %>
<!--#include file="ADOVBS.inc"-->
<%
Response.ExpiresAbsolute = 0
set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = adUseServer
rs.CursorType = adOpenDynamic
rs.Open "http://<Your Server>/Testdata.xml"
Response.Write rs(0) & "<br>"
Response.Write rs("lname")
Response.Write rs("mname")
rs.Close
set rs = nothing
%>
- Save ADOTest.asp in the <Drive>:\Inetpub\Wwwroot folder.
- Create a new XML page named Testdata.xml, paste the following code:
<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
xmlns:rs='urn:schemas-microsoft-com:rowset'
xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
<s:ElementType name='row' content='eltOnly' rs:updatable='true'>
<s:attribute type='fName'/>
<s:attribute type='lName'/>
<s:attribute type='mname'/>
<s:extends type='rs:rowbase'/>
</s:ElementType>
<s:AttributeType name='fName' rs:number='1' rs:nullable='true' rs:write='true'>
<s:datatype dt:type='string' dt:maxLength='255' rs:precision='0'
rs:fixedlength='true' rs:maybenull='false'/>
</s:AttributeType>
<s:AttributeType name='lName' rs:number='2' rs:nullable='true' rs:write='true'>
<s:datatype dt:type='string' dt:maxLength='255' rs:precision='0'
rs:fixedlength='true' rs:maybenull='false'/>
</s:AttributeType>
<s:AttributeType name='mname' rs:number='3' rs:nullable='true' rs:write='true'>
<s:datatype dt:type='string' dt:maxLength='255' rs:precision='0'
rs:fixedlength='true' rs:maybenull='false'/>
</s:AttributeType>
</s:Schema>
<rs:data>
<rs:insert>
<z:row fName='Zach' lName='Jason' mname='R'/>
</rs:insert>
</rs:data>
</xml>
- Save Testdata.xml in the <Drive>:\Inetpub\Wwwroot folder.
- In your browser, open the ASP page.
- Delete the XML file completely from the <Drive>:\Inetpub\Wwwroot folder, and open the ASP page again. Notice that the previously displayed data still appears, even though you deleted the XML file.
APPLIES TO
- Microsoft XML Parser 2.0
- Microsoft Data Access Components 2.1
- Microsoft Data Access Components 2.1 Service Pack 2
- Microsoft Data Access Components 2.1 Service Pack 1
- Microsoft Data Access Components 2.1 Service Pack 2
| kbbug kbdatabase kbfix kbmdac250fix kbmdac260fix kbmsxml300fix kbmsxmlnosweep KB293856 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate