SQL Server Compact 3.5 SP2 on Windows Embedded CE 6.0 RRS feed

  • Question

  • I have a device that keeps getting the "Database corrupted" exception and am hoping SQL Compact SP 2 might fix it.  Is there a way to get this into a Windows CE 6.0 image?  I don't think there is a platform builder catalog item for it is there?


    Saturday, December 11, 2010 1:31 AM

All replies

  • Download the setup file from the following site.Installing the setup file will give you the CAB files for WinCE devices,Which you can transfer to device and install it in any permanent storage of your device.
    Monday, December 13, 2010 6:12 AM
  • What I am looking for is a way to include it in the OS image, so it will be on all of the devices manufactured.  Is there a way to do that?  If not, is there a way to include it in a software update for the devices?


    Monday, December 13, 2010 6:51 PM
  • I would also like to know if it's possible to include SQL Server Compact 3.5 SP2 in the image.  I've installed all of the SQL Server Compact 3.5 SP2 software on my development PC.  When I deploy my C# applications to the device through ActiveSync, Visual Studio keeps copying the SQL Server Compact 3.5 SP2 assemblies to the device too.  I think this is because the CE image only contains the SP1 assemblies.  I'd rather the SP2 assemblies be included in my image, but like the OP said it's not an option in Platform Builder.

    So is it possible to build SQL Server Compact 3.5 SP2 into the Windows CE 6 image?  Or is copying the CAB files over to the device manually like Prabu suggested the only way?




    Monday, December 13, 2010 7:52 PM
  • It's certainly possible, but it won't be easy.  You'd have to detect all registry settings, all changes to the filesystem, etc. made during an install and copy those to a catalog description.  I gave up on trying to do that and moved to the 'install manually' operation after some work on doing it.  SQL Compact is changing quite a bit faster than Windows CE, so there's a pretty high probability that there will be another service pack before your CE6 build reaches the end of its life.  Now you either a) have to have the user of your device install the service pack (via ActiveSync or WMDC or something), or b) you have to build another OS, in order to get the fixes in the SQL Compact service pack.  Since only a fraction of our customers actually used SQL Compact and it takes up flash space for all customers, if it's built into the OS, and because of the update schedule of the OS versus the database, I chose not to go this way.

    I suppose that an intermediate alternative would be to build the CAB files, not the actual installed pieces, into the OS and have a program that runs from an Init key in the registry install those CABs on the first device boot.

    Paul T.


    Wednesday, December 15, 2010 5:28 PM
  • Thanks Paul.

    "an intermediate alternative would be to build the CAB files, not the actual installed pieces, into the OS and have a program that runs from an Init key in the registry install those CABs on the first device boot."

    Would you please describe the steps to do this?


    Thursday, December 16, 2010 5:11 PM
  • To include the CAB files in your OS image, place them into you OS project’s Files folder and add entries to your Project.bib's FILES section.

    If you have an application that runs at startup already, you could add the code to it to check to see if the SqlCe is already installed, and to install it from the CABs if not.  Otherwise, you can create a new application, probably as a Platform Builder subproject to your OS project (call it something like “SqlCeInstall”).   You’ll need to have HKEY_LOCAL_MACHINE\Init registry entries that will launch the program that installs the CABs at startup as explained in Configuring the Process Boot Phase.  You can add these registry entries to the .REG file for you subproject (if you’re using one) or in another .REG file that is appropriate for you (i.e. Platform.reg, Project.reg, etc.)  You’ll need to create both a DependXX and LaunchXX registry value to start you application after all required components (e.g. GWES, Shell,etc.) have been startup.  Here’s a link to Bruce Eitman’s blog that gives some additional info on this - Windows CE: Starting an Application when the System Boots.

    Whichever application you have install the CABs will need to do so using wceload.exe .  You’ll need to be sure that the “CAB File Installer/Uninstaller” component (SYSGEN_WCELOAD) is included in your OS image.  You will use the CreateProcess API to execute wceload for each CAB file you want to install.  If you want the installs to run silently you can specify the ‘/noui’ command line option for wceload.  You should wait for each instance of wceload to complete before running the next one.  You can do so by calling WaitForSingleObject with the hProcess handle CreateProcess stores in the PROCESS_INFORMATION structure it populates.

    Rebuild and install your OS image onto the device.  During the next boot, program should load and install each CAB file you have programmed it to.

    Installing the CAB files will take some time, so be sure to only do when necessary, and be sure that any programs that depend on SQL Server Compact  will wait for the installs to complete before trying to use it.

    Tom Gensel PTG Systems, LLC
    Thursday, December 16, 2010 8:17 PM