TALJr
asked on
Fix for Exception when connecting to an Excel .xls file using .NET.?
I am having difficulty connecting to an Excel .xls file (used as a DB source) in .NET.
When I try to connect using .NET and the following connection string I get an exception:
string strConn = "Provider=Microsoft.Jet.OL EDB.4.0; Data Source = "C:\data.xls; Extended Properties=""Excel 8.0; HDR=YES; """
The exception says that the Microsoft.Jet.OLDDB.4.0 provider is not registered.
I am using VS 2005, and Excel from Microsoft Office 2003.
Does anyone have a fix for this or an alternative solution?
I need to input the data in an Excel file, make changes and then output to an SQL Server 2005 table.
Thanks,
TALJr
When I try to connect using .NET and the following connection string I get an exception:
string strConn = "Provider=Microsoft.Jet.OL
The exception says that the Microsoft.Jet.OLDDB.4.0 provider is not registered.
I am using VS 2005, and Excel from Microsoft Office 2003.
Does anyone have a fix for this or an alternative solution?
I need to input the data in an Excel file, make changes and then output to an SQL Server 2005 table.
Thanks,
TALJr
ASKER
Here's the code:
OleDbConnection Conn = new OleDbConnection;
Conn.ConnectionString = strConn;
Conn.Open()
Thanks,
TALJr
OleDbConnection Conn = new OleDbConnection;
Conn.ConnectionString = strConn;
Conn.Open()
Thanks,
TALJr
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
OleDbConnection con = new OleDbConnection(strConn);