What is it? It's most probably .NET executable compiled with the 'AnyCPU' Project options. On a 32 bit system it runs in 32 bit mode and is able to use JET. On a 64 biti it runs in 64 bit mode, but it cannot use the non-existent 64 bit driver. Try this in Visual Studio, if you have it - it requires a single form and a single button:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
namespace testaccess
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
String connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\\accessfile.mdb;";
OleDbConnection cnn = new OleDbConnection(connectionString);
cnn.Open();
}
}
}
Clicking the button will reproduce the problem on a 64 bit system. Obviously the solution is a recompile, if sources are available. Otherwise, there should be some way to force the executable in 32 bit mode, yeah?
Yeah, but it's not in .exe file properties, it's not something - as it would seem obvious - to put in a .manifest file along other things. It's a bit in the PE executable file. There is a Microsoft utility to do this: it's called CORFLAGS.EXE and to force a .NET executable to run in 32 bit mode it's usede this way:
CORFLAGS /32BIT+ filename.exe
To switch back to 64 bit mode:
CORFLAGS /32BIT- filename.exe
Where is CORFLAGS.EXE ? There doesn't seem to be an official download for the single file: that would be too simple, it's part of the latest SDKs (a few gigs to download). I got mine with Visual Studio, as I installed the .NET sdk. It's in %PROGRAMFILES%\Microsoft SDKs\Windows\v6.0A\bin"
Nota bene: make a backup of the original .exe anyway if it's not your software. Conceivably, using corflags.exe could conflict with some copy protection/activation schemes and render the software unworkable (though it's a bit unlikely).
No comments:
Post a Comment