Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider

22

In my project, I use SQL CE 3.5 database with entity framework and followed this article but i have this exception :

Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8080. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.

All details

System.Data.SqlServerCe.SqlCeException was unhandled
  Message=Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8080. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.
  Source=""
  HResult=-1
  NativeError=-1
  StackTrace:
       at System.Data.SqlServerCe.NativeMethods.LoadNativeBinaries()
       at System.Data.SqlServerCe.SqlCeConnection..ctor()
       at System.Data.SqlServerCe.SqlCeProviderFactory.CreateConnection()
       at System.Data.EntityClient.EntityConnection.GetStoreConnection(DbProviderFactory factory)
       at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
       at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)
       at DAL.OimDBEntities..ctor()
       at DAL.OimRepository..ctor()
       at Microsoft.Rtc.Collaboration.Sample.SubscribePresenceView.UCMASampleSubscribePresenceView.Subscribe()
       at Microsoft.Rtc.Collaboration.Sample.SubscribePresenceView.UCMASampleSubscribePresenceView.Run()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.DllNotFoundException
       Message=Unable to load DLL 'sqlceme35.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
       Source=System.Data.SqlServerCe
       TypeName=""
       StackTrace:
            at System.Data.SqlServerCe.NativeMethods.GetSqlCeVersionInfo(IntPtr& pwszVersion)
            at System.Data.SqlServerCe.NativeMethods.LoadValidLibrary(String modulePath, Int32 moduleVersion)
            at System.Data.SqlServerCe.NativeMethods.LoadNativeBinaries()
       InnerException: 
c#
entity-framework
sql-server-ce
asked on Stack Overflow Sep 1, 2012 by Tarek Saied • edited Aug 22, 2014 by h3xStream

4 Answers

35

I got this error with a private install of SqlServerCE. I had a reference to System.Data.SqlServerCe.dll in my project, but I was missing other dlls (native components) needed by SqlServerCE. The "native components" are in x86 and amd64 subfolders of SqlServerCE's "private" folder. You need to make sure that they get copied to the output folder of your project.

answered on Stack Overflow Jun 13, 2013 by Tom Andraszek
3

I also had encountered the same problem. the problem was i had used the following command install-package EFcodeFirst.SqlServerCompact to get the sqlCE. the version that was downloaded by package manager was 4.0 and whereas on my harddisk the version present was 3.5

download the latest version 4.0 from the following location http://www.microsoft.com/en-us/download/details.aspx?id=17876 did solved my problem

EDIT: Link above now returns 404. This is now the correct location for the download: https://www.microsoft.com/en-us/download/details.aspx?id=30709

answered on Stack Overflow Dec 12, 2012 by Ashish Gupta • edited Jan 4, 2021 by dancingCamel
2

I had a similar problem. I was opening a compact framework sql database and it gave me the following error:

Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8080. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.

When looking up the article, it led me to the following Link. The following quote explains what went wrong:

Compact based applications generally program against the Compact ADO.NET provider (System.Data.SqlServerCe.dll). This provider in-turn communicates with the native Compact components. In order to avoid various inconsistencies, a Compact ADO.NET provider of a certain version can talk only to the Compact native components of the same version.

In the end I solved it by downloading and installing the service pack in the following link.

answered on Stack Overflow Dec 1, 2014 by martijn • edited Sep 7, 2016 by martijn
2

You will need to copy the following file and entire directory to the location where your .exe is running on your server. This file and folder are most likely in the directory C:\Program Files(x86)\Microsoft SQL Server Compact Edition\V4.0\Private

System.Data.SqlServerCe.dll The entire amd64 folder I’m not sure what is used from the amd64 folder, but as soon as I copied this over my application started to work. You could also get your System.Data.SqlServerCe.dll file by clicking on it in Visual Studio under the References folder and then in the properties tab setting “Copy Local” to True and then when you build your app that file will be in your release folder.

answered on Stack Overflow Aug 13, 2015 by Dhanik Lal Sahni

User contributions licensed under CC BY-SA 3.0