We have a simple loop process that does some stuff on some datarows.
When commiting changes the new row and a SqlConnection object are passed to a method that handles the row change or addition.
The process runs 5 times out of 10 all ok. The SqlConnection is opened at the start of the loop and closed after the loop however sometimes it does indeed close during the loop. The code is no calling close() at any point during the loop.
So my questions is why it might close on it's own.
Cheers
For a reference the code resembles the following
connection.Open();
foreach(DataRow row in rows)
{
if(rubbish)
{
//make some changes and save
DatabaseConnector.Save(sqlStringToExecute, connection);
}
}
connection.Close();