Show / Hide Table of Contents

    IDataStore.GetItemDate(int row, string column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) Method

    .NET Standard 2.x

    Gets data whose type is DateTime 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. The time value is set to 12:00:00 midnight (00:00:00).

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

      public DateTime? GetItemDate(int row, string column, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false);
    

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

    System.DateTime?

    Returns the DateTime? value in the specified row and column.

    The time value is set to 12:00:00 midnight (00:00:00).

    Remarks

    Use GetItemDate when you want to get information from the DataWindow buffer. To access a row in the original buffer, specify the buffer that the row currently occupies (primary, delete, or filter) and the number of the row in that buffer. When you specify true for isOriginalValue, the method gets the original data for that row. An execution error occurs when the datatype of the DataStore column does not match with the datatype of the method; in this case, datetime.

    Examples

    The following code example demonstrates how to use the GetItemDate method to get the date-type value in the specified row and column.

    using DWNet.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStoreExamples
    {
        public class GetItemDateExample
        {
            private readonly SchoolContext _context;
    
            public GetItemDateExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example2()
            {
                // Instantiates a DataStore object with datawindow: d_coursedescription.
                var datastore = new DataStore("d_coursedescription", _context);
    
                datastore.Retrieve();
    			
    			// Sets the "inputdate" column in the first row to "2018-01-01".
                datastore.SetItem(0, "inputdate", DateTime.Parse("2018/01/01"));
    
                // Gets the original value in the first row and in the 'description' column 
                // and 'inputdate' column of DataStore.
                // The 'inputdate' column is DataTime? type.
                Console.WriteLine(
                    "Original value: Description: {0};\n" +
                    "inputdate: {1}",
                    datastore.GetItem<string>(0, "description"),
                    datastore.GetItemDate(0, "inputdate", DwBuffer.Primary, true));
    
                // Gets the modified value in the first row and in the 'description' column 
                // and 'inputdate' column of DataStore.
                Console.WriteLine(
                    "Modified value: Description: {0};\n" +
                    "inputdate: {1}",
                    datastore.GetItem<string>(0, "description"),
                    datastore.GetItemDate(0, "inputdate", DwBuffer.Primary, false));
    
                /*This code produces the following output:
                
                Original value: Description: Calculus Description;
                inputdate: 8/8/2008 12:00:00 AM
                Modified value: Description: Calculus Description;
                inputdate: 1/1/2018 12:00:00 AM
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Coursedescription
    DataWindow File: d_coursedescription

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon