UltraLite for MobileVB User's Guide
Tutorial: Using Dynamic SQL in an UltraLite Application for PocketPC
Lesson 3: Write connection, synchronization, and table code
The following procedure implements synchronization. This procedure requires SQL Anywhere.
To write code for the synchronize button
Add a button named btnSync to your form.
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.
Create the Adaptive Server Anywhere consolidated database by running Samples\UltraLite\Names\build.bat.
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.
Delete the existing .udb file to avoid any conflicts.
Start the UltraLite application.
Synchronize your application.
Click Synchronize.
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.