views:

40

answers:

3

I have a desktop application (C# .NET 3.5) that uses a SQL server for it's database. I have had a request from the client, however, to make it possible to export the database as it stands, and be able to use it on a laptop without connectivity. They understand that updates to the parent server will not be reflected in these offline clients.

Is there a way I can just save the DataSet's to a binary form and write them to a disk and send those files to the offline clients.

+3  A: 

You could either use Compact Edition (aka. SDF files), or you can save the datasets as XML using the built-in method.

Rowland Shaw
I like the XML exportation. I think I'll do this.
WedTM
+2  A: 

Can't you just take a SQL Server level backup and have them install e.g. SQL Server Express on their laptops and restore the database there?

That way you wouldn't have to do anything special in your app at all - just change the connection string to point to the local SQL Server Express instance, and off you go! No mucking around with serialized data sets and stuff......

marc_s
I don't want them to have to install any additional software. Yes, SQL server express is an option. However, the target audience is not technically savvy, and I don't want 20,000 SQL Server Express instances showing up in network browsers across their org.
WedTM
plus you could configure "on demand" merge replication to syncronize the two if it was ever needed (although rowguid columns like to be a pain with some data access code).
KSimons
This is not a syncro situation. I wouldn't want the syncro'ed. Basically I have a central server, that is what's used 90% of the time. Some times, however, I have a workstation that won't have connectivity, so I wanted a way that I can simply have one person "Export" the data, and hand it to the operator of the non-connected system.
WedTM
+4  A: 

There is an entire line of tools and technologies covering this case, namely the Synch Framework. See Synchronizing Databases. See Getting Started: Client and Server Synchronization for a starting example involving a SQL Server Compact Edition file on the client (.SDF file) that is synchronized with a SQL Server central database. Note that the client won't install anything else other than you application, the SQL Server CE is just a few in-process DLLs that you distribute with your app, nothing nearly as complex as a SQL Express edition on the client.

The good news is that Synch Framework no only allows the client to get their own on-the-go snapshot of the database, it actually allows for changes applied while disconnected to be merged back into the central site.

Remus Rusanu