PreviousNext
Help > Easycom .NET > Easycom namespace > EasycomDataSet > EasycomDataSet.GetPosition Method
EasycomDataSet.GetPosition Method

 Gets the current position in the dataset.

 

Class EasycomDataSet

 

Syntax

public Integer EasycomDataSet.GetPosition(): Integer;

 

Description

 

EasycomDataSet.GetPosition returns the current position.

If the dataset belongs to a file the position is a unique integer that is actually the AS/400 relative record number, which has no relationship with the record rank.

If the dataset is a query, the position is a value relative to the first or to the last record. The value is positive if the position is relative to the first record (for example = 4 if this is the 4th record), and negative if the position is relative to the last record (for example = -4 if this is the 4th record starting from last).

 

If there is no current position, and exception will be thrown (will occur if the position is asked just after having opened a file).

 

 

Example of use (VB.NET):

The following example gets the position of the last record (that is not the rank of the last record).

 

Dim my_cnx As EasycomConnection

Dim my_file As EasycomFile

Dim posi As Integer

 

my_cnx = New EasycomConnection

my_cnx.ConnectionString = "Server=194.206.160.111;User Id=

my_cnx.Open()

 

my_file = my_cnx.OpenFile("S_CUSTOMER")

 

If my_file.ReadLast Then

posi = my_file.GetPosition()

End If

 

Example of use (C#) :

The following example gets the position of the last record (that is not the rank of the last record).

 

EasycomConnection my_cnx = new EasycomConnection();

EasycomFile my_file = new EasycomFile(my_cnx,"S_CUSTOMER");

int position =0;

 

my_cnx.ConnectionString = "Server=194.206.160.111;User Id=";

my_cnx.Open(); 

my_file = my_cnx.OpenFile("S_CUSTOMER")

 

if (my_file.ReadLast())

{

    position = my_file.GetPosition();

}