tags:

views:

164

answers:

2

I am using OLEDB to connect .mdb/.accdb file.

I am writing code like this

using System.data.OLEDB;

class dbconne { ..... ......... ....... . . . .

OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\db1.mdb");

OleDbCommand aCommand = new OleDbCommand("select * from emp_test", aConnection);

aConnection.Open(); .... .... . . . }

Now i run this code i didn't get any compile errors. But it give runtime error

ERROR is : "Microsoft.Jet.OLEDB.4.0" provider is not registered on the local machine

can any one tell solution for this plzz

A: 

See if you have Microsoft Data Access Components installed.

Jet Oledb provider is part of the above components & should be present for you to connect to the database using the appropriate provider.

On a side note, this should be a part of the operating system (I guess).
Is this your development machine, with .net framework installed?

shahkalpesh
A: 

Microsoft.Jet OLEDB 4.0 is part of Microsoft Access or the Microsoft Access Runtime. You could try installing Jet Service Pack 8, but if that doesn't work, you will need Access or the Access Runtime. Jet 4.0 is supposed to come with Windows XP.

Starting with Microsoft Data Access Components (MDAC) version 2.6, MDAC no longer contains the Jet components, so installing MDAC won't work.

Robert Harvey
hmmm. I didnt know that. But I think, it is installed as part of .net framework. right?
shahkalpesh
No, I don't think so. It is a deprecated COM technology.
Robert Harvey