0

I have been trying to make SQL Server CE work with Visual Studio 2005 for the past 4, 5 hours. but no luck. When I run my application I get the following error:

Can't find PInvoke DLL 'sqlceme35.dll'

I have read countless threads and articles on it but unable to make it work. Using the following tools:

  • Windows CE 5.0 device running Intel Bulverde processor
  • Windows XP 32 bit with Visual Studio 2005
  • SQL Server Compact 3.5

Here is what I did.

  1. Created a new "Smart Device" project and selected "Windows CE 5.0"
  2. Installed SQL Server Compact 3.5 (on Windows XP) which installed a bunch of folders and files
  3. In my project I added a reference to "System.Data.SqlServerCe.dll" which is inside folder where SQL Server Compact 3.5 is installed
  4. Then I wrote a few lines code as below which I copied from http://msdn.microsoft.com/en-us/library/aa226134(v=sql.80).aspx

        SqlCeEngine engine = new SqlCeEngine("Data Source = Test.sdf");
        engine.CreateDatabase();
    
        conn = new SqlCeConnection("Data Source = Test.sdf");
        conn.Open();
    
  5. Then I installed "sqlce.dev.ENU.wce5.x86.CAB", "sqlce.repl.wce5.x86.CAB" and "sqlce.wce5.x86.CAB" from "wce500\x86" on target device which created a bunch of DLL files in folder "Microsoft SQL Server Compact Edition"

  6. Then I ran my program but I got error as described above. The error is being thrown by line SqlCeEngine engine = new SqlCeEngine("Data Source = Test.sdf");
  7. I thought may be I need to copy all DLLs from folder "Microsoft SQL Server Compact Edition" to my application folder on target device from where my program was running so I copied all files but still same error.
  8. And then I thought may be I need to use "armv4i" instead of "x86" so I first installed "sqlce.wce5.armv4i.CAB", "sqlce.repl.wce5.armv4i.CAB", "sqlce.dev.ENU.wce5.armv4i.CAB" and as expected it didn't work. So I again copied all DLLs into my program folder but no luck.

What am I doing wrong?

1 Answer 1

0

The Bulverde, IIRC, is the PXA27x series processor which is definitely an ARM core, not an x86, so you must use the ARM binaries.

Start by making sure you have a factory-reset device (the registry would be the important bit to reset).

Then use the CAB (or just the binaries directly) from this folder:

%PROGRAM_FILES%\Microsoft SQL Server Compact Edition\v3.5\Devices\wce500\armv4i

Make sure that the System.Data.SqlServerCe.dll assembly is on the device (typically in your application folder).

If it still fails, you probably are missing a dependency. Run depends.exe (on the desktop) against the SQL Compact binaries to see what they need and ensure those are on your target.

3
  • I ran depends.exe for "sqlceme35.dll" and it said 3 DLL files are missing. Plus I saw that for the CPU tab as shown in screenshot below, it is saying "x86" although the "sqlceme35.dll" in question is from "armv4i" folder. So I guess it is showing this processor from the desktop? i.imgur.com/nD87I.jpg
    – Ali
    Dec 10, 2012 at 6:34
  • Yes, the important thing is to look at the DLLs and entries that it is looking for. The processor architecture should still be correct though.
    – ctacke
    Dec 10, 2012 at 13:40
  • Here is screenshot of device that shows all DLL files including sqlcemeXX.dll are there with the application test.exe which I am developing. This time I tried with SQL CE 3.0 but same error. I have also tried 3.5 and 4.0. i.imgur.com/q1DC7.jpg
    – Ali
    Dec 11, 2012 at 5:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.