2

I am developing a C# Windows Form Application which read and write data to Excel file such as data.xls

I have made my connection string as:

string Excel03ConString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties='Excel 8.0;HDR=YES'";

My data.xls file is in Project's bin folder. I am working on this application from last 4 to 5 days. Till now, my application was working fine. But from today, it starts giving an error

Unexpected error from external database driver (1).

on con.open();

3
  • maybe your directory permissions have changed? is it a good ide to acces files from a Bin folder? They should relaly be cleared down when cleaning your solution etc.. Commented Oct 12, 2017 at 9:41
  • I suggest you checking the workbook/worksheet name & file permission. There are multiple causes such like linked worksheet, custom naming or other unexplained ones, hence a stack trace/exception detail may necessary. Commented Oct 12, 2017 at 9:44
  • File has full access. Last night, my system has been updated. Is there any connection of this with the error. Even one of my installed windows form app that use Excel file, starts throwing same exception. Commented Oct 12, 2017 at 9:56

2 Answers 2

3

It seems to be an error introduced by the last Windows Update.

To avoid this error you can change the provider in connection string to Microsoft.ACE.OLEDB.12.0 instead of Microsoft.Jet.OLEDB.4.0.

https://blogs.msdn.microsoft.com/dataaccesstechnologies/2017/10/18/unexpected-error-from-external-database-driver-1-microsoft-jet-database-engine-after-applying-october-security-updates/

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. When I create setup of my app and using Microsoft.ACE.OLEDB.12.0 in my connectionstring and then install that setup on a machine which is not updated, then how to handle this case. I think it will give error in such scenario.
If it gives error you should install Microsoft Access Database Engine Redistributable from microsoft.com/it-it/download/details.aspx?id=13255
2

Remove the following KB to solve this problem
Windows 10 Version 1703 - KB4041676
Windows 10 Version 1607 and Windows Server 2016 - KB4041691
Windows 8.1 and Windows Server 2012 - KB4041693
Windows 7 and Windows Server 2008 R2 - KB4041681
Due to the windows update on the second week of October 2017

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.