Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
After oledb inset in Excel, 'Cannot Access file' error on Excel
Hi,
I have C# code that uses Jet.OLEDB.4.0 to write to an excel file. After performing inserts using an 'insert into' SQL query, I close the connection and reopen the file using excel objects for performing some other operations on the file. If the data being written using oledb is large (more than 1K records), excel throws an error 'Cannot Access File' while opening the file using Excel objects. If the data is less around 500 records, the exception is not thrown. I feel the reason for exception is that before the file is released by oledb, the excel objects try to operate on it. How do I make sure that the oledb has finished its writing and the file is released, so that excel does not throw exception. Thanks & regards, Prachi |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
After oledb inset in Excel, 'Cannot Access file' error on Excel
Is there a background setting that allows the writing to be done
asynchronously - if so, set that to false so the code does not continue until the writing is done. -- Regards, Tom Ogilvy "Prachi" wrote in message m... Hi, I have C# code that uses Jet.OLEDB.4.0 to write to an excel file. After performing inserts using an 'insert into' SQL query, I close the connection and reopen the file using excel objects for performing some other operations on the file. If the data being written using oledb is large (more than 1K records), excel throws an error 'Cannot Access File' while opening the file using Excel objects. If the data is less around 500 records, the exception is not thrown. I feel the reason for exception is that before the file is released by oledb, the excel objects try to operate on it. How do I make sure that the oledb has finished its writing and the file is released, so that excel does not throw exception. Thanks & regards, Prachi |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
After oledb inset in Excel, 'Cannot Access file' error on Excel
Hi Tom,
Thanks a lot!! I did find a registry setting that enforces synchronous writes on Oledb Jet provider. Thanks again, Prachi "Tom Ogilvy" wrote in message ... Is there a background setting that allows the writing to be done asynchronously - if so, set that to false so the code does not continue until the writing is done. -- Regards, Tom Ogilvy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
File access error in Excel | Excel Discussion (Misc queries) | |||
Microsoft.Jet.OLEDB error with csv file names | Excel Discussion (Misc queries) | |||
When opening Excel - get Access (Read-Only) file and error | Setting up and Configuration of Excel | |||
i cannot open excel file error Cannot access read-only document me | Excel Worksheet Functions | |||
Query OLEDB Provider for Excel file info? | Excel Programming |