none
Entity framework and SQL Compact

    Question

  •  

    Hello,

     

    I just upgrade my project to VS2008 SP1.

    I regenerate my EDMX file which are pointing to a local SDF file (SQL Compact). Everything is working fine. But when i try to connect to using entity i get the following exception :

     

      Message "The specified store provider cannot be found in the configuration, or is not valid." string
    -  InnerException {"Unable to find the requested .Net Framework Data Provider.  It may not be installed."} System.Exception {System.ArgumentException}

    The provider is :

     

    provider=System.Data.SqlServerCe.3.5

     

    Any Clue ?

     

    Thanks for your time.

     

    Regards

     

    Jeff

    Friday, May 30, 2008 4:16 PM

Answers

  • Ok i solve it (kind of). If i change platform to x86 instead of Any CPU it works.

    So i the problem seems to be with x64 provider.

     

    Thanks

     

    Jeff

     

    Tuesday, June 03, 2008 1:15 PM

All replies

  • Have you installed SQL Server CE? The inner exception is usually thrown if there is no such registered provider (in your case "System.Data.SqlServerCe.3.5").

     

    Check C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config and look in the following section:

     

    <configuration>
    <system.data>
    <DbProviderFactories>

     

    therere must be the following line:

     

    <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"/>

     

    edit:

    I forgot to mention that you must have installed SQL Server Compact 3.5 SP1 Beta to work with the entity framework.

    You can find more info at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2882695&SiteID=1

     

    -Georgi

    Monday, June 02, 2008 8:56 AM
  • Hello Georgi,

     

    Thanks for your reply.

    Here is what i have in my machine config :

     

    <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="SQL Server Compact Edition Data Provider" invariant="System.Data.SqlServerCe" description=".NET Framework Data Provider for Microsoft SQL Server Compact Edition" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>

     

    And yes i have the following tools installed :

     

    Microsoft SQL Server Compact 3.5 SP1 design Tools English Beta

    Microsoft SQL Server Compact 3.5 SP1 English Beta

    Microsoft SQL Server Compact 3.5 SP1 for Devices English Beta

     

    any other clue ?

     

    Best Regards

     

    Jeff

     

    Monday, June 02, 2008 4:09 PM
  • Ok i solve it (kind of). If i change platform to x86 instead of Any CPU it works.

    So i the problem seems to be with x64 provider.

     

    Thanks

     

    Jeff

     

    Tuesday, June 03, 2008 1:15 PM
  • I currently have a similar problem where I can't find the sql server compact data provider after installing sp1 beta.  Where did you change the platform for compact to x86?

    Thanks,

    Dan
    Thursday, June 05, 2008 8:25 PM
  • Hello,

     

    On VS2008, on the toolbar near the debug button, you have another drowpdown. Change the value of this dropdown from "Any Cpu" To x86.

     

    Now it works for me.

     

    Hope this help.

     

    Regards

     

    Jeff
    Friday, June 06, 2008 6:44 AM

  • SeverinP
    • Proposed as answer by Severin Pankov Friday, January 29, 2010 9:41 AM
    Friday, January 29, 2010 9:41 AM