ODBC Error in 64 bit OS

Posts   
 
    
Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 15-May-2008 00:29:16   

Hi all,

I am getting the following error message when I try to connect using Microsoft.Data.Odbc.OdbcConnection: "Unable to find an entry point named 'InterlockedIncrement' in DLL 'kernel32.dll'."

Here is the stack trace: at System.Data.Common.SafeNativeMethods.InterlockedIncrement(IntPtr lpAddend) at Microsoft.Data.Odbc.DBCWrapper..ctor() at Microsoft.Data.Odbc.OdbcConnection..ctor(String connectionString) at Mesa.SisULDal.SharedDataBaseObjects.CreateConnection() in C:\Mesa\SisULDal\Code Generated Data Access\SharedDataAccess.vb:line 39

This error does not occur when I develop on a 32 bit machine by it occurs on a 64 bit machine.

My guess is that 'InterlockedIncrement' is not found in 'kernel32.dll' for 64 bit (I think it's there but not exposed). What I think I need to do is somehow tell it to use kernel32.dll in the sysWOW64 directory.

In the end, I want to be able to develop the program on my 64 bit machine and publish the program to 32 bit machines.

Has anyone else have a problem with this?

Any suggestions?

Thanks,

Fishy

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 15-May-2008 10:18:35   

WHy do you use odbc? That's being phased out... at least try OleDB...

Frans Bouma | Lead developer LLBLGen Pro
Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 15-May-2008 16:38:45   

Because the OleDB from the vendor cost around 5k. The odbc driver cost nothing.

twaindev avatar
twaindev
User
Posts: 178
Joined: 08-Oct-2007
# Posted on: 15-May-2008 21:51:09   

Set Platform target to x86 on the Build page of your projects properties and it will run on x86 and x64 OSes.

HTH

Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 15-May-2008 21:52:46   

I did try that but it made no difference. Thanks anyways.

twaindev avatar
twaindev
User
Posts: 178
Joined: 08-Oct-2007
# Posted on: 15-May-2008 22:01:30   

If your solution contains several projects you may need to do this for all projects.

I recently experienced this in a solution where an exe called a function in a dll. Had to set the x86 platform in both projects.

HTH

Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 16-May-2008 18:47:30   

That did it!simple_smile

I was trying to change it using the Configuation Manager for the entire solution. That failed.rage disappointed

When I went to the Advanced Compile Options on the project and changed it there it worked.smile

Thanks,

Fishy.