Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,
I am really confused about target platform. For best results, to make my application run on any CPU, what target platform should be used. I tried Any CPU but my application does not run on Windows 7 with Access 2010 installed. It returns an error
The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine

Someone told me to avoid this error, change platform to X86. But I am unable to change that too. Dropdown menu contains only Any CPU.

What to do?
Thanks
Posted

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 20-Nov-11 18:07pm    
My 5. See also my explanation in a nutshell.
--SA
Mehdi Gholam 21-Nov-11 1:51am    
Cheers
This problem is not directly related to target platform. Required component is not installed, that's it.

Now, about using the target platform, in a nutshell:

You can never mix up two different instruction-set architectures in one process. The solution might build but the application may crash during run-time. As a rule of thumb, you should always use "Any CPU" unless some third-party and/or unmanaged components requires any certain target. "Any CPU" is possible as assemblies are JIT-compiled, so the real unmanaged target is defined on the fly when an application is loaded.

How is it defined? When all the assembles of an application are compiled with "Any CPU", the run-time target is defined by that of currently running OS. If all the object libraries are compiled with "Any CPU" but the entry assembly (the one which has an entry point (Main by default) and defines which application to run, normally some *.EXE file) is compiled to target some certain instruction-set architecture, the entry assembly will define the resulting target architecture.

If any two assemblies loaded by the process (no matter how, including references and dynamically loaded assemblies) define two different instruction-set architectures, accept a crash during run time.

[EDIT]

Windows 64-bit platforms also support a 32-bit platform through WoW64, http://en.wikipedia.org/wiki/WOW64[^].
This is actually a 64-bit subsystem used to run 32-bit applications.

Even though 64-bit instruction-set platforms are not compatible with each other (x86-64 vs. IA-64 "Itanium"), they are compatible at the level of 32-bit based on WoW64. See:
http://en.wikipedia.org/wiki/X86-64[^],
http://en.wikipedia.org/wiki/Itanium[^].

Sometimes a .NET application has to be run as 32-bit over WoW64, as not all of 64-bit (usually unmanages) components are available. An attempt to run this application compiled to "Any CPU" will result to running it as a 64-bit application. One way to run it over WoW64 is to recompile just the entry assembly to the instruction-set platform "x86".

—SA
 
Share this answer
 
v3
Comments
Mehdi Gholam 21-Nov-11 1:52am    
Complete, 5'ed
Sergey Alexandrovich Kryukov 22-Nov-11 10:36am    
Thank you, Mehdi.
--SA
Sergey Alexandrovich Kryukov 22-Nov-11 10:47am    
Well, wasn't so complete in fact, updates.
Thank you for your note which reminded me about some more content. :-)
--SA
I didn't understand your question You are saying that it is Platform Problem but your error says that the driver required for establishing connection
are not properly registered on your System.
As you mentioned in your question
VB
"Microsoft.Jet.Oledb.4.0"

is the Provider which is used in ConnectionString to Connect the Access DataBase with Application.You are using MS-Access 2010 and the Provider you
mentioned into the ConetionString i.e "Microsoft.Jet.Oledb.4.0" is used to
Connect with Access 2003.So FindOut the Provider for Ms-Access 2010.I hope it will Solve your Problem.
 
Share this answer
 
v2
Load your project, and from the menu bar, select "Project" then "xxx Properties", where xxx is the name of your project.
In the resulting page, select the "Build" tab.
There is a "Platform Target" drop-down which allows you select "Any CPU", "x86" or "x64"
Close the page and rebuild.
 
Share this answer
 
Comments
Furqan Sehgal 20-Nov-11 7:04am    
Thanks ! I changed it from Build menu. From Any CPU to X86. Can I expect it will run on any systems properly? The error message will be avoided?
OriginalGriff 20-Nov-11 7:08am    
Provided Jet 4.0 is installed, yes.
The problem is that there is (and are no plans to create AFAIK) a 64 bit version of the Jet engine.
Furqan Sehgal 20-Nov-11 7:36am    
So what is better, making in Any CPU or X86?
OriginalGriff 20-Nov-11 7:59am    
If you are using a x86 only version of Jet, then go with x86 - it forces it into the one that works.
To be honest, I develop mostly x86, despite targeting x64 machines and OS. It allows debugging to work (grrrrr) and reduces the size of references from 8 bytes to 4, with no space restrictions as yet.
Furqan Sehgal 20-Nov-11 8:03am    
OK thanks
How can I check the version of Jet installed on my system?
change your access database engine.... problem will be solved... :)
 
Share this answer
 
Comments
Furqan Sehgal 20-Nov-11 8:09am    
Could you elaborate further how to do it?
Thanks

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