Show / Hide Table of Contents

    IDataStore.RowCount Property

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

    0.5.0-alpha

    1.0.1 (current)

    Gets the number of rows in the primary buffer of DataStore.

    Namespace: PowerBuilder.Data

    Assembly: PowerBuilder.Data.dll

    Syntax

      public int RowCount { get; }
    

    Property Value

    System.Int32

    The number of rows in the primary buffer of DataStore.

    Remarks

    It gets the number of the currently available rows, which is the total number of rows retrieved minus any deleted or filtered rows and plus any inserted rows. The deleted and filtered rows are stored in the delete and filter buffers.

    Examples

    The following code example gets the total number of the rows in the DataStore first after retrieved and then after filtered.

    using PowerBuilder.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStoreExamples
    {
        public class RowCountExample
        {
            private SchoolContext _context;
    
            public RowCountExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example()
            {
                // Instantiates datastore with datawindow: d_department
                var datastore = new DataStore("d_department", _context);
    
                datastore.Retrieve();
    
                // Gets the total number of records
                int rowcnt = datastore.RowCount;
    
                Console.WriteLine("Retrieved Rowcount: {0}",
                    rowcnt);
    
                // Filters data that do not meet criteria 'Budget > 200000'
                datastore.SetFilter("Budget > 200000");
                datastore.Filter();
    
                // After data is filtered, gets the total number of records again
                int rowcntnew = datastore.RowCount;
    
                Console.WriteLine("After filtered, Primary Buffer Rowcount: {0}",
                    rowcntnew);
    
                /*This code produces the following output:
                
                Retrieved Rowcount: 4
                After filtered, Primary Buffer Rowcount: 2
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon