Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » UltraLite - M-Business Anywhere Programming » Tutorial: A Sample Application for M-Business Anywhere

Lesson 7: Add updates and deletes to your application Next Page

Lesson 8: Add synchronization to your application

The following procedure implements synchronization.

Add a synchronization function to your application
  1. Add the Synchronize function to tutorial.js:

    The synchronization parameters are stored in the SyncParms object. For example, the SyncParms.userName property specifies the user name for which MobiLink searches. The SyncParms.sendColumnNames property specifies that the column names are sent to MobiLink so it can generate upload and download scripts.

    This function uses a TCP/IP synchronization stream and the default network communication options (stream parameters). These default options assume that you are synchronizing from either a Windows CE client connected to the computer running the MobiLink server via ActiveSync, or from a 32-bit Windows desktop client running on the same computer as MobiLink. If this is not the case, change the synchronization stream type and set the network communication options to the appropriate values. See:

    function Synchronize()
      var SyncParms = Connection.syncParms;
      try {
      } catch( ex ) {
        alert( "Sync error: " + ex.getMessage() );
  2. Add the following function to main.html:

    function ClickSync()
      window.showBusy = true;
      window.showBusy = false;
  3. Synchronize your M-Business Client.

    This synchronization downloads the latest version of the application. It does not synchronize your database.

The final step in this tutorial is to synchronize your UltraLite database. The SQL Anywhere sample database has a Customer table with columns matching those in the Customer table in your UltraLite database. The following procedure synchronizes your database with the SQL Anywhere sample database.

To synchronize your application
  1. From a command prompt, start the MobiLink server by running the following command.

    mlsrv10 -c "dsn=SQL Anywhere 10 Demo" -v+ -zu+

    The -zu+ option provides automatic addition of user scripts. For more information about this option, see MobiLink Server Options.

  2. In M-Business Client, click Delete repeatedly to delete all the rows in your table.

    Any rows in the table would be uploaded to the Customer table in the SQL Anywhere sample database.

  3. Synchronize your application.

    Click Synchronize. The MobiLink server window displays the synchronization progress.

  4. When the synchronization is complete, click Next and Previous to move through the rows of the table.

This completes the tutorial.