Show / Hide Table of Contents

    IDataStore.OnRetrieveStart(object sender, DwRetrieveEventArgs e) Method

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

    0.5.0-alpha

    1.0.1 (current)

    This method is called when the DataStore is about to begin the data retrieval. It triggers the RetrieveStart 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 OnRetrieveStart(object sender, DwRetrieveEventArgs 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.DwRowChangeEventArgs

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

    Remarks

    In the RetrieveStart event: To prevent previously retrieved data from being cleared, set DwRetrieveEventArgs.IsResetBuffer to false to allow the current retrieval process to append new rows to the old data; to cancel the retrieval, set DwRetrieveEventArgs.IsCancel to true.

    Examples

    The following code example gets the RowCount value when Retrieve is about to begin and when it is completed.

    using PowerBuilder.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStoreExamples
    {
        public class OnRetrieveStartExample
        {
            private SchoolContext _context;
    
            public OnRetrieveStartExample(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 Retrieve is about to begin
                datastore.RetrieveStart +=
                    (sender, args) =>
                    {
                        // Executes the following code before Retrieve is executed 
                        Console.WriteLine("Before Retrieve, Rowcount: {0}",
                            args.RowCount);
                    };
    
                // Retrieves rows from the database for datastore.
                // OnRetrieveStart method is called internally to invoke the 
                // RetrieveEnd event.
                datastore.Retrieve();
    
                Console.WriteLine("After Retrieve, Rowcount: {0}",
                    datastore.RowCount);
    
                /*This code produces the following output:
                
                Before Retrieve, Rowcount: 0
                After Retrieve, Rowcount: 4           
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon