Show / Hide Table of Contents

    IDataStore.GetRowStatus(int row, DwBuffer dwbuffer = DwBuffer.Primary) Method

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

    0.5.0-alpha

    1.0.1 (current)

    Gets the modification status of a row. The modification status determines the type of SQL statement the Update method will generate for the row.

    Namespace: PowerBuilder.Data

    Assembly: PowerBuilder.Data.dll

    Syntax

      public ModelState GetRowStatus(int row, DwBuffer dwbuffer = DwBuffer.Primary);
    

    Parameters

    row System.Int32

    The zero-based row number to get row status.

    dwbuffer PowerBuilder.Data.DwBuffer

    A value identifying the DataWindow buffer containing the row for which you want to get status.

    Returns

    SnapObjects.Data.ModelState

    A value of the ModelState enumerated datatype.

    Remarks

    Use the GetRowStatus method and the GetItemStatus method to understand what SQL statements will be generated for the new and changed information when you update the database.

    For rows in the primary and filter buffers, Update generates an INSERT statement for rows with ModelState.NewModified status; and generates an UPDATE statement for rows with ModelState.Modified status and references the columns that have been affected.

    For rows in the delete buffer, Update does not generate a DELETE statement for rows whose status was ModelState.New or ModelState.NewModified before being moved to the delete buffer.

    Examples

    The following code example demonstrates how to get the status of a row.

    using PowerBuilder.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStoreExamples
    {
        public class GetRowStatusExample
        {
            private SchoolContext _context;
    
            public GetRowStatusExample(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);
    
                datastore.Retrieve();
    
                datastore.SetItem(0, "name", "Department Name");
    
                Console.WriteLine(
                    "Row 0 Status: {0};\n" +
                    "Row 1 Status: {1}",
                    datastore.GetRowStatus(0, DwBuffer.Primary),
                    datastore.GetRowStatus(1, DwBuffer.Primary));
    
                /*This code produces the following output:
                 
                Row 0 Status: Modified;
                Row 1 Status: NotTracked
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon