All your short IDisposable objects are missing "use". So maybe you did something like:
var reader = anotherCommand.ExecuteReader(); ...
But this does not leave / close the reader. If so, add "use":
using(var reader = anotherCommand.ExecuteReader()) { ... }
Which closes the reader, no matter how we exit. Commands, connections, readers, and transactions are all one-time, and they all typically use "use."
Marc gravell
source share