Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using windows 7 and Visual studio 2008 and
i use the following code to access database,

mycon = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\ETMS\etms.mdb;Persist Security Info=False");


When I create the connection and do open(), it throws exception with the following msg:
'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine<br />


Can any hepl me to solve the problem
Posted
Updated 5-Jun-11 23:12pm
v2

Try changing platform from Any CPU to x86.
 
Share this answer
 
Comments
pankajupadhyay29 6-Jun-11 5:36am    
this will work for sure.
Sergey Alexandrovich Kryukov 6-Jun-11 15:47pm    
OP's comment says it's 64-bit OS, therefore, using x86 can help, my 5.
--SA
Ragi Gopi 7-Jun-11 0:14am    
@Prerak Patel
thanks...
changed Target from 'Any Cpu' to x86..
If you haven't found a solution, first re-install MDAC and install the latest JET service pack

MDAC can be found here
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=78cac895-efc2-4f8e-a9e0-3a1afbd5922e[^]

(Restart system after installing MDAC & before installing Jet Service pack)

If you're using Windows XP, download Jet service pack here
http://download.microsoft.com/download/a/d/f/adfdf363-0b09-4f39-bf89-1b4bc234fe97/windowsxp-kb829558-x86-enu.exe[^]
For other OS visit this page
http://support.microsoft.com/kb/239114[^]
 
Share this answer
 
Comments
Ragi Gopi 6-Jun-11 5:34am    
@strogg
iam using windows7, 64 bit OS
strogg 6-Jun-11 10:17am    
In that case, as the other person pointed out, change the platform target from Any CPU to 'x86'.
In the solution explorer, right click on your project & click properties. Go to Build (or compile) tab and change Target from 'Any Cpu' to x86 (for both debug and release). It'll mostly work. Also give x64 a try. Let me know if it works.
Sergey Alexandrovich Kryukov 6-Jun-11 15:46pm    
I guessed that's a problem. Mixing different instruction-set architecture in one process will not work. Look at the answer by Prerak.
--SA
strogg 6-Jun-11 19:13pm    
??? I think i just said the same thing. And you cannot "mix" different instruction families in one executable at all.
Ragi Gopi 7-Jun-11 0:13am    
thanks...
changed Target from 'Any Cpu' to x86....
Switched the target CPU in Advanced Compile Options to x86 bit application.
 
Share this answer
 
Comments
Ragi Gopi 6-Jun-11 6:35am    
@Uday P.Singh
its worksss
Thanks
Uday P.Singh 6-Jun-11 6:45am    
welcome :) please accept the answer
Sergey Alexandrovich Kryukov 6-Jun-11 15:48pm    
This was already suggested by Prerak, so I voted to his answer; and this one was done later and is redundant.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900