IDataStore.InsertRow(int row) Method
.NET Standard 2.x | Current Version (1.0.1) 
Inserts an empty row to the specified position in the DataStore. If any columns have default values, the row is initialized with these values.
Namespace: PowerBuilder.Data
Assembly: PowerBuilder.Data.dll
Syntax
public int InsertRow(int row);
Parameters
row System.Int32
A value identifying the zero-based row before which you want to insert a row.
Returns
System.Int32
Returns the zero-based number of the row that was added if it succeeds.
Remarks
A newly inserted row (with a status flag of ModelState.New) is not included in the modified count until the row is populated with data (its status flag becomes ModelState.NewModified).
Examples
The following code example demonstrates how to insert an empty row before the position specified by a row number.
using PowerBuilder.Data;
using System;
namespace Appeon.ApiDoc.IDataStoreExamples
{
public class InsertRowExample
{
private SchoolContext _context;
public InsertRowExample(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();
Console.WriteLine("Before Insert, Rowcount: {0}", datastore.RowCount);
// Inserts an empty row before the first row of datastore.
datastore.InsertRow(0);
Console.WriteLine("After Insert, Rowcount: {0}", datastore.RowCount);
/*This code produces the following output:
Before Insert, Rowcount: 4
After Insert, Rowcount: 5
*/
}
}
}
Applies to
.NET Standard
2.x