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.
Filepath="C:\"
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

Anupam SinghRank #643 · 3.7K reputationPosted May 17, 2014, 5:18 AM EDT
It seems you have'nt registered DSN for excel.
Read this will definetely help you :http://c-sharp-tutorials-4-0.blogspot.in/2012/05/connect-to-excel-using-odbc-in-c.html
Vishal Goyal11 reputationPosted May 18, 2014, 1:24 AM EDT
Can't I make the coneection using OleDbConnection??
Anupam SinghRank #643 · 3.7K reputationPosted May 18, 2014, 4:28 AM EDT