The connection was added to the connection pool. So I closed it, but it still remained physically open. With the ConnectionString Parameter \"Pooli
Have a look at using something like this:
private static IEnumerable SqlRetrieve(
string ConnectionString,
string StoredProcName,
Action AddParameters)
{
using (var cn = new SqlConnection(ConnectionString))
using (var cmd = new SqlCommand(StoredProcName, cn))
{
cn.Open();
cmd.CommandType = CommandType.StoredProcedure;
if (AddParameters != null)
{
AddParameters(cmd);
}
using (var rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection))
{
while (rdr.Read())
yield return rdr;
}
}
}