IDataStoreBase.SetItem(int row, short column, object value) Method
.NET Standard 2.x
Sets the value of a row and column (by column name).
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public bool SetItem(int row, short column, object value);
Parameters
row
System.Int32
The zero-based index number of the row.
column
System.Int16
The name of the column.
value
System.Object
The value to which you want to set at the specified row and column. The datatype of the value must be the same as the datatype of the column.
Returns
System.Boolean
Returns true
if it succeeds.
Examples
The following code example uses the SetItem
method to modify the value for the second column in the first row.
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.IDataStoreBaseExamples
{
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();
Console.WriteLine("After Retrieve, Rowcount: {0}",
datastore.RowCount);
// Sets the value for the second column in the first row to "Engineering New"
datastore.SetItem(0, 1, "Engineering New");
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:
After Retrieve, Rowcount: 4
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
Applies to
.NET Standard
2.x