UltraLite for M-Business Anywhere User's Guide
Tutorial: A Sample Application for M-Business Anywhere
The following procedure implements synchronization.
Add a synchronization function to your application
Add the Synchronize() function to tutorial.js:
The synchronization parameters are stored in the ULSyncParms object. For example, the ULSyncParms.UserName property specifies the user name that MobiLink looks for. The ULSyncParms.SendColumnNames property specifies that the column names will be sent to MobiLink so it can generate upload and download scripts.
This function uses a TCP/IP synchronization stream and the default network communication options (stream parameters). These default options assume that you are synchronizing from either a Windows CE client connected to the computer running the MobiLink server via ActiveSync, or from a Windows XP client running on the same computer as MobiLink. If this is not the case, change the synchronization stream type and set the network communication options to the appropriate values.
For more information, see Method setStream and Method setStreamParms
function Synchronize()
{
var SyncParms = Connection.syncParms;
SyncParms.setUserName("user-name");
SyncParms.setStream(SyncParms.STREAM_TYPE_TCPIP);
SyncParms.setVersion("ul_default");
SyncParms.setSendColumnNames(true);
try {
Connection.synchronize();
} catch( ex ) {
alert( "Sync error: " + ex.getMessage() );
}
}Add the following function to main.html:
function ClickSync()
{
window.showBusy = true;
Synchronize();
window.showBusy = false;
DisplayCurrentRow();
}Synchronize your M-Business Client.
This synchronization downloads the latest version of the application. It does not synchronize your database.
The final step in this tutorial is to synchronize your UltraLite database. The ASA 9.0 Sample database has a Customer table with columns matching those in the Customer table in your UltraLite database. The following procedure synchronizes your database with the ASA 9.0 Sample database.
To synchronize your application
From a command prompt, start the MobiLink synchronization server by running the following command line.
dbmlsrv9 -c "dsn=ASA 9.0 Sample" -v+ -zu+ -za
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 同步服务器选项.
In M-Business Client, click Delete repeatedly to delete all the rows in your table.
Any rows in the table would be uploaded to the Customer table in the ASA 9.0 Sample database.
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.
This completes the tutorial.
SQL Anywhere Studio 9.0.2
版权所有 © 1989–2005 Sybase, Inc. 部分版权所有 © 2001–2005 iAnywhere Solutions, Inc. 保留所有权利。