troubleshooting Question

Provider is not registered error

Avatar of karlhsc
karlhscFlag for Afghanistan asked on
.NET ProgrammingC#ASP.NET
7 Comments1 Solution843 ViewsLast Modified:
Hello.  I am developing a C#.NET application that allows the user to upload an Excel 2007 file.  My .NET application then parses through the Excel file and ultimately inserts some data from the Excel file into a MSSQL database.

Currently, my application successfully allows for the upload of the Excel file to occur, but it is having trouble reading from it.  The code is below.

string connectionString = @"Provider=Microsoft.Jet.OLEDB.12.0; Data Source=\\\shares\fiscal\general services\copfs1\aspnet\elb\DO_NOT_DELETE.xlsx;Extended Properties=""Excel 12.0;HDR=YES;""";

DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.OleDb");

DbDataAdapter adapter = factory.CreateDataAdapter();

DbCommand selectCommand = factory.CreateCommand();

selectCommand.CommandText = "SELECT Last Name, First Name,Banner ID FROM [getreport$]";
DbConnection connection = factory.CreateConnection();
connection.ConnectionString = connectionString;
selectCommand.Connection = connection;

adapter.SelectCommand = selectCommand;
DataSet NewExcelFile = new DataSet();

When the program flow reaches the last line in this code block, I get a "The 'Microsoft.Jet.OleDb.12.0' provider is not registered on the local machine." error.  My local PC is running a 32-bit version of Windows XP Pro and I have Office 2007 installed.

Thank you in advance.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros