Thanks for you reply.
I think that the SqlConnection has nothing to do since I'm working with DataTable.
I'm creating the DataTableReader from DataTable because I have this function.
public Checkpoint LoadFromDataReader(IDataReader oReader) {
nkChk = (int)oReader["nkChk"];
sChkStatus = ((string)oReader["sChkStatus"]).ToLower();
sChkStatus3w = ((string)oReader["sChkStatus3w"]).ToLower();
sChkSerial = ((string)oReader["sChkSerial"]).Trim();
.
.
.
return this;
}
while(oReader.Read()) {
Checkpoint oCheckpoint = new Checkpoint().LoadFromDataReader(oReader);
}
and that way I can call it with any reader (SqlDataReader, DataTableReader, ...)
So I did this to try your solution
public Checkpoint LoadFromDataRow(DataRow oRow) {
nkChk = (int)oRow["nkChk"];
sChkStatus = ((string)oRow["sChkStatus"]).ToLower();
sChkStatus3w = ((string)oRow["sChkStatus3w"]).ToLower();
sChkSerial = ((string)oRow["sChkSerial"]).Trim();
.
.
.
return this;
}
foreach(DataRow oRow in oTable.Rows) {
Checkpoint oCheckpoint = new Checkpoint().LoadFromDataRow(oRow);
}
and it works, but it spoils the generality. Also it keeps bugging me that it crashes only when debugging and that it was working fine until recently.
I will not accept your answer as solution yet, in case someone explains why is this happening, but I'll rate it with 5.