The information in this article applies to:
SYMPTOMSOpening the connection on a read-only Microsoft Access Database (.mdb file on a CD-ROM, a floppy disk that is write protected, or a hard disk that is read-only to the user, and so forth) with the following code causes an error to occur. The following code opens a connection on a Microsoft Access database file on a CD-ROM:
It causes the following error:
CAUSEThe Jet OLEDB provider opens databases, by default, in Read/Write mode. Jet requires the creation of a locking file (.ldb file) in order to open a database file in shared access mode. If you request shared access mode, Jet attempts to create the locking file, which fails on read-only media. If you open a database using exclusive mode, Jet does not need to create the locking file. RESOLUTION
Open the database in read-only and exclusive mode. You can do this by
setting the Mode property of the connection object to adShareDenyWrite.
REFERENCESThe following Microsoft Knowledge Base article describes the same problem and a resolution when using Data Access Object (DAO): Q191737 PRB: DAO MDB on Read-Only Media Must Be Opened ExclusivelyMicrosoft Developer Network Library, Visual Studio 6.0; search on: Microsoft Data Access SDK Additional query words:
Keywords : kbADO200 kbDatabase kbJET kbMDAC kbODBC kbSweepNext |
Last Reviewed: November 10, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |