Open ms-access .mdb in 32 and 64bit windows using c# - c#

I use a connectionstring like "Provider=Microsoft.Jet.OLEDB.4.0;..." to open a .mdb database.
Moving to a 64bit computer this does not work anymore since there is no 64 bit implementation.
My understanding is that it is done this way because Jet is deprecated.
There is one workaround in which you compile your application to run as 32bit only.
What are we supposed to move to?
Is there a new provider that works in both 32 and 64 bit?

Did you try this SO: 64-bit Alternative for Microsoft Jet?

What are we supposed to move to?
SQL Server Express 2008 R2. The move to SQL Server Expres was announced about 10 years ago.
Is there a new provider that works in both 32 and 64 bit?
Your definition of new is 10 years old :)

Change the target platform of the application to x86 instead of 'any cpu'.
By doing so, your app will run under WOW64-mode on 64bit systems, and will use the 32bit Jet provider.

Related

Deploying application using SQL Server CE 4.0 SP1 using "Any CPU"

I am planning to create an application which uses SQL Server CE 4.0 SP1 using private deployment.So now i am planning to use private deployment. So all the dll must be included in the project as explained here.
But I tried just adding all dll from my XP PC (32 bit) and not added any 64 bit dlls (but it was mentioned to add 64 bit dlls). Then i set platform to "Any CPU". After building application i tried running my application in a 64 bit PC and it worked properly!!! I was expecting it would give error as i have not included 64 bit dlls.
Then I used isWow64Process api to check whether the application is really running on 64 bit. It returned false when i set "any cpu" and 64 bit, means it runs on 64 bit.When i set to x86 it returns true which means it is running under wow64(as 32 bit process). If I set it to x64 it works properly in 64 bit pc, but SQL Server CE dlls are of 32 bit. why does this happen? My plan is to use "Any cpu" so that it works as 32 bit in 32 bit PC and 64 bit process in 64 bit pc. So what i am missing. Why does it work even if i set any cpu or x64?
EDIT:
I have found the reason why it was working on 64 bit PC.its because the pc already had SQL CE 4.0 SP1 installed. So application used dll from installed path instead of using files from app path where it had 32 bit dll which dont support 64 bit application(any cpu).
But now I am following the link mentioned above and added x86 and AMD64(not x64 as mentioned in that link) folder and corresponding dlls and Microsoft.VC90.CRT dlls properly, it works properly on windows 7(.net 3.5 by default- sql ce is not installed). In windows XP sp3 (fresh install with only OS) I installed .net 2.0 and then run my application. It worked!!
1) So does SQL CE 4.0 SP1 private deployment require .net 3.5? Will it cause any other problem if i use only .net 2.0?
2)I found like we need to modify app.config to refer to the Private ADO.NET provider, which has assembly version 4.0.0.1, not 4.0.0.0 as the on in the GAC which is mentioned here I have not done this and it and my application worked properly. So is it required to do? If i don't add it will it cause error in any .net framework?
3) I have not included System.Data.SqlServerCe.Entity dll. I am using SqlCeConnection to connect to database. So is there any need of adding System.Data.SqlServerCe.Entity dll? Also some where i found like this dll require .net 3.5 so microsoft recommends installing .net 3.5 for private deployment of SQL CE 4.0 SP1(related to my 1st question)?
You can download my project here

32 bit office running on 64 windows platform c# connection string [duplicate]

