Dela via


Occasionally Connected Data Sample

This sample demonstrates how to use Microsoft Synchronization Services for ADO.NET for two-tier download-only synchronization. The sample is designed for the version of Synchronization Services that is included with Visual Studio 2008. The sample solution contains a single project that includes the UI form, data access code, and synchronization agent code.

To get samples and instructions for installing them

  • Do one or more of the following:

    • On the Help menu, click Samples.

      The Readme displays information about samples.

    • Visit the Visual Studio 2008 Samples Web site. The most recent versions of samples are available there.

    • Locate samples on the computer on which Visual Studio is installed. By default, samples and a Readme file are installed in drive:\Program Files\Microsoft Visual Studio 9.0\Samples\lcid. For Express editions of Visual Studio, all samples are located online.

For more information, see Visual Studio Samples.

Security noteSecurity Note:

This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.

To run the sample

  1. Run the server database script that is in the SQL Scripts folder under the project root. This sets up the tables for change tracking.

  2. Open the sample solution in Visual Studio.

  3. Change the server connection string to connect to the Northwind database on your test server:

    1. Double-click the My Project node for each project.

    2. Click Settings.

    3. Change the connection string.

  4. Press F5 to build and run the sample.

Requirements

This sample requires that you have the Northwind database installed on a test server. For more information, see How to: Install and Troubleshoot Database Components for Samples.

Demonstrates

The sample demonstrates synchronization. Click Synchronize in the sample application. This downloads data from the server to the .sdf file. Next, make data changes in the server data grid, and then click the save button.

Click Synchronize again to download your changes to the client.

See Also

Tasks

Walkthrough: Creating an Occasionally Connected Application

Concepts

Occasionally Connected Applications Overview

Other Resources

Data Samples