Destination SQL Server 2005 (Mobile Edition)

Hi Folks...

The title of this post may make it sound like a movie. But it ain't. This is a contemporary post noir set on the devices of a gritty, yet colorful SQL Server neighborhood... :D (That was gross, I concur! Hopefully the meat of the post will have some substance and better humor than its opening line)

The reason for this post was is the following question posted on one of our internal Data on Devices related aliases.

We wish to push SQL Server Mobile database file from a desktop application developed in VS2005 to the mobile device Here it is in a nutshell:

1) POPULATE the mobile database with data on the desktop
2) PUSH the mobile database to the mobile device

We have following Questions

1) Figuring out how to populate a SQL Server Mobile database file from a desktop application developed in VS2005 (and to do so directly, without RDA, Replication or XML).
2) Identify the best way to PUSH the above SQL Server Mobile file to the mobile device (i.e., do we still use RAPI's DesktopToDevice?)
3) Determining which .DLL's our application will need to install on the end-users Desktop PC to enable both the POPULATE and PUSH functionality as developed
4) Making sure we have Microsoft's permission to redistribute said .DLL's.

As you have noticed, we have a rich data-on-devices story with Visual Studio 2005. A lot of work went into this area since Visual Studio 2003 and data-on-devices story is now on par with the desktop data scenarios. Which means that the answer to the above question needs to be broadcasted to a much bigger audience...

Here it is, from Laxmi Narsimha Rao, my colleague from SQL Server 2005 Mobile Edition team:

I wanted to let you know the following things before jumping into answering your questions:

1) SQL Mobile is unrestricted only for devices and tablet-pc
2) SQL Mobile is unrestricted for desktops that have either VS 2005 or SQL 2005 installed

Given that information, coming to your operations:

1) POPULATE – This is done on the desktop. It means that you should either have VS 2005 or SQL 2005 in order for SQL Mobile to work. 
    a. Say the desktop has VS 2005, you can populate the database using our System.Data.SqlServerCe namespace 
        i. SqlCeEngine – Create Database 
        ii. SqlCeConnection and SqlCeCommand – Populate the database 
        (Please note that SQL Mobile supports parameterized queries. Let the customer know about this to get best out of SQL Mobile.)
2) PUSH – This is nothing but copying the database file created in the above step to the device. There are lot of ways you can do this: 
    a. VS 2005 Auto Deployment – Add SQL Mobile .SDF file to the device project and when you hit F5, it automatically deploys the .SDF file too 
    b. Use Active Sync File Explorer and copy manually 
    c. Use RAPI

And the answers for your questions:

1) RDA, Merge Replication – None of these is needed to populate the database when you have the data at your hand. But any of these is needed when you have the data in SQL Server.
2) As explained above
3) This depends on what your device app is going to do with database on device. If your app is using the DB just as a local store, then you just need first two cabs. If your device app is going to do some sync with SQL Server, then you need the third cab.  
4) Covered by earlier answers and information 

Let me know if you need some more info and/or other clarifications on the above topic. In fact any topic on Data-on-Devices.

As a side note, I own the Visual Studio for Devices, Data components and I do have plans for a few posts on Data-on-Device. But if there is something specific that you want me to make a post on, I'd be glad. Just let me know...

See you then, in my next post...