I created a windows application developed in .NET 3.5 in a 32 bit Windows 2008 server. When deployed the application in a 64 bit server it shows the error "Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine ".
So as a solution to this issue, i have changed the build property of the project to X86, so that it will build in 32 bit mode, and rebuild the project in the 32bit machine. But, the same project uses other DB drivers (DB2, SQL etc.) to connect to other databases. So when i deployed my app again in the 64 bit OS, it throws the exception " Attempted to load a 64-bit assembly on a 32-bit platform. "
I am using the Microsoft.Jet.OLEDB.4.0 driver to read and write to the Excel (.xls)
I found a solution for this problem. The issue I described in my question occured basically due to the incompatibility of the Microsoft.Jet.OLEDB.4.0 driver in 64 bit OS.
So if we are using Microsoft.Jet.OLEDB.4.0 driver in a 64 bit server, we have to force our application to build in in 32 bit mode (This is the answer I found when I did an extensive search for this known issue) and that causes other part of my code to break.
Fortunately, now Microsoft has released a 64 bit compatible 2010 Office System Driver which can be used as replacement for the traditional Microsoft.Jet.OLEDB.4.0 driver. It works both in 32 bit as well as 64 bit servers. I have used it for Excel file manipulation and it worked fine for me in both the environments. But this driver is in BETA.
You can download this driver from Microsoft Access Database Engine 2010 Redistributable
If the issue persist in ASP.NET,All I had to do was change the "Enable 32-bit Applications" setting to True, in the Advanced Settings for the Application Pool.
I have the same problem
Microsoft.Jet.OLEDB.4.0' provider is not registered on the local
machine
I applied the answer by neo but it did not work until I change the provider to “Provider=Microsoft.ACE.OLEDB.12.0;” in connection string.
Hope this will help if some one face the same issue.
I know it's quite old questions and many persons has answered. but I am summarizing the things for understanding:
If the file extension is xls and OS is 32 bit then only you can use "Microsoft.Jet.OLEDB.4.0". Microsoft has not released 64 bit version of this driver.
If file extension is xlsx or OS is 64 bit then you must have to use "Microsoft.ACE.OLEDB.12.0". The application compiled in 32/64 bit mode does not impact the selection of driver.
Always install the 64 bit driver of Microsoft.ACE.OLEDB.12.0 on OS 64 bit. If you have already installed Office 32 bit then you need to run driver from cmd with /passive argument. This hack works till Office 2013 only, Microsoft stopped this workaround from Office 2016 for Microsoft.ACE.OLEDB.16.0 drivers.
AccessDatabaseEngine_x64.exe /passive
Download drivers Microsoft.ACE.OLEDB.12.0
private void ProcessFile(string path)
{
string connString = string.Empty;
if (Path.GetExtension(path).ToLower().Trim() == ".xls" && Environment.Is64BitOperatingSystem == false)
connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";
else
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";
}
If Application is compiled with AnyCPU flag, it will look for 64 bit Access drivers on 64 bit OS and 32 bit access drivers on 32 bit OS.
If your application runs on localIIS, You can solve this problem by enabling 32-bit applications in AppPool's Advanced Settings
I've the same message, I have a webpage with do on visual studio 2010, I read a file.xls on that page,in my project visual has not any problem, when I put it on my IIS local throw me a 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine'
,I fixed that problem next following this steps,
1.-Open IIS
2.-Change the appPool on Advanced Settings
3.-true to enable to 32-bit application.
and that's all
ps.I changed Configuration Manager to X86 on Active Solution Platform
I had the same issue. I changed the application configuration to x86, then it worked!
I just Changed my Property of project into x64 format
Project---> Properties--->Build--->Target Framework---> X64
We have come across this issue in desktop app.
Dev Environment:
Windows 7 Ultimate - 64 bit
.Net Framework 4.5
Provider=Microsoft.Jet.OLEDB.4.0
It has been resolved by changing Platform target to X86 from Any CPU.
Project Properties >> Build >> Platform Target.
I ran into this issue with my desktop application ('Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine). I did not have the option to build as a 32 bit app. Hoping this would help others in the same situation.
I did the following and the issue went away:
Installed the 64 bit version of Microsoft Access Database Engine
2010 Redistributable, as suggested by neo
Changed my provider to Microsoft.ACE.OLEDB.12.0
Although a more optimal solution is to simply recompile as suggested above, that requires access to the source code. In my case, I only had the finished .exe and had to use this solution. It uses CorFlags.exe from the .Net SDK to change the loading characteristics of the application.
Download the .Net Framework SDK (I personally used 3.5, but the version used should be at or above the required .Net for your application.
When installing, all you need is CorLibs.exe, so just check Windows Development Tools.
After installation, find your CorFlags.exe. For my install of the .Net Framework 3.5 SDK, it was at C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin.
Open a command prompt and type path/to/CorFlags.exe path/to/your/exeFile.exe /32Bit+.
You're done! This sets the starting flags for your program so that it starts in 32 bit WOW64 mode, and can therefore access microsoft.jet.oledb.4.0.
Change in IIS Settings application pool advanced settings.Enable 32 bit application
Just Change the property based on your machine and all have done :-)
Project---> Properties--->Build--->Target Framework---> X64
or
Project---> Properties--->Build--->Target Framework---> X86
I have changed my connection string from
var myConnectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Persist Security Info=True;Jet OLEDB:Database Password=;",gisdbPath);
to this:
var myConnectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Mode=Share Deny None;Data Source={0};user id=Admin;password=;", gisdbPath);
It works fro me never asked for Microsoft.Jet.OLEDB.4.0'registered.
There is indeed no 64 bit version of Jet - and no plans (apparently) to produce one.
You might be able to use the ACE 64 bit driver:
http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=23734
but I have no idea how that would work if you need to go back to Jet for your 32 bit apps.
However, you may be able to switch the project to 32bit in the Express version (I haven't tried and don't have 2008 installed in any flavour anymore)
there is a thread here that talks about it:
http://xboxforums.create.msdn.com/forums/t/4377.aspx#22601
Maybe it's time to scrap Access databases altogether, bite the bullet and go for SQL server instead?
I'm using VS2013 for Winforms, the below solution worked for me.
Download : http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=23734
Then Set VS Target Platform to x86.
In older versions of IIS, you will not find Advance Settings so to enable Enable 32-bit Applications you have to execute the following commands:
cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1
and
%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i
Reference : Here
I was getting same exception while running "SQL Server 2014 Import and Export Data (64-bit)" on my Windows 8.1.
To fix the issue this issue I have done the following
started SQL Server 2014 Import and Export Data (32-bit) instead of 64-bit and it is working for me. I haven't changed any IIS setting and not installed any extra software.
I know that I have this problem over and over when I deploy my application on a new server because I'm using this driver to connect to a Excel file. So here it is what I'm doing lately.
There's a Windows Server 2008 R2, I install the Access drivers for a x64 bit machine and I get rid of this message, which makes me very happy just to bump into another.
This one here below works splendidly on my dev machine but on server gives me an error even after installing the latest ODBC drivers, which I think this is the problem, but this is how I solved it.
private const string OledbProviderString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\OlsonWindows.xls;Extended Properties=\"Excel 8.0;HDR=YES\"";
I replace with the new provider like this below:
private const string OledbProviderString = #"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\OlsonWindows.xlsx;Extended Properties='Excel 12.0;HDR=YES;';";
But as I do this, there's one thing you should notice. Using the .xlsx file extension and Excel version is 12.0.
After I get into this error message Error: "Could Not Find Installable ISAM", I decide to change the things a little bit like below:
private const string OledbProviderString = #"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\OlsonWindows.xls;Extended Properties='Excel 8.0;HDR=YES;';";
and yes, I'm done with that nasty thing, but here I got another message The Microsoft Access database engine cannot open or write to the file 'time_zone'. It is already opened exclusively by another user, or you need permission to view and write its data. which tells me I'm not far away from solving it.
Maybe there's another process that opened the file meanwhile and all that I have to do is a restart and all will take start smoothly running as expected.
go to Start->Run and type cmd
this starts the Command Prompt
(also available from Start->Programs->Accessories->Command Prompt)
type cd .. and press return
type cd .. and press return again (keep doing this until the prompt shows :> )
now you need to go to a special folder which might be c:\windows\system32 or it might be c:\winnt\system32 or it might be c:\windows\sysWOW64
try typing each of these eg
cd c:\windows\sysWOW64
(if it says The system cannot find the path specified, try the next one)
cd c:\windows\system32
cd c:\winnt\system32
when one of those doesn't cause an error, stop, you've found the correct folder.
now you need to register the OLE DB 4.0 DLLs by typing these commands and pressing return after each
regsvr32 Msjetoledb40.dll
regsvr32 Msjet40.dll
regsvr32 Mswstr10.dll
regsvr32 Msjter40.dll
regsvr32 Msjint40.dll
There isn't a 64 bit provider for Jet. If you want to support multiple DB sources including Jet to Excel you will need at least that part of your application to run in a 32 bit process.
The error you are getting when you compile for x86 is a bit strange. I can't see how you would end up referencing 64 bit assemblies in this case.

Connecting Visual C# 2008 to MS Access 2010 x64

I'm trying to connect to one of my MS Access databases in Visual C# 2008, problems is the MS Access 2010 is x64 and I'm using Windows 7 x64 and it doesn't see any Access driver for 64 bit architecture in ODBC, so my question is, is there any drivers available or fix for it or do I have to reinstall MS Access in x86?
I know I can use SQL for the database but would prefer to use Access as its easier for me.
Thanks in advance
"Currently Microsoft does not have any 64 bit ODBC drivers available for the Office products.
However, as long as the application that you want to connect to is 32 bit, you can use the 32 bit ODBC drivers to create the DSN. To get to the 32 bit ODBC drivers, the 32 bit Data Source administrator must be used. The 32 bit Data Source administrator must be launched directly if you are using a 64 bit OS. The file should be located at the following path:c:\windows\sysWOW64\odbcad32.exe..."
From the following link : http://answers.microsoft.com/en-us/office/forum/officeversion_other-access/64-bit-driver-for-dsn-for-ms-access-database/be8c0ad4-d8fd-48e0-9026-b95d84135820
You have to force your VS project(s) to use x86 processers:
double click the
then set the Platform target

oracle error in windows-7 64bit

I installed windows-7 64 bit. When I try to run my program (that works with Oracle 11g) I get this error:
Attempt to load Oracle client libraries threw BadImageFormatException
this problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed
What can be the problem ? Where I can download 64 bit oracle client ?
(can I get any link for download)
thanks in advance
Have you tried download the 64bit Oracle Client from:
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win64soft-094461.htmlBlockquote
This looks like it might be the correct download:
Oracle Database 11g Release 2 Client (11.2.0.1.0) for Microsoft Windows (x64)
win64_11gR2_client.zip (615,698,264 bytes) (cksum - 2947608743)
Contains the Oracle Client Libraries. Download if you want the client libraries only
Alternatively, if you cannot obtain a 64 bit version of the Oracle client and are stuck with the 32 bit version, then you can either:
rebuild your .NET application to
only run as a 32 bit (x86) process
instead of "Any CPU" or
use CorFlags.exe (CorFlags
Conversion Tool) to reconfigure
your existing .NET application exe
to run as 32 bit without having to
rebuild it.

Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine

I created a windows application developed in .NET 3.5 in a 32 bit Windows 2008 server. When deployed the application in a 64 bit server it shows the error "Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine ".
So as a solution to this issue, i have changed the build property of the project to X86, so that it will build in 32 bit mode, and rebuild the project in the 32bit machine. But, the same project uses other DB drivers (DB2, SQL etc.) to connect to other databases. So when i deployed my app again in the 64 bit OS, it throws the exception " Attempted to load a 64-bit assembly on a 32-bit platform. "
I am using the Microsoft.Jet.OLEDB.4.0 driver to read and write to the Excel (.xls)
I found a solution for this problem. The issue I described in my question occured basically due to the incompatibility of the Microsoft.Jet.OLEDB.4.0 driver in 64 bit OS.
So if we are using Microsoft.Jet.OLEDB.4.0 driver in a 64 bit server, we have to force our application to build in in 32 bit mode (This is the answer I found when I did an extensive search for this known issue) and that causes other part of my code to break.
Fortunately, now Microsoft has released a 64 bit compatible 2010 Office System Driver which can be used as replacement for the traditional Microsoft.Jet.OLEDB.4.0 driver. It works both in 32 bit as well as 64 bit servers. I have used it for Excel file manipulation and it worked fine for me in both the environments. But this driver is in BETA.
You can download this driver from Microsoft Access Database Engine 2010 Redistributable
If the issue persist in ASP.NET,All I had to do was change the "Enable 32-bit Applications" setting to True, in the Advanced Settings for the Application Pool.
I have the same problem
Microsoft.Jet.OLEDB.4.0' provider is not registered on the local
machine
I applied the answer by neo but it did not work until I change the provider to “Provider=Microsoft.ACE.OLEDB.12.0;” in connection string.
Hope this will help if some one face the same issue.
I know it's quite old questions and many persons has answered. but I am summarizing the things for understanding:
If the file extension is xls and OS is 32 bit then only you can use "Microsoft.Jet.OLEDB.4.0". Microsoft has not released 64 bit version of this driver.
If file extension is xlsx or OS is 64 bit then you must have to use "Microsoft.ACE.OLEDB.12.0". The application compiled in 32/64 bit mode does not impact the selection of driver.
Always install the 64 bit driver of Microsoft.ACE.OLEDB.12.0 on OS 64 bit. If you have already installed Office 32 bit then you need to run driver from cmd with /passive argument. This hack works till Office 2013 only, Microsoft stopped this workaround from Office 2016 for Microsoft.ACE.OLEDB.16.0 drivers.
AccessDatabaseEngine_x64.exe /passive
Download drivers Microsoft.ACE.OLEDB.12.0
private void ProcessFile(string path)
{
string connString = string.Empty;
if (Path.GetExtension(path).ToLower().Trim() == ".xls" && Environment.Is64BitOperatingSystem == false)
connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";
else
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";
}
If Application is compiled with AnyCPU flag, it will look for 64 bit Access drivers on 64 bit OS and 32 bit access drivers on 32 bit OS.
If your application runs on localIIS, You can solve this problem by enabling 32-bit applications in AppPool's Advanced Settings
I've the same message, I have a webpage with do on visual studio 2010, I read a file.xls on that page,in my project visual has not any problem, when I put it on my IIS local throw me a 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine'
,I fixed that problem next following this steps,
1.-Open IIS
2.-Change the appPool on Advanced Settings
3.-true to enable to 32-bit application.
and that's all
ps.I changed Configuration Manager to X86 on Active Solution Platform
I had the same issue. I changed the application configuration to x86, then it worked!
I just Changed my Property of project into x64 format
Project---> Properties--->Build--->Target Framework---> X64
We have come across this issue in desktop app.
Dev Environment:
Windows 7 Ultimate - 64 bit
.Net Framework 4.5
Provider=Microsoft.Jet.OLEDB.4.0
It has been resolved by changing Platform target to X86 from Any CPU.
Project Properties >> Build >> Platform Target.
I ran into this issue with my desktop application ('Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine). I did not have the option to build as a 32 bit app. Hoping this would help others in the same situation.
I did the following and the issue went away:
Installed the 64 bit version of Microsoft Access Database Engine
2010 Redistributable, as suggested by neo
Changed my provider to Microsoft.ACE.OLEDB.12.0
Although a more optimal solution is to simply recompile as suggested above, that requires access to the source code. In my case, I only had the finished .exe and had to use this solution. It uses CorFlags.exe from the .Net SDK to change the loading characteristics of the application.
Download the .Net Framework SDK (I personally used 3.5, but the version used should be at or above the required .Net for your application.
When installing, all you need is CorLibs.exe, so just check Windows Development Tools.
After installation, find your CorFlags.exe. For my install of the .Net Framework 3.5 SDK, it was at C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin.
Open a command prompt and type path/to/CorFlags.exe path/to/your/exeFile.exe /32Bit+.
You're done! This sets the starting flags for your program so that it starts in 32 bit WOW64 mode, and can therefore access microsoft.jet.oledb.4.0.
Change in IIS Settings application pool advanced settings.Enable 32 bit application
Just Change the property based on your machine and all have done :-)
Project---> Properties--->Build--->Target Framework---> X64
or
Project---> Properties--->Build--->Target Framework---> X86
I have changed my connection string from
var myConnectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Persist Security Info=True;Jet OLEDB:Database Password=;",gisdbPath);
to this:
var myConnectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Mode=Share Deny None;Data Source={0};user id=Admin;password=;", gisdbPath);
It works fro me never asked for Microsoft.Jet.OLEDB.4.0'registered.
There is indeed no 64 bit version of Jet - and no plans (apparently) to produce one.
You might be able to use the ACE 64 bit driver:
http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=23734
but I have no idea how that would work if you need to go back to Jet for your 32 bit apps.
However, you may be able to switch the project to 32bit in the Express version (I haven't tried and don't have 2008 installed in any flavour anymore)
there is a thread here that talks about it:
http://xboxforums.create.msdn.com/forums/t/4377.aspx#22601
Maybe it's time to scrap Access databases altogether, bite the bullet and go for SQL server instead?
I'm using VS2013 for Winforms, the below solution worked for me.
Download : http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=23734
Then Set VS Target Platform to x86.
In older versions of IIS, you will not find Advance Settings so to enable Enable 32-bit Applications you have to execute the following commands:
cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1
and
%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i
Reference : Here
I was getting same exception while running "SQL Server 2014 Import and Export Data (64-bit)" on my Windows 8.1.
To fix the issue this issue I have done the following
started SQL Server 2014 Import and Export Data (32-bit) instead of 64-bit and it is working for me. I haven't changed any IIS setting and not installed any extra software.
I know that I have this problem over and over when I deploy my application on a new server because I'm using this driver to connect to a Excel file. So here it is what I'm doing lately.
There's a Windows Server 2008 R2, I install the Access drivers for a x64 bit machine and I get rid of this message, which makes me very happy just to bump into another.
This one here below works splendidly on my dev machine but on server gives me an error even after installing the latest ODBC drivers, which I think this is the problem, but this is how I solved it.
private const string OledbProviderString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\OlsonWindows.xls;Extended Properties=\"Excel 8.0;HDR=YES\"";
I replace with the new provider like this below:
private const string OledbProviderString = #"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\OlsonWindows.xlsx;Extended Properties='Excel 12.0;HDR=YES;';";
But as I do this, there's one thing you should notice. Using the .xlsx file extension and Excel version is 12.0.
After I get into this error message Error: "Could Not Find Installable ISAM", I decide to change the things a little bit like below:
private const string OledbProviderString = #"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\OlsonWindows.xls;Extended Properties='Excel 8.0;HDR=YES;';";
and yes, I'm done with that nasty thing, but here I got another message The Microsoft Access database engine cannot open or write to the file 'time_zone'. It is already opened exclusively by another user, or you need permission to view and write its data. which tells me I'm not far away from solving it.
Maybe there's another process that opened the file meanwhile and all that I have to do is a restart and all will take start smoothly running as expected.
go to Start->Run and type cmd
this starts the Command Prompt
(also available from Start->Programs->Accessories->Command Prompt)
type cd .. and press return
type cd .. and press return again (keep doing this until the prompt shows :> )
now you need to go to a special folder which might be c:\windows\system32 or it might be c:\winnt\system32 or it might be c:\windows\sysWOW64
try typing each of these eg
cd c:\windows\sysWOW64
(if it says The system cannot find the path specified, try the next one)
cd c:\windows\system32
cd c:\winnt\system32
when one of those doesn't cause an error, stop, you've found the correct folder.
now you need to register the OLE DB 4.0 DLLs by typing these commands and pressing return after each
regsvr32 Msjetoledb40.dll
regsvr32 Msjet40.dll
regsvr32 Mswstr10.dll
regsvr32 Msjter40.dll
regsvr32 Msjint40.dll
There isn't a 64 bit provider for Jet. If you want to support multiple DB sources including Jet to Excel you will need at least that part of your application to run in a 32 bit process.
The error you are getting when you compile for x86 is a bit strange. I can't see how you would end up referencing 64 bit assemblies in this case.

Categories