IDataStore.GetRowIdFromRow(int rownumber, DwBuffer dwBuffer = DwBuffer.Primary) Method
.NET Standard 2.x | Current Version (1.0.1) 
Gets the unique row identifier of a row in the DataStore from the row number associated with that row.
Namespace: PowerBuilder.Data
Assembly: PowerBuilder.Data.dll
Syntax
public int GetRowIdFromRow(int rownumber, DwBuffer dwBuffer = DwBuffer.Primary);
Parameters
rownumber System.Int32
The zero-based row number from the specified buffer.
dwBuffer PowerBuilder.Data.DwBuffer
The specified buffer of the DataStore. The default is DwBuffer.Primary.
Returns
System.Int32
Returns the row identifier in buffer. Returns -1 if the row identifier is not in the current buffer.
Remarks
The row identifier value is not the same as the row number value used in many DataStore method calls and should not be used for the row number value. Instead you should first convert the unique row identifier into a row number by calling the GetRowFromRowId method.
Examples
The following code example demonstrates how to get the unique row identifier according to the row number.
using PowerBuilder.Data;
using System;
namespace Appeon.ApiDoc.IDataStoreExamples
{
public class GetRowIdFromRowExample
{
private SchoolContext _context;
public GetRowIdFromRowExample(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);
datastore.Retrieve();
datastore.SetSort("departmentid desc");
datastore.Sort();
var department = datastore.GetModelByRowId<D_Department>(0);
Console.WriteLine(
"Rowid=0, Department ID: {0}; Department Name: {1}",
department.Departmentid,
department.Name);
int rowid = datastore.GetRowIdFromRow(0, DwBuffer.Primary);
Console.WriteLine("When Row=0, Rowid={0}", rowid);
department = datastore.GetModelByRowId<D_Department>(rowid);
Console.WriteLine(
"Row=0, Department ID: {0}; Department Name: {1}",
department.Departmentid,
department.Name);
/*This code produces the following output:
Rowid=0, Department ID: 1; Department Name: Engineering
When Row=0, Rowid=3
Row=0, Department ID: 7; Department Name: Mathematics
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department
Applies to
.NET Standard
2.x