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

UltraLite for MobileVB User's Guide
  Tutorial: Using Dynamic SQL in an UltraLite Application for PocketPC
    Lesson 3: Write connection, synchronization, and table code

Write code to synchronize


The following procedure implements synchronization. This procedure requires SQL Anywhere.

To write code for the synchronize button

  1. Add a button named btnSync to your form.

  2. Add the following procedure to the form:

    Private Sub btnSync_Click()
        With MyConnection.SyncParms
            .UserName = "afsample"
            .Stream = ulTCPIP
            .Version = "ul_default"
            .SendColumnNames = True
        End With
        MyConnection.Synchronize
        MyResultSet.Close
        Set MyResultSet = MyPrepStmt.ExecuteQuery
        MyResultSet.MoveFirst
        DisplayCurrentRow
    End Sub

    The SyncParms object contains the synchronization parameters. Setting its SendColumnNames property to true sends the column names to MobiLink so that it can generate proper upload and download scripts.

  3. Create the Adaptive Server Anywhere consolidated database by running Samples\UltraLite\Names\build.bat.

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

    dbmlsrv9 -c "dsn=ASAConsolidated" -v+ -zu+ -za

    The ASAConsolidated database has a table that matches the columns in the UltraLite database you have created. You can synchronize your UltraLite application with this database.

    The -zu+ and -za command line options provide automatic addition of users and generation of synchronization scripts. For more information about these options, see MobiLink Synchronization Server Options.

  5. Delete the existing .udb file to avoid any conflicts.

  6. Start the UltraLite application.

  7. Synchronize your application.

    Click Synchronize.

    The MobiLink synchronization server window displays the synchronization progress.

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


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