SQL Server Mobile, SQL Server Everywhere Edition Code Snippets


When working with SQL Server Mobile / SQL Server Everywhere Edition (SSEv) here are a few code snippets that can be very useful.  Visual Studio 2005 incorporated a concept of Code Snippets which allows you to enter a shortcut in the code editor and Visual Studio will expand that shortcut into code with replacement regions.  These code snippets are written in VB, but they could easily be converted to C#.  …no, I don’t currently plan to convert them, but if someone would like to I’ll be glad to post those samples and give credit.


SQL Server Everywhere Edition Connection String Conversion to Physical Path
Used to update the SQL Server Everywhere Edition Connection String to a fully qualified path for use in Click-Once scenarios and MSI type scenarios.
Snippet is designed to be used in the partial class of the settings file.  Click the settings tab on the application designer and select view code.  Handle the event for Settings_Loaded


Verifies a SQL Server Everywhere Edition database exists
Uses a SqlCe Connection String to verify the database already exists on disk.  If not, the database will automatically be created


SQL Server Everywhere Edition Updatable Result Set
Creates an updatable resultset against a SQL Server Everywhere Edition database


Sync a local SQL Server Everywhere Edition database using SQL Server Everywhere Edition Merge Replication
Uses SQL Server Everywhere Edition Merge Replication to sync changes to the local SQL Server Everywhere Edition database with a SQL Server publication



 

Comments (8)

  1. Steve posts some good information on getting offline client apps developed with VS2005 and .NET Framework…

  2. Touraj Vaziri says:

    HI Steve
    i hope you’re well
    I will be short
    If you take some time and visit the blogs around the world about sql mobile synching to sql express, you will see how angry developers are and how silly the design team look

    We dont want to hear about Web Service etc
    When you are trying to synch in a mine where is web services going to fit in your equation. no where!!!
    There are so many industries in need of software but we are not going to be able to push sql servers on each laptop. That is crazy. I dont know who made this ridiculous decision of not having local db to sql mobile synchronization. It is beyond stupidity.
    Palm offers it, Primeworks is trying to offer it, Lotus notes offers it….Yes we are happy to pay for it but please dont get someone to rehash the same message of using web services
    I dont think some of your employees have ever worked in the real world…real people and real restrictions when in a mobile environment

    People are going to leave sql mobile if this isnt addressed soon
    We are happy to pay for it which should make you happy about not giving any more for free
    Please do something as people are going to leave your development environment for the mobile platform
    Regards
    Touraj

  3. Richard says:

    Has anybody converted these to C# yet

  4. Steve.Lasker says:

    I’d be happy to post conversions, or links to conversions, if someone wants to do the work.

  5. staceyw says:

    In c#, it does not pick up the new system.data dll in the GAC so I can’t include System.Data.SqlServerCe cause I don’t know what file to reference.  Where is it?  TIA

  6. Steve.Lasker says:

    When adding a reference in a desktop project, compared to a device project, the Add Reference dialog lists the assembly as Microsoft SQL Mobile instead of System.Data.SqlServerCe.  

    We hope to fix this when Visual Studio ships Sp1 later this year.

  7. Some demo videos of various features and components that enable Occasionally Connected Applications

  8. Carlos de la Puente says:

    When I try installing the code snipplets to VB 2008 Express Edition with SP1, it says thatthe installation completed successfully, but it also says "Install Skipped." Needless to say, the snipplets were not installed. No explanation given as to why the install was skipped.

    Any suggestions on how to go about overcoming this?