views:

562

answers:

1

I get the following error:

The 'Miccrosoft.Jet.OLEDB.4.0' provider is not registered on the local machine

When I run this code:

string dbConn = @"Provider=Miccrosoft.Jet.OLEDB.4.0;Data Source=C:\structuredfunds.mdb";
string cmdText = "select * from StructuredFundPosition";
DataTable dt = new DataTable();
using (OleDbDataAdapter da = new OleDbDataAdapter(cmdText, dbConn))
{
   da.Fill(dt);
}

using statements are:

using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Data.Odbc;

I'm running on Windows XP SP2, Visual Studio 2008. If I download the MDAC installer and attempt to install I get:

MDAC 2.8 RTM is incompatible with this version of Windows. All of its features are currently part of Window.

Do I need to add any references to my Visual Studio project? I've just System.Data at the moment.

Also is OleDb the best way to communicate with Microsoft Access?

Thanks

+2  A: 

You have a typo in the connection string. Instead of:

Provider=Miccrosoft

it should read:

Provider=Microsoft
Stephan Keller
ahh of course, thank you for pointing out my oversite!
m3ntat