Microsoft KB Archive/814110

= &quot;Cannot Open File&quot; Error Message When You Try to Open a File by Using ADO in a BizTalk Preprocessor =

Article ID: 814110

Article Last Modified on 1/10/2007

-

APPLIES TO


 * Microsoft BizTalk Server 2002 Standard Edition
 * Microsoft BizTalk Server 2000 Standard Edition

-



SYMPTOMS
When you call the ADO Stream LoadFromFile method from a custom Microsoft BizTalk preprocessor to open the file that is provided in the vDataIn variable, you receive a &quot;cannot open file&quot; error message that states that the file is in use by another process.



CAUSE
This problem occurs because the ADO Stream LoadFromFile method does not use the correct attributes to open the file.

When the BizTalk File Receive function opens the file, it uses the following attributes:
 * FILE_SHARE_READ|FILE_SHARE_DELETE
 * GENERIC_WRITE

When the ADO Stream LoadFromFile method tries to open the file, it uses the following attributes:
 * FILE_SHARE_READ
 * GENERIC_READ

The ADO Stream LoadFromFile method cannot open a file that has been opened previously by using the attributes that BizTalk used to open the file. The file must be opened by using the following attributes:
 * GENERIC_READ
 * FILE_SHARE_READ|FILE_SHARE_WRITE



WORKAROUND
To work around this problem, do one of the following:
 * Copy the contents of the file to another location, and then load the file in the ADO Stream.

-or-
 * Use another API to gain direct access to the file by using the following attributes:
 * GENERIC_READ
 * FILE_SHARE_READ|FILE_SHARE_WRITE



STATUS
This behavior is by design.

Keywords: kberrmsg kbprb KB814110

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.