Show / Hide Table of Contents

    IDataStore.GetItem<TValue>(int row, string column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) Method

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

    0.5.0-alpha

    1.0.1 (current)

    Generic method. Gets the data for the specified row and column from the specified buffer of the DataStore. You can obtain the data that was originally retrieved and stored in the database, as well as the current value in the primary, delete, or filter buffers.

    Namespace: PowerBuilder.Data

    Assembly: PowerBuilder.Data.dll

    Syntax

      public TValue GetItem<TValue>(int row, string column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false);
    

    Type Parameters

    TValue

    The type of data for the specified row and column from the specified buffer.

    Parameters

    row System.Int32

    The zero-based row number to get data.

    column System.String

    The name of a column to get data.

    To get the contents of a computed field, specify the name of the computed field for column. Computed fields do not have numbers.

    bufferType PowerBuilder.Data.DwBuffer

    The specified buffer of the DataStore.

    isOriginalValue System.Boolean

    Whether to obtain the data that was originally retrieved.

    True: to obtain the data that was originally retrieved; False (default): to obtain the current data.

    Returns

    TValue

    Returns the value in the specified row and column. The datatype of the returned data corresponds to the datatype of the column.

    Examples

    The following code example demonstrates how to use the GetItem method to get values in the specified row and column.

    using PowerBuilder.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStoreExamples
    {
        public class GetItemExample
        {
            private SchoolContext _context;
    
            public GetItemExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example2()
            {
                // Instantiates a DataStore object with datawindow: d_department.
                var datastore = new DataStore("d_department", _context);
    
                datastore.Retrieve();
    
                datastore.SetItem(0, "name", "New Department");
    
                // Gets the original value in row 1 and in the departmentid column and 
                // name column of DataStore.
                // The departmentid column is int type; the name column is string type.
                Console.WriteLine(
                    "Original value: Department ID: {0}; Department Name: {1}",
                    datastore.GetItem<int>(0, "departmentid"),
                    datastore.GetItem<string>(0, "name", DwBuffer.Primary, true));
    
                // Gets the modified value in row 1 and in the departmentid column and 
                // name column of DataStore.
                // The departmentid column is int type; the name column is string type.
                Console.WriteLine(
                    "Modified value: Department ID: {0}; Department Name: {1}",
                    datastore.GetItem<int>(0, "departmentid"),
                    datastore.GetItem<string>(0, "name", DwBuffer.Primary, false));
    
                /*This code produces the following output:
                 
                Original value: Department ID: 1; Department Name: Engineering
                Modified value: Department ID: 1; Department Name: New Department
                */
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon