UltraLite for MobileVB User's Guide
Tutorial: An UltraLite Application for PocketPC
Lesson 3: Write the sample code
The following procedure implements synchronization. This procedure requires SQL Anywhere.
To write code for the synchronize button
Implement the code for the Synchronize button.
Add the following procedure 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.
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 with columns matching those in the UltraLite database you have created. You can synchronize your UltraLite application with the ASA 9.0 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 displays the synchronization progress.
When the synchronization is complete, click Next and Previous to move through the rows of the table.