SQL Mobile rocks!

After having attended some pretty impressive presentations on CF 2.0 and SQL Mobile (SQL Server 2005 Mobile Edition, i.e. :-), the successor of SQLCE 2.0, at TechEd Europe, I am playing with the VS2005 Beta 1 and a pre-Beta 2 build of SQL2005. What can I say – I’m blown away by what these teams are building!

Creating a publication and setting up replication for SQL Mobile in the SQL Workbench is a snap, couldn’t be easier. Then configure a virtual directory on the IIS for the replication, and create a SQL Mobile (.SDF, as before) database from that publication, just using the wizard, without writing a single line of code or awkward configuring of this and that. And the best is, the wizard even spits out the C# or VB.NET code that can be later used in a CF app to do the synchronization! Looks like this:

SqlCeReplication repl = new SqlCeReplication();
repl.InternetUrl = @”
repl.InternetLogin = @”frankpr”;
repl.InternetPassword = <…>;
repl.Publisher = @”XPFRANKPR1″;
repl.PublisherDatabase = @”Northwind”;
repl.PublisherSecurityMode = SecurityType.DBAuthentication;
repl.PublisherLogin = @”sa”;
repl.PublisherPassword = <…>;
repl.Publication = @”Northwind”;
repl.Subscriber = @”northwind”;
repl.SubscriberConnectionString = @”Data Source=’C:\nw.sdf’;Password=”;Max Database Size=’128′;Default Lock Escalation =’100′;”;


The above code uses publication/replication to create a new SQL Mobile database on your device and sync it with the server.

In the VS2005 IDE, you can connect to any existing SDF on your machine or device, and manage that DB there. You can also create a datasource based on that connection, and directly drag and drop tables from that datasource (i.e., the underlying SDF) onto your form (lets you choose between datagrid or data entry form with various textboxes – similar to the Dataform Wizard on the desktop). You can even configure master-detail relations if your data source contains multiple tables.

Compared to this, CF 1.0 and SQLCE 2.0 look like stone-age technology… 🙂

Comments (6)

  1. Bill says:

    Hi Frank:

    I just got the newest release of VS 2005 and I’m stumped (it just arrived from MSDN and isnt’ the Express version or any of the older versions).

    I can’t find the refernce for Sql Mobile so I can’t seem to be able to use the SqlCeResultSet – when I declare an SqlceResultSet object, I get the error in the ide as I’d expect when I’m missing a refernce, but the new "missing reference’ feature of VS 2005 isn’t recommending it either.

    Any ideas?

    Also, where is the Workbench? i’ve seen it in the demos back at the MVP Summit but I can’t find it anywhere – this is the build that’s been touted to have all of that so I’m really stumped. Any ideas?



  2. FrankPr says:


    Don’t know what’s wrong with your installation – SqlCeResultSet works fine in my VS2005 (the path to the DLL containing System.Data.SqlServerCe is "C:Program FilesMicrosoft Visual Studio 8SmartDevicesSDKSQL ServerMobilev3.0System.Data.SqlServerCe.dll" on my machine).

    Also, I don’t know about the workbench – I use the "Microsoft SQL Server Management Studio" from my SQL2005 pre-Beta 2 installation which allows you to create & manipulate SQL Mobile DBs in any way you want (screenshot at http://www.frankpr.net/images/sqlmob.jpg), incl. wizards-based publication and replication.

  3. FrankPr says:

    Ahhh, I realize that I created some confusion in my post by using the word "Workbench" – sorry for that, I meant the Mgmt. Studio that comes with SQL 2005.

  4. FrankPr says:

    And, of course, the SQL Mgmt. Studio *is* the workbench – process name is "SqlWb.exe". (You’d better have a lot of RAM when you test this – currently SqlWb.exe is at 110 MB, sqlservr.exe at 325 MB in memory, devenv.exe at 220 MB, according to Task Manager…)

    I need more coffee. (Who needs sleep, anyway? Waste of time.)

  5. Today is one of those I days I miss Take Outs.