Contents Index Write code for data manipulation Lesson 4: Deploy the application to a device

UltraLite for MobileVB User's Guide
  Tutorial: An UltraLite for MobileVB Application for Palm OS
    Lesson 3: Write connection, synchronization, and table code

Write code to synchronize


The final step is to write synchronization code. This step requires SQL Anywhere.

To write code for the synchronize button

  1. Implement the code for the Synchronize button.

    Add the following routine to the form:

    Private Sub btnSync_Click()
        With Connection.SyncParms
            .UserName = "afsample"
            .Stream = ULStreamType.ulTCPIP
            .Version = "ul_default"
            .SendColumnNames = True
        End With
        Connection.Synchronize
        DisplayCurrentRow
    End Sub

    The SyncParms object contains the synchronization parameters. For this simple example, we start MobiLink so that it will add new users. Also, we send the column names to MobiLink so it can generate proper upload and download scripts.

    The code uses TCP/IP synchronization, and not HotSync synchronization. It works on a Palm OS device only as long as it is set up for TCP/IP synchronization.

  2. From a command prompt, start the MobiLink synchronization server with the following command line:

    dbmlsrv9 -c "dsn=ASA 9.0 Sample" -v+ -zu+ -za

    The ASA 9.0 Sample database has a Customer table that matches the columns in the UltraLite database you have created. You can synchronize your UltraLite application with the ASA 9 Sample database.

    The -zu+ and -za command line options provide automatic addition of users and generation of synchronization scripts. For more information on these options, see the MobiLink Synchronization User's Guide.

  3. Start the UltraLite application.

  4. Delete all the rows in your table.

    Any rows in the table would be uploaded to the ASA 9.0 Sample database.

  5. Synchronize your application.


Contents Index Write code for data manipulation Lesson 4: Deploy the application to a device