Sql Connection Leak

I wrote a quick and dirty iterative test app to look for resource leaks and seemed to have stumbled onto one (the code is below). Each iteration is adding a connection to my SQL Server session. Once you reach about 32767 iterations, SQL forces the session
closed, which causes an exception in the program. I think this is related to the exception that gets thrown (usually) when MultipleActiveResults is set to false in the connection string, where the CLR tries to re-use a SqlCommand object that believes it still
has an open DBReader attached. I'll try and stitch in the try/finally block cyril mentions and also try disposing the DBCommand object.

I am using .NET 3.5 sp1 and SQL Server 2008 on my x64 notebook, BTW. I'm also running Windows 7 beta -- I'll try and eliminate that as a possible factor and report back if there's news.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

This e-mail is for the use of the intended recipient(s) only. If you have received this e-mail in error, please notify the sender immediately and then delete it. If you are not the intended recipient, you
must not use, disclose or distribute this e-mail without the author's prior permission. We have taken precautions to minimize the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this message.
We cannot accept liability for any loss or damage caused by software viruses. Any views and/or opinions expressed in this e-mail are of the author only and do not represent the views of Epicor Software Corporation or any other company within its group.