Lesson 3: Subscribing a script to the upload_insert event

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

In this lesson, you use Sybase Central to specify a .NET method as the script for the ULCustomer upload_insert event. You connect to the CustDB database using Sybase Central, replace the upload_insert SQL script with a .NET script, and specify MLExample.CustdbScripts.UploadInsert to handle the event.

Alternatively, you can use the ml_add_dnet_connection_script and ml_add_dnet_table_script stored procedures. Using these stored procedures is more efficient, especially if you have a large number of .NET methods to handle synchronization events.

 Subscribe CustdbScripts.uploadInsert to the upload_insert event for the ULCustomer table
  1. In Sybase Central, click View » Folders.

  2. In the left pane of Sybase Central under MobiLink 12, expand mldotnet_project, Consolidated Databases, mldotnet_db, Synchronized Tables, ULCustomer.

  3. In the right pane, select the custdb 12.0 upload_insert table script. Click Edit » Delete.

  4. Create a new upload_insert table script.

    1. Click File » New » Table Script.

    2. In the For Which Version Do You Want To Create The Table Script list, click custdb 12.0.

    3. In the Which Event Should Cause The Table Script To Be Executed list, click upload_insert, and click Next.

    4. Select Create a new script definition and select .NET.

    5. Click Finish.

  5. Enter the .NET method name to load for the custdb 12.0 upload_insert table script.

    In the right pane of Sybase Central, add the following .NET script for the upload_insert event:

    MLExample.CustdbScripts.UploadInsert
  6. Click File » Save to save the script.

  7. Close Sybase Central.

  8. Proceed to Lesson 4: Specifying class methods for events.