The Configuration control is used to initialize the device and is always loaded first; the standard navigation bar is unavailable until the steps on the configuration control are completed. To begin (as shown in the following illustration), in the Server Name field, enter the path to an instance of Microsoft® SQL Server™ 2000.
Tap Next to direct the application to connect to the specified data store. The application retrieves all the unique driver ID records from the Customers table using remote data access (RDA). The data is stored in the temporary local database DriverIDs. This database contains only driver ID records and is not used to store any other data. As shown in the following illustration, the Server Name field is unavailable. To enable the Server Name field, tap Back. This allows you to specify another instance of SQL Server to connect to if, for example, the correct driver ID is not found.
As shown in the following illustration, after an instance of SQL Server and a driver ID are selected, the Sync Method combo box displays the two available synchronization methods: Replication and RDA. The Driver ID field is unavailable. To select a different driver ID, tap Back to enable the Driver ID field. Tap Finish to select one of the synchronization methods and to begin a communication session with the computer running SQL Server.
All data access code is contained in the class IBuySpyData, including the methods that perform replication and RDA synchronization with the SQL Server database: ReplSync() and RDASync(). The RDASync() and ReplySync() methods both perform bidirectional and upload-only data synchronization. The RDASync() method also downloads indexes along with data during bidirectional synchronization, demonstrating the new index pull capabilities. For more information about the IBuySpyData class and its methods, see IBuySpy Delivery Sample Code.
After synchronization occurs through replication or RDA, the database running on the handheld device (IBuySpyStore.sdf) contains a subset of the records in the SQL Server database. The SQL Server database is filtered on the DriverID column in the Customers table, and the device receives only those records that correspond to the driver ID specified during configuration.
The values specified during the configuration process (Server Name, Driver ID, and Sync Method) are stored in the local Settings table. When IBuySpy Delivery is first started, the application checks whether the local database exists and, if so, uses the values stored in the Settings table to provide default values for the configuration control.
After synchronization is complete, as shown in the following illustration, four buttons are available: Reset, Change Driver, Quick Sync, and Full Sync. The Sync Method field is unavailable. The standard navigation buttons are active (except for Configuration because this control is currently loaded) and the value for the driver ID is displayed., Tapping Full Sync and Quick Sync result in different actions, depending on whether replication or RDA is being used. Before quick synchronization can be used for the first time, you must first perform a full synchronization.
|Synchronization method||Quick synchronization action||Full synchronization action|
|RDA||Push||Push, drop, pull|
To change the value for the driver ID, tap Change Driver. This results in the download of a new subset of data from the SQL Server database. Tapping Change Driver opens a message box with the warning: "You are about to change the Driver ID. Selecting a new Driver ID will cause a synchronization to occur." The Driver ID combo box is enabled and any change causes the subscription at the SQL Server CE database to be reinitialized after first conducting an upload-only transfer to SQL Server.
Tapping Reset also first opens a message box with the warning: "You are about to reset all configuration settings. Continuing will discard all changes." The local database in Microsoft SQL Server 2000 Windows® CE Edition (SQL Server CE) is then deleted, returning the device to an uninitialized state in which Server Name, Driver ID, and Sync Method are no longer set.
A sample copy of the IBuySpyStore.sdf SQL Server CE database is included with the IBuySpy Delivery Visual Studio® .NET project. When IBuySpyStore.sdf is copied onto the device, the configuration steps listed above do not have to be completed before you can begin using the IBuySpy Delivery application. All features of the IBuySpy Delivery application will be available except for synchronization using replication. To use replication, you must complete all configuration steps listed above.
The default location of the Visual Studio .NET project is \Program Files\IBuySpyDelivery\Client (and then \VB or \Cs, depending on which version is installed). IBuySpyStore.sdf can be copied onto the device by editing the properties of this file in Visual Studio .NET and changing the Build Action from None to Content. To change the Build Action, right click on the IBuySpyStore.sdf file in the Solutions Explorer and select Properties. In the Properties window, click on Build Action and select Content from the drop-down box.