GetDeletes method

Syntax

IDataReader GetDeletes();

Remarks

Gets a DataReader with the deletes for this uploaded table data. Each delete is represented by the primary key values needed to uniquely represent a row in this instances table.

Note: The index and order of the columns match the array for property DataTable.PrimaryKey for the schema of this table.

Returns

A DataReader with primary key columns for deleted rows.

Example

Assume your remote client contains a table called sparse_pk. The following example uses the DownloadTableData.GetDeletes method to obtain a data reader of deleted rows. In this case, the delete datareader includes two primary key columns. Note the index of each primary key column.

CREATE TABLE sparse_pk (
     pcol1  INT NOT NULL,
     col2 VARCHAR(200),
     pcol3 INT NOT NULL,
     PRIMARY KEY ( pcol1, pcol3 )
 );

  using iAnywhere.MobiLink.Script;
  using System;
  using System.IO;
  using System.Data;
  using System.Text;
 ...
  // The method used for the handle_UploadData event.

  public void HandleUpload( UploadData ut ) {
   
   // Get an UploadedTableData for the sparse_pk table.
   UploadedTableData sparse_pk_table = ut.GetUploadedTableByName("sparse_pk");
 
   // Get deletes uploaded by the MobiLink client.
   IDataReader data_reader = sparse_pk_table.GetDeletes();

   while( data_reader.Read() ) {
     StringBuilder row_str = new StringBuilder( "( " );
     row_str.Append( data_reader.GetString( 0 ) ); // pcol1
     row_str.Append( ", " );
     row_str.Append( data_reader.GetString( 1 ) ); // pcol3
     row_str.Append( " )" );
     writer.WriteLine( row_str );
   }
   data_reader.Close();
  }