Unable to load DLL 'sqlceme35.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)



    I'm new to ADO.NET and need help with this error.


    Currently running Vista Home Premium 64 and Visual Studio 2008 Trial.


    1. Create Win form app.

    2. Add new data source...

    3. New connection - SQL Server Compact 3.5 - Northwind.sdf

    4. Highlight Products and Suppliers.

    5. Drag both onto Win form

    6. Run with debug

    7. Error message "Unable to load DLL 'sqlceme35.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"


    some blogs advice change dir in SQL Server Compact 3.5 in regedit but regedit doesn't even have SQL Server Compact 3.5; only SQL Server\SQLExpress.


    reinstall SQL Server Compact 3.5 and problem still exists.


    anyone knows how to fix this problem?


    Tuesday, January 01, 2008 7:38 AM


All replies

  • Laxmi blogged about this issue here:

    Can’t find P/Invoke DLL sqlcemeNN.dll

    Wednesday, January 02, 2008 3:31 PM
  • I installed the SP3 for SQL CE and even reinstalled it but problem still exists.


    I don't understand this part:

    "You are using Visual Studio Auto Deployment (F5) feature.  And, VS has failed to map the System.Data.SqlServerCe.dll to the right set of cabs to install and just deployed the System.Data.SqlServerCe.dll alone (Note: No error is thrown).  In this case, the native DLLs are not deployed.

    a.       Fix the auto-deployment issues (Don’t ask me how L)

    b.      Manually copy and install the SQL CE Cabs (all the 3 cabs).  They are located under:

    %VisualStudioInstallRoot%\SmartDevices\SDK\SQL Server\Mobile\v3.0\<platform>\<processor>"


    Can you clarify to where all the 3 *.cab support to go to?



    Wednesday, January 02, 2008 5:20 PM
  • I'm seeing the same problem with Beta 2 of Visual Studio 2008 on Vista Ultimate x64.

    I'm unclear about where the cab files go as well.




    Sunday, January 06, 2008 4:49 PM
  • Have you set your solution target to "Any CPU" ?? If so, set to "x86", as SQL Compact only runs in WoW mode on x64. Or use corflags.exe /32BIT+ against your project output (.exe file).

    Sunday, January 06, 2008 6:32 PM
  • set to x86 and it works....thanks

    Sunday, January 06, 2008 6:41 PM
  • Maybe I'm dumb, but I can't seem to find this option.

    Under Advance Compile Options the only thing I see similar to this is Target Framework, but that doesn't fix it either.

    I'm running VS2008 Express under Vista Ultimate x64
    Wednesday, January 09, 2008 8:29 PM
  • It is part of the solution configuration, not project properties. "Configuration Manager" (that's what you need) is usually available via the dropdown saying "Debug", "Release"  For more info see:

    Or you can use corflags.exe /32BIT+ against your .exe file after build and before deployment.

    Wednesday, January 09, 2008 9:19 PM
  • I'm using the MV2008trial but i think the layout still the same.

    You should be able to see a button on your toolbar that looks like a "play button" (start debugging) next to it you should see a drop down box said "Debug" and next to it is another drop down box and its default value is Any CPU; set this to x86.


    this works on mine.

    Wednesday, January 09, 2008 9:24 PM
  • I can't find this anywhere.  I'm assuming it must be because it the express edition.  Downloading the trial now...
    Wednesday, January 09, 2008 10:14 PM
  • Found it... had to enable advance build configurations under options... thanks guys.
    Wednesday, January 09, 2008 10:16 PM
  • ive tried everything stated here but no luck, i still cant run my solution, keep getting:

    An error occurred creating the form. See Exception.InnerException for details.  The error is: Unable to load DLL 'sqlceme35.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

    Plus, in the compiler, advanced compiler options i cant switch the Target CPU, its fixed to "Any CPU"

    Im using Windows Vista Business 64 and Visual Basic 2008 Express Edition
    Monday, February 11, 2008 4:53 PM
  • I had the same problem in Ulimate. Try this.


    In drop nemu "Build" is "Configuration Manager". You will see the tabel where one of columns is the column "platform" with Any CPU. There is drop menu. Use "New" option a then change this option on x86. It helps me. Close Configuration manager and try.

    • Proposed as answer by Bacter Tuesday, May 05, 2009 12:54 PM
    Sunday, February 17, 2008 9:49 AM
  • Look at this blog post for a walk-through:


    Sunday, February 17, 2008 10:27 AM
  •  ErikEJ wrote:

    Have you set your solution target to "Any CPU" ?? If so, set to "x86", as SQL Compact only runs in WoW mode on x64. Or use corflags.exe /32BIT+ against your project output (.exe file).


     ErikEJ wrote:
    Look at this blog post for a walk-through:



    Hello everyone,


    I have the same problem as mentioned above "Unable to load DLL 'elev.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) ", when trying to load the dll file into a window application.  I developed a window application in VS2005 and want to import a dll file from another program into my project and use it.  But when I try to call one of the function in the dll file, I got the error message "Unable to load dll 'elev.dll".  I try all options that say it works to solve this problem, but somehow it doesn't work for me. I put the "elev.dll" file in the bin folder and use P/Invoke to import the dll file into my project.  Can anyone help me out with this?  thanks and really appreciated!

     Here is how I import the dll:



    //[DllImport("emap.dll", SetLastError = true)]

    private static extern void EMA_Init();



    and in the code,  I call the function above but failed to load the dll file


    Tuesday, April 01, 2008 7:31 PM
  • I am new to programing of any kind.  You link did the trick, once I actually read it.  Thank you.


    Wednesday, April 09, 2008 5:56 AM
  • Hi all,
           i also get stuck with this... at last i get it work.

    you may need to copy *.dll from C:\Program Files\Microsoft SQL Server Compact Edition\v3.5
    to C:\Program Files\Microsoft Visual Studio 8\Common7\IDE (For VS2005)
    or C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE (For VS2008)

    That's it.

    Hope this helps,

    Friday, April 18, 2008 9:44 AM
  • installing SP1 for Sql Server Compact fixes the Vista64 bit problems for me



    Sunday, February 01, 2009 12:59 AM
  • installing SP1 for Sql Server Compact fixes the Vista64 bit problems for me



    Thankyou adam75 actually it solved my problem on my 64bit vista machine.
    Monday, April 27, 2009 7:44 PM
  • The really good news is that they haven't fixed this in Windows 7, but this fix works in 7 rc1.

    You have to install both the x86 and x64 patches. 
    Wednesday, May 20, 2009 12:30 PM
  • Hello,

    I am seeing a similar issue except for 32 bit machines.

    Installing the service pack for sql compact from the link ( resolves the issue but when sql compact is installed through the click once, it gives this error("Unable to load DLL 'sqlceme35.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)").

    We are trying to have an application where everything for the application is installed through the click once technology, but it does seem that this doesn't want to work.

    Does anyone have any ideas why this install won't work on certain machines through the click once?


    Hugh Fairifeld
    Tuesday, June 23, 2009 8:14 PM
  • You'll have to install the x64 version of SQL Compact.  Ask more questions about it in this forum.

    Hans Passant.
    Saturday, July 11, 2009 12:51 AM
  • There are posts that over complicate this issue.

    The problem is that you are using a 64 bit operating system, but have installed the 32 bit version of SQL Server Compact Express. When you attempt to run a windows form application in Visual Basic 2008, windows can not find the correct file. Though you can develop with the standard 32 bit version of SQL Server Compact Express using a 64 bit operating system, you must have a separate program to run what you develop. 


    Download and install a program that allows a 64 bit operating system to run SQL Server Compact Express (.sdf).

    Here is the link:

    Thursday, August 13, 2009 5:25 PM
  • installing SP1 for Sql Server Compact fixes the Vista64 bit problems for me



    This also fixes the problem for me on Windows Server 2008 R2 x64.
    Tuesday, September 08, 2009 9:28 PM
  • Erik, you are the man!  Thank you so much for providing the solution to the "sqlceme35.dll not found" exception.  Now I don't have to fork over 60 bucks to migrate to Liberty BASIC.
    Thursday, September 24, 2009 8:47 AM
  • I am writing an application in VB using Visual Studio 8. I cannot run the published application on any 64 bit machine. I have changed the solution target to "x86" as per your blog using the instructions you have given and it still will not run. I bought a new 64 bit system to test with and it still will not run. I get this message no matter what I have tried to do. "Unable to load DLL 'sqlceme35.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)" I originally created the application on a 32 bit machine and then loaded the Visual studio application onto the 64 bit system to publish from there and it will run in debug mode within visual studio no matter what settings I use for the target solution but whenever I try to publish it the publisher shows "Any CPU" as the configuration and will not run when I install the application. I am using the "One Click" deployment option from a CD to deploy the application. I have even rewritten the entire application with the target platform set to "x86" to no avail. I have spent many hours on this problem and I must find a solution. To not run on a 64 bit system is not acceptable. Any ideas on what I am doing wrong? Will Microsoft ever address this issue? I am using the SQL compact edition database and I understand this is the problem with the database. My application still starts if I ignore the error but of course no data is present. Any help you can give me will be appreciated. I cannot expect the users to use the "corflags.exe /32BIT+ solution because I cannot even get that to work. I am new to the .Net world and cannot get the corflags.exe command to work no matter where I type the command. Is this something I can do to my .exe file before I place on the CD to deploy? If so maybe some more detailed instructions on how to do this will help. Thank you in advance for anything you can tell me.

    Saturday, October 17, 2009 5:26 AM
  • Hi,

    I am working with SQL Compact 3.5 on Windows 7 x64 build, and I had this same error. The steps I took based on this topic worked.

    I installed Sql Compat 3.5 SP1, opened up my project, under the configuration manager I set my CPU to x86, ran the project again and the DLL error was gone, and my program was working perfectly.

    Thanks for the help.
    Sunday, November 15, 2009 2:06 PM
  • Thanks Erik! That fixed the problem!
    Tuesday, January 05, 2010 11:44 PM
  • Hi,

    I am working with SQL Compact 3.5 on Windows 7 x32 build and I had tried all the solutions described in this post but  I still have this error message.

    Please,any idea?

    Friday, February 26, 2010 5:32 PM
  • Thanks a ton buddy this works...... am using windows 7 64bit Ultimate Edition on Dell Studio 15
    Tuesday, March 09, 2010 9:10 AM
  • Thank you very much!
    Sunday, April 11, 2010 8:39 PM
  • Works for me too.  Many Thanks.  I am strictly a user not a developer and this problem was driving me crazy.  I suspected that the 64 bit CPU of my computers was the reason becasue a fried installed Micorsoft Visual Basic 2008 on a 32 bit CPU Laptop and it worked fine. 

    Pavlos Levantis at

    Friday, May 11, 2012 8:53 PM
  • Thanks a Lot sir for YOUR answers..!!! I downloaded the SQL Server compact 3.5 SP1 and tried again and the error was gone and my program was executed :-) Thank u soo much..!!!
    Wednesday, November 12, 2014 9:24 AM
    Friday, November 06, 2015 1:21 AM