Show / Hide Table of Contents

    DataStoreExtensions.SetItem(int row, short column, object value, DwBuffer bufferType = DwBuffer.Primary) Method

    .NET Standard 2.x

    Sets the data value at the specified row and column in the specified buffer.

    Namespace: PowerScript.Bridge

    Assembly: PowerScript.Bridge.dll

    Syntax

    public static void SetItem(this IDataStoreBase dataStore, int row, short column, object value, DwBuffer bufferType = DwBuffer.Primary);
    

    Parameters

    row System.Int32

    The zero-based row location in which you want to set the value.

    column System.Int16

    The zero-based column location in which you want to set the value.

    value System.Object

    The value to which you want to set the data at the row and column location. The datatype of the value must be the same as the datatype of the column.

    bufferType DwNet.Data.DwBuffer

    The buffer where the data value will be set.

    Examples

    The following code example demonstrates how to use the SetItem method to set the value of the second column in the first row in the primary buffer.

    using System;
    using DWNet.Data;
    using PowerScript.Bridge;
    
    namespace Appeon.ApiDoc.DataStoreExtensionsExamples
    {
        public class SetItemExample
        {
            private readonly SchoolContext _context;
    
            public SetItemExample(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);
    
                // Retrieves rows from the database for datastore
                datastore.Retrieve();
    
                // Sets the value of 2nd column in 1st row to "Engineering New" in DataStore primary buffer
                datastore.SetItem(0, 1, "Engineering New", DwBuffer.Primary);
    
                Console.WriteLine("Gets the original value of name: {0}",
                    datastore.GetItemString(0, 1, DwBuffer.Primary, true));
    
                Console.WriteLine("Gets the modified value of name: {0}",
                    datastore.GetItemString(0, 1, DwBuffer.Primary, false));
    
                /*This code produces the following output:
    
                Gets the original value of name: Engineering
                Gets the modified value of name: Engineering New
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Back to top Generated by Appeon