UltraLite for MobileVB User's Guide
Tutorial: An UltraLite for MobileVB Application for Palm OS
Lesson 3: Write connection, synchronization, and table code
The final step is to write synchronization code. This step requires SQL Anywhere.
To write code for the synchronize button
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.
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.
Start the UltraLite application.
Delete all the rows in your table.
Any rows in the table would be uploaded to the ASA 9.0 Sample database.
Synchronize your application.
Click the Synchronize button.
The MobiLink synchronization server window should scroll messages displaying the synchronization progress.
When the synchronization is complete, click Next and Previous to move through the rows of the table.