Show / Hide Table of Contents

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

    .NET Standard 2.x

    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: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

      public TValue GetItem<TValue>(int row, short 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 index number of the row.

    column System.Int16

    The zero-based index number of the column.

    bufferType DWNet.Data.DwBuffer

    The buffer of the DataStore. The default is DwBuffer.Primary.

    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 DWNet.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStoreBaseExamples
    {
        public class GetItemExample
        {
            private readonly SchoolContext _context;
    
            public GetItemExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example1()
            {
                // Instantiates a DataStore object with datawindow: d_department.
                var datastore = new DataStore("d_department", _context);
    
                datastore.Retrieve();
    			
    			// Sets the value of the Name column in the first row to New Department.
                datastore.SetItem(0, "name", "New Department");
    
                // Gets the original value in row 1 and in column 1 and 2 of DataStore
                // Column 1 is int type, column 2 is string type
                Console.WriteLine(
                    "Original value: Department ID: {0}; Department Name: {1}",
                    datastore.GetItem<int>(0, 0),
                    datastore.GetItem<string>(0, 1, DwBuffer.Primary, true));
    
                // Gets the modified value in row 1 and in column 1 and 2 of DataStore
                // Column 1 is int type, column 2 is string type
                Console.WriteLine(
                    "Modified value: Department ID: {0}; Department Name: {1}",
                    datastore.GetItem<int>(0, 0),
                    datastore.GetItem<string>(0, 1, 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
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon