Show / Hide Table of Contents

    DataStoreExtensions.SetRowData(int row, object value, DwBuffer bufferType = DwBuffer.Primary) Method

    .NET Standard 2.x

    Sets the data value for the specified row in the specified buffer of DataStore.

    Namespace: PowerScript.Bridge

    Assembly: PowerScript.Bridge.dll

    Syntax

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

    Parameters

    row System.Int32

    The zero-based row number to get data.

    value System.Object

    The data value to be set.

    bufferType DwNet.Data.DwBuffer

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

    Examples

    The following code example demonstrates how to use the SetRowData method to set the data values for the first row in the primary buffer of DataStore.

    using System;
    using DWNet.Data;
    using PowerScript.Bridge;
    using Appeon.ApiDoc.Models;
    
    namespace Appeon.ApiDoc.DataStoreExtensionsExamples
    {
        public class SetRowDataExample
        {
            private readonly SchoolContext _context;
    
            public SetRowDataExample(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);
    
                // Retrieves data.
                datastore.Retrieve();
    
                // Creates a new D_Department object. 
                var model = new D_Department() { Departmentid=10, Name = "department name" };
    
                // Sets the data values for the first row in the DataStore primary buffer.
                datastore.SetRowData(0, model, DwBuffer.Primary);
    
                int departmentid = datastore.GetItem<int>(0, "Departmentid");
                string name = datastore.GetItem<string>(0, "Name");
    
                Console.WriteLine($"departmentid={departmentid}, name={name}");
    
                /*This code produces the following output:
                
                departmentid=10, name=department name           
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon