Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • Why don't you add finally clause to the normal exception.(SqlException in this case..) Commented Sep 15, 2011 at 15:18
  • Similar, but not an exact dupe: stackoverflow.com/questions/1335812/… Commented Sep 15, 2011 at 15:18
  • I don't like where you have to check if the resource is null before closing it. i'd rather create the resource outside the try block and avoid all that. also exceptions thrown during close are pretty useless, just log them and go on. Commented Sep 15, 2011 at 15:23