UpdateDataReader GetUpdates();
Gets a DataReader with the updates for this uploaded table data. Each row in the result set represent one update. The mode of the result set can be flipped between new and old column values.
A DataReader with updates for this table data.
The following example illustrates how to use the GetUpdates method.
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. UpdateDataReader data_reader = sparse_pk_table.GetInserts(); while (data_reader.Read()) { data_reader.SetNewRowValues(); StringBuilder row_str = new StringBuilder("New values ( "); row_str.Append(data_reader.GetString(0)); // pcol1 row_str.Append(", "); if (data_reader.IsDBNull(1)) { row_str.Append("<NULL>"); } else { row_str.Append(data_reader.GetString(1)); // col2 } row_str.Append(", "); row_str.Append(data_reader.GetString(2)); // pcol3 row_str.Append(" )"); data_reader.SetOldRowValues(); row_str.Append(" Old Values ("); row_str.Append(data_reader.GetString(0)); // pcol1 row_str.Append(", "); if (data_reader.IsDBNull(1)) { row_str.Append("<NULL>"); } else { row_str.Append(data_reader.GetString(1)); // col2 } row_str.Append(", "); row_str.Append(data_reader.GetString(2)); // pcol3 row_str.Append(" )"); writer.WriteLine(row_str); } data_reader.Close(); } |
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |