Is there a way to check if I'm on the last record ? thanks
Use this pattern to identify and process the last row in result:
if (reader.Read())
{
var loop = true;
while (loop)
{
//1. Here retrive values you need e.g. var myvar = reader.GetBoolean(0);
loop = reader.Read();
if (!loop)
{
//You are on the last record. Use values read in 1.
//Do some exceptions
}
else {
//You are not on the last record.
//Process values read in 1., e.g. myvar
}
}
}