PRB: Error Opening an ADO Recordset from a File (294424)
The information in this article applies to:
- Microsoft Data Access Components 2.5 SP1
- Microsoft Data Access Components 2.6
- Microsoft Data Access Components 2.7
- ActiveX Data Objects (ADO) 2.1
- ActiveX Data Objects (ADO) 2.5
- ActiveX Data Objects (ADO) 2.6
- ActiveX Data Objects (ADO) 2.7
This article was previously published under Q294424 SYMPTOMS
When you attempt to open an ActiveX Data Objects (ADO) Recordset object using a file which is already open for writing as the Recordset source, the following error may occur:
Run-time error '-2147024864 (80070020)':
The process cannot access the file because it is being used by another process.
This error does not occur in Microsoft Data Access Component (MDAC) version 2.5 or earlier.
CAUSE
With MDAC 2.5 Service Pack 1 (SP1) and later, the Open method of the ADO Recordset object does not allow you to open a file that is already open for writing. This change was made to prevent problems with concurrent access.
RESOLUTION
You can work around this problem in the following ways:
- Make sure that the file is not opened for writing before you attempt to access it through ADO.
- Make a copy of the file and open the copy through ADO.
- If you are using ADO to access an XML file, you can also use the XML Document Object Model (DOM) to load and parse the XML data from the file.
Modification Type: | Major | Last Reviewed: | 5/12/2003 |
---|
Keywords: | kbMSXMLnosweep kbprb KB294424 |
---|
|