A native exception occurred in .Net EXE

1.6k views Asked by At

I have developed a C#.net windows form application to get and update data from /to a SQL server CE database.While I'm running this app on windows ce 6.0 machine, getting following error:

A native exception occurred in ItemDB.exe(my exe name).

Details:
Exception code : 0x80000002
Exception address: 0x40e843b4
Faulting module: sqlceme35.dll
offset: 0x000043b4

at    

NavigateMethod.GetKeyInfo(parm1,parm2,...)

at

SqlCEDataReader.FillMetaData(command)

at

sqlCeCommand.InitializeDataReader() 

So I searched in net and found this link:

http://go4answers.webhost4life.com/Example/cant-find-pinvoke-dll-sqlceme35dll-49162.aspx

http://blogs.msdn.com/b/sqlservercompact/archive/2007/10/26/can-t-find-p-invoke-dll-sqlcemenn-dll.aspx

As suggested, I copied ZIP file(because, I didn't get Cab files) and changed this to .Cab.Then I tried to run Cab,But, its saying "this is not a valid wince setup file".

Hope I explained it clearly.Could anyone please help me?

1

There are 1 answers

2
ctacke On BEST ANSWER

This is almost always caused by a SQL CE version difference between what you compiled against on the PC and what you have deployed on the device. Make sure that the SQL CE version number is identical in both your project references and what is on the device. Typically I add the reference not from the ".NET" tab in references, but I specifically brows to the reference so I know exactly which file is being used, and then manually deploy SQLCE from the same location to the device.

*EDIT

The location you should be looking for the files to deploy is here:

C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v3.5\Devices\wce500\armv4i

And your project reference should point here:

C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v3.5\Devices\System.Data.SqlServerCe.dll