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 SinghPosted May 18, 2014, 8:28 AM
Vishal GoyalPosted May 18, 2014, 5:24 AM
Can't I make the coneection using OleDbConnection??
Anupam SinghPosted May 17, 2014, 9:18 AM
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