Sql Server Compact 3.5 + SqlMetal Issues RRS feed

  • Question

  • Hi Guys,


    I am trying to use SQLMetal to create a DBML file for Linq to use in a compact framework application.


    When I try to run the following command line I get an error stating that the System.Data.SqlServerCe.3.5 provider is not installed.  However, I am able to create a SQL Server Compact 3.5 database using VS2008B2 server explorer without any problems.


    Command Line

    C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin>sqlmetal /dbml:c:\projects\LinqSolution\LinqTest.dbml C:\Projects\LinqSolution\LinqTest.sdf
    Microsoft (R) Database Mapping Generator 2008 Beta 2 version 1.00.20706
    for Microsoft (R) .NET Framework version 3.5
    Copyright (C) Microsoft Corporation. All rights reserved.

    Error: Cannot open 'C:\Projects\LinqSolution\LinqTest.sdf'. Provider '
    System.Data.SqlServerCe.3.5' not installed.
       at SqlMetal.ConnectionManager..ctor(String connectionString, Int32 timeout)
       at SqlMetal.Extractor..ctor(String constr, ExtractOptions options)
       at SqlMetal.DbmlExtractor.Extract(String connection, String database, Extract
    Options options)
       at SqlMetal.SqlMetalMain.Main(String[] args)


    Kind Regards,


    Friday, August 3, 2007 11:43 AM



    Tarek and Mike,

    I think you are probably right about making SqlMetal x86 instead of anycpu. I'll open a bug on Monday to investigate the consequences of this move. If we did this, though, wouldn't you still have problems moving to a 64 bit OS because here is no SQL CE 3.5 for 64 bit?

    Sunday, August 5, 2007 4:18 PM

All replies


    Hi Tarek,

    Could you try this on your system?

    using System;

    using System.Data;

    using System.Data.Common;

    using System.Linq;

    namespace SandBox {

    class Program {

    static void Main(string[] args) {

    foreach (var r in DbProviderFactories.GetFactoryClasses().Rows.OfType<DataRow>()) {






    This will list the provider names you have installed and possibly help us understand what's going on.
    Friday, August 3, 2007 5:50 PM
  • Hi Jomo,


    The function returns the following items -




    Also, I forgot to mention that I am using Vista Business x64 as my operating system.


    Kind Regards,


    Friday, August 3, 2007 7:40 PM
  • Hi Jomo,


    My machine.config lists the following setting for the SQLServerCe provider -


    <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=, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />


    I am not sure where the invariant name of Microsoft.SqlServerCe.3.5 is coming from.


    Kind Regards,




    Friday, August 3, 2007 11:30 PM


    What you're running into is that there's no 64-bit SQL CE provider. We need a better error message for this.

    Saturday, August 4, 2007 12:06 AM
  • Hi Jomo,


    Are you saying this it wont be possible to utilize SQLMetal in a 64bit environment because Sql Server compact edition does not have a 64 driver?


    Can you guys recompile SQLMetal to allow it to use the 32bit framework so it uses WOW rather than being compiled to anycpu?


    We are being forced to move to x64 in order to use 4gb of memory in order to effectively run Vista and virtual machines.


    Kind Regards,



    Saturday, August 4, 2007 12:20 AM
  • It would be usefull to know of any workrounds other than throwing away Vista 64 !!


    I have same problem and have tried both the 64 and 32 bit version of sqlmetal and I am now stuck



    Saturday, August 4, 2007 3:08 PM
  • Hi Mike,


    I hope the solution is that they just recompile SqlMetal to target x86 rather than allow it to target anycpu. This should ensure that SqlMetal runs as a 32bit application using WOW in x64 and therefore it should be able to access the 32bit Sql Server Compact edition provider.


    I do not see what the value is gained by making SqlMetal 64bit. There is no added functionality gained.


    Kind Regards,


    Saturday, August 4, 2007 7:58 PM

    Hi Tarek


    I think the problem may be deeper than that as


    1.    I have used the 32 bit version of SQLMetal and get the same error


    2.   I have downloaded some tutorials in SQL CE and they will not run in Orcas with a very odd runtime error




    So I think there are unresolved issues with the 64 bit version of vista and SQL CE 3.5


    Hoping we get some answers


    Best wishes



    Saturday, August 4, 2007 8:10 PM

    Tarek and Mike,

    I think you are probably right about making SqlMetal x86 instead of anycpu. I'll open a bug on Monday to investigate the consequences of this move. If we did this, though, wouldn't you still have problems moving to a 64 bit OS because here is no SQL CE 3.5 for 64 bit?

    Sunday, August 5, 2007 4:18 PM
  • Hi Jomo,


    From a strickly Sql CE 3.5 perspective the lack of a 64bit interface may become a problem for developers who would be trying to use SQL CE as a local storage or caching mechanism on a 64bit platform. 


    Personally, I only need a 64bit interface because I need to use SQLMetal to to produce Linq code that targets Sql CE 3.5 for the Compact Framework and I am using Vista x64 because I have run into memory constraints when trying to run virtual machines as I also work on Microsoft CRM and Sharepoint 2007. The lack of a 64bit interface for Sql CE 3.5 is a non-issue for me as I do not expect to use the product in a 64bit app.


    Also, I would imagine the effort to required to ask the Sql CE 3.5 team to produce a 64bit version of the product would far out way effort required to recompile SQLMetal. The former being the ultimate solution for everyone and the latter being a workaround that is inline with the Sql CE team statement that the product uses the WOW in 64bit environments.


    Kind regards,



    PS - Thanks for your prompt replies...Jomo, you have been a great help.

    Sunday, August 5, 2007 9:40 PM

    Hi Jomo


    My situtuation is exactly the same as Tarek's


    Could also do with advice on which tools to use to design Sql CE dbs - as the only way I can add foreign key constraints is programattically





    Monday, August 6, 2007 8:02 AM
  • Guys,

    I just wanted to let you know that I opened a bug to move SqlMetal from anycpu to x86--our internal bug number is 129796. I can't guarantee it will go through because our bar for accepting changes is pretty high but I will do my best.



    VS Designer doesn't support SQL CE and won't for RTM. Ironically if the designer did support SQL CE it would just work on 64-bit because VS itself is hosting the runtime as 32-bit. There's really not a good answer for you in Beta2. Hopefully we'll be able to move SqlMetal to x86 and this will reduce your trouble.





    Monday, August 6, 2007 4:35 PM
  • Hi Jomo,


    Thanks very much for raising the bug.


    Is there anyway to track for us to track the bug?


    Kind Regards,



    Monday, August 6, 2007 7:48 PM
  • Hi Jomo


    Thanks for opening bug report.


    Regarding lack of design support for SQL CE 3.5 - when will a SQL Server Management tool support CE 3.5 - any ideas ?


    Thanks again




    Monday, August 6, 2007 7:52 PM

    There's not a way except by asking about it through this forum. In the future, you can open trackable bugs through https://connect.microsoft.com/ if you like. Issues reported by customers through connect go into the same bug system we use internally and are treated just the same (perhaps with more credence because there's actually customer pain involved).


    I can tell you we accepted this bug this morning in triage so, unless we hit an unforseen issue, I would expect that this will be fixed.

    Monday, August 6, 2007 8:35 PM
  • Hi Jomo,


    Do you think it would be possible to obtain a test copy of SqlMetal compiled for x86.


    Kind Regards,




    Saturday, September 29, 2007 4:22 AM
  • Hi,

    I have created a test App that works fine using SQL CE 3.5sp1 and have created the DBML file and linq works fine.

    As I understand it, i should be able to deploy the App on a machine where SQL CE is not installed by copying the DLLS from the CE directory in to the application and under references, in the solution explorer, setting the copy local property to True for the System.data.SQLServerCE file.
    This will allow the db to run local to the application.

    When I go to run the App it errors with "system.data sqlserverCE3.5 not installed.

    • Edited by ron nash Monday, February 2, 2009 2:30 PM Change of issue
    Monday, February 2, 2009 2:28 PM