Contents Index Write code to connect to an UltraLite database Write code to display order information

UltraLite ActiveX User's Guide
  Tutorial: An UltraLite Application for Pocket IE
    Lesson 5: Write the JScript sample code

Write code to synchronize the database


You must synchronize the database in order to obtain the list of products (which cannot be modified at the remote database) and an initial list of orders.

The following procedure synchronizes the database.

To synchronize the sample database

  1. Tap Synchronize.

    The code below runs.

    The ULConnection.Synchronize method takes a single parameter, show-progress. In JScript applications, show-progress is set to false because Pocket Internet Explorer does not allow messages to be displayed.

    For more information about synchronizing an UltraLite database, see Synchronizing UltraLite applications.

    function syncData() {
      var conn = top.Connection;
      var parms = conn.SyncParms;
      // Set Sync Params
      parms.Stream = 2;   // ulTCPIP = 2, ulHTTP = 1, ulHTTPS = 3
      parms.StreamParams = "";
      parms.UserName = "50";      // m_EmpIDStr;
      parms.Version = "custdb 9.0";
      conn.ErrorResume = true;
      conn.Synchronize(false);
      conn.ErrorResume = false;
      if ( conn.LastErrorCode != 0 ) {
          SetStatus("Sync failed: " + conn.LastErrorDescription );
          return;
      }
      conn.Commit();         // Save updates.
      SetStatus("Synchronized");
      SkipToValidOrder();
      SetOrderData();
    }
  2. When synchronization is complete, the word Synchronized appears at the bottom of the screen.


Contents Index Write code to connect to an UltraLite database Write code to display order information