c# - The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine while data export to MS ACCESS -


i beginner in using microsft.ace.oledb 12.0. create winforms application vs 2010.

and create function export data grid data ms access file. using microsoft oledb

for export data grid data ms access file.but error when try export

the

data ms access.

please see below image.

enter image description here

i refer microsoft.office 12.0 object library in application.

enter image description here

batch build configuration

enter image description here

please help.

the reference access interop bits has nothing exception , access interop not necessary use classes in system.data.oledb.

the problem arises when have application compiled anycpu platform, running on 64bit system , installed ado.net provider (microsoft ace.oledb.12.0) 32bit version.

when using anycpu target platform code executed 64bit code on 64bit systems , 32bit code on 32bit systems. application executed 64bit cannot use 32bit drivers (and viceversa). add mix fact microsoft.ace.oledb.12.0 has 2 different versions. 1 64bit , and 1 32bit , cannot installed on same machine.

the simplest workaround change target platform of application through visual studio menu

 build -> configuration manager -> active solution platform -> x86 

if x86 option not there, select new, name x86, copy settings anycpu , check create new project platforms

if think using 32bit app on 64bit operating system loss of performance or avoided think twice , read this reference pro , cons of anycpu critically examined. if don't have specific reason use anycpu better stay x86.

of course, option deinstall 32bit version , install 64bit version of ace from here , run application anycpu on 64bit systems. nightmare deployment scenarios. if microsoft office 32bit version installed on x64 target machine? office installs bit compatible version of ace and, said, not possible have 32bit , 64bit of ace installed on same machine.
should ask customer reinstall office 64bit keep 64bit app happy.

update


situation has changed bit newest versions of visual studio. there new option default new projects. called anycpu prefer 32bit mode. more details @ link: what anycpu means of .net 4.5 , visual studio 11 , interesting post (albeit regarding sql server compact) 1 the trouble cpu–prefer 32 bit–badimageformatexception


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -