SQL Server CE 4.0 package did not load correctly
-
Tuesday, August 28, 2012 12:41 PM
Using Visual Studio 2010, in Server Explorer I'm trying to add a connection by right clicking on Data Connections and selecting "Add Conection...". When I do this I get an error that says
'Microsoft.VisualStudio.Data.Providers.SqlCompact.VsPackage, Microsoft.VisualStudio.Data.Providers.SqlCompact, Version- 4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' package did not load correctly.
After I click the OK button to that message I get another message that says "An unexpected error occurred in the .NET Framework Data Provide for Microsoft SQL Server Compact 4.0. Please contact the provider vendor to resolve this problem.I cannot open a SQL Server CE 4.0 database in Server Explorer.
I have VS2010 and VS2008 installed. VS2010 was installed first. I have SQL Server CE 4.0 and 3.5 installed. Everything was working fine until a couple days ago. I could access 4.0 databases from VS2010 and 3.5 databases from VS2008. Nothing new has been installed that I am aware of.
I have tried uninstalling SQL Server CE 4.0 and reinstalling but that hasn't changed the results.
I downloaded SQL Compact 4.0 Toolbox from Codeplex but when I run it I get an error message that says "Error getting list of databases from Data Connections, make sure to create one. Only elements allowed. (C:\Windows\Microsoft.NET\Framework\c4.0.30319\Config\machine.config line 153)
Anyone have any idea what I need to do to get CE 4.0 working again?
Thanks
Terry
All Replies
-
Tuesday, August 28, 2012 12:51 PMModerator
Sounds like your machine.config file has errors, could you share the DbProviderFactories section from that file ?
Please mark as answer, if this was it. Visit my SQL Server Compact blog
- Marked As Answer by TerryDiederich Tuesday, August 28, 2012 1:14 PM
-
Tuesday, August 28, 2012 1:13 PM
Hey, looks like that was the problem! Just a matter of knowing where to look. Thanks Erik.
Below is the DbProviderFactories section. I added a couple linefeeds to separate the added providers. Notice the first provider doesn't have an opening bracket (<) and the closing bracket is ">". I deleted this provider and left the other two and now I can access 4.0 and 3.5 databases.
Have you seen this before? Any idea how that happened?
Thanks again. I'll mark your reply as the answer.
<DbProviderFactories>
add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/><add name="Microsoft SQL Server Compact Data Provider" invariant="System.Data.SqlServerCe.3.5" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</DbProviderFactories>
-
Tuesday, August 28, 2012 1:36 PMModerator
Thanks, no I have never seen this before...
Please mark as answer, if this was it. Visit my SQL Server Compact blog

