Error While making connection with Excel File

Vishal Goyal

Vishal Goyal

May 17 2014 8:08 AM

m trying to make connection with Excel. I have used many of connection string But no one is working.

**Connection String 1 Gives error-**The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.


1-var ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Filepath + ";Extended Properties=Excel 8.0"

This Connection string Gives error string "Unspecified error"

2-var ConStr= "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="+Filepath+";Extended Properties=\"Excel 12.0 Xml;HDR=Yes;IMEX=1;\"";

        using (var conn = new OleDbConnection(ConStr)) {             conn.Open(); }

How to Choose right Connection string?

MY System Configuration:

Window Server 2008 R2 Sp1 Microsoft office 64 Bit. Visual Studio 2010 Professional

Upload Source Code  Select only zip and rar file.
Answers (3)