Recently, a pdf.net user asked me how I could not access the Access database under a 64-bit system, and my first reaction was how did I not meet it? Today I see that my vs and office are all 32-bit versions, so debugging access in VS is no problem, but directly using compiled. NET program accesses access, there is a problem, reported:
The "microsoft.jet.oledb.4.0" provider is not registered on the local computer.
So, in the company's computer (Win7 64) Did the experiment, found that with the home Win8.1 64-bit problems, Internet search, most of them are recommended. NET program compile, the target platform is set to x86, I tried, and sure enough success.
But, if you are. NET program is compiled by others, and run on 64-bit systems, to access the Access database, how to do?
First think, see whether the application configuration file, the. NET program to run in 32-bit system, find a long data, no results, give up.
Think again, is not with your office is 32 bit about it?
The key question is not that access 2010 or access 2013, not a bit of a bit, why not the second, install an Access 2007/2010 database engine is not OK.
Workaround:
① Download Install Microsoft Access Database Engine Redistributable (28MB), total 32bit (download) and 64bit (download) two versions, Specifically to install which depends on your program is 32bit or 64bit, such as: My PC is 64bit Win8 Pro, but I developed the program is 32bit, so I should install AccessDatabaseEngine.exe (32bit);
② Open your. NET application configuration file (application name. Config,web application is Web. config), set provide microsoft.ace.oledb.12.0 for the database connection string, such as the standard connection string: "Provider= Microsoft.ace.oledb.12.0;data source=data.accdb; Persist Security info=false; "
Run the program again, OK, the database connection is successful, everything is fine.
Note: Under 64-bit systems, be sure to modify the provider to microsoft.ace.oledb.12.0, and at this point the file name can be an earlier MDB file, or it can be a new ACCDB file.
This issue is affected by the Pdf.net development Framework related programs:
1,simpleaccesswinform program, pdf.net_v4.6 WinForm data Form instance
example, 526K, uploaded Mar, 2013-809 downloads
After running the program, please modify the contents of the Simpleaccesswinform.config file, if it is the first run, the program will automatically create the file and automatically create a database file , file content such as:
<?XML version= "1.0" encoding= "Utf-8"?><Configuration> <connectionStrings> <Addname= "Accessconn"connectionString= "Provider=microsoft.ace.oledb.12.0;data Source=test.mdb"ProviderName= "Access" /> </connectionStrings></Configuration>
2,pdf.net Integrated development tool: Setup program
application, 1576K, uploaded, 2011-1943 downloads after downloading, locate the subdirectory config under the running directory, and then open the configuration file Dataconnectioncfg.xml to find the relevant configuration section:
<?XML version= "1.0" encoding= "Utf-8"?><dataconnections> <GroupName= "Default Grouping"> <ConnectionDbType= "SQL Server"Name= "Default"ConnectionString= "Data source=.;i ntegrated security=true " /> <ConnectionDbType= "SQL Server"Name= ". \SQLExpress"ConnectionString= "Data source=.\sqlexpress;integrated security=true" /> <ConnectionDbType= "SqlServerCe"Name= "SQLCE"ConnectionString= "Data source=e:\dac\localdb.sdf; Password=sasa; Persist Security info=true " /> </Group> <GroupName= "xx two period"> <ConnectionDbType= "SQLite"Name= "SQLite"ConnectionString= "Data source=e:\jjzd.db"Provider= "Pwmis." Dataprovider.data.sqlite,dataaccess "/> <ConnectionDbType= "SQL Server"Name= "192.168.50.1"ConnectionString= "Server=192.168.50.5;uid=sa;pwd=sasa"Provider=""/> </Group> <GroupName= "Group 2"> <ConnectionDbType= "Access"Name= "Default"ConnectionString= "Provider=microsoft.ace.oledb.12.0;data Source=test.mdb"Provider= "Access"/> <ConnectionDbType= "SQL Server"Name= "50.25"ConnectionString= "Server=192.168.50.25;uid=sa;pwd=sasa"Provider=""/> </Group></dataconnections>
With this configuration, you can open the integrated development tools directly, such as:
Summarize:
64-bit system. NET access to an Access database, the most thorough way is to install the 64-bit Access data Access Driver installer and use the new access provider microsoft.ace.oledb.12.0