Lesson 4: Specifying class methods for events

This lesson assumes you have completed all preceding lessons. See Lesson 1: Compiling the CustdbScripts.dll assembly with MobiLink references.

The class, CustdbScripts.dll, created in a previous lesson, encapsulates the methods UploadInsert and DownloadCursor. These methods contain implementation for the ULCustomer upload_insert and download_cursor events, respectively.

In this lesson, you connect to the CustDB database with Interactive SQL and run ml_add_dnet_table_script, specifying MLExample.CustdbScripts.DownloadCursor for the download_cursor event.

 Specify MLExample.CustdbScripts.DownloadCursor for the ULCustomer download_cursor event
  1. Connect to the sample database from Interactive SQL.

    1. Click Start » Programs » SQL Anywhere 12 » Administration Tools » Interactive SQL, or run the following command:

      dbisql
    2. Click ODBC Data Source Name and type SQL Anywhere 12 CustDB.

    3. Click Connect.

  2. Execute the following SQL statements in Interactive SQL to specify .NET methods to handle ULCustomer table-level events:

    CALL ml_add_dnet_table_script(
        'custdb 12.0',
        'ULCustomer',
        'download_cursor',
        'MLExample.CustdbScripts.DownloadCursor');
    COMMIT;

    The following is a description of each parameter:

    Parameter Description
    custdb 12.0 The script version.
    ULCustomer The synchronized table.
    download_cursor The event name.
    MLExample.CustdbScripts.DownloadCursor The fully qualified .NET method.
    Note

    Your updated download_cursor script might not appear in Sybase Central. To view the most recent changes to the MobiLink project in Sybase Central, click View » Refresh All.

  3. Close Interactive SQL.

  4. Proceed to Lesson 5: Running the MobiLink server with -sl dnet.

 See also