Show / Hide Table of Contents

    IDataStore.OnUpdateEnd(object sender, DwUpdateEventArgs e) Method

    .NET Standard 2.x | Current Version (1.0.1)

    0.5.0-alpha

    1.0.1 (current)

    This method is called after DataStore has finished updating the data. It triggers the UpdateEnd event by default, and it can be overridden in a child class of the DataStore.

    Namespace: PowerBuilder.Data

    Assembly: PowerBuilder.Data.dll

    Syntax

      public void OnUpdateEnd(object sender, DwUpdateEventArgs e);
    

    Parameters

    sender System.Object

    An event sender in which the event occurred. It is a reference to the current DataStore by default.

    e PowerBuilder.Data.DwUpdateEventArgs

    A DwUpdateEventArgs object which can be used to pass by event arguments.

    Remarks

    In the UpdateEnd event, you can use:

    • DwUpdateEventArgs.RowsInserted to receive the number of rows inserted;

    • DwUpdateEventArgs.RowsUpdated to receive the number of rows updated;

    • DwUpdateEventArgs.RowsDeleted to receive the number of rows deleted.

    Examples

    The following code example demonstrates how to use the OnUpdateEnd method.

    using PowerBuilder.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStoreExamples
    {
        public class OnUpdateEndExample
        {
            private SchoolContext _context;
    
            public OnUpdateEndExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example()
            {
                // Instantiates a DataStore object with datawindow: d_department.
                var datastore = new DataStore("d_department", _context);
    
                // Defines what to do when update is completed
                datastore.UpdateEnd +=
                   (sender, args) =>
                    {
                        // Executes the following code after update is executed.
                        Console.WriteLine("After Update, RowsUpdated count: {0}",
                            args.RowsUpdated);
                    };
    
                // Retrieves rows from the database for datastore.
                datastore.Retrieve();
    
                Console.WriteLine("After Retrieve, Rowcount: {0}",
                    datastore.RowCount);
    
                // Modifies the value for budget in row 1.
                datastore.SetItem(0, "budget", 220000.00m);
    
                // Deletes the last row.
                datastore.DeleteRow(datastore.RowCount - 1);
    
                // OnUpdateEnd method is called internally to invoke the 
                // UpdateEnd event.
                datastore.Update();
    
                /*This code produces the following output:
                
                After Retrieve, Rowcount: 4
                After Update, RowsUpdated count: 2           
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon