I am developing a C# Windows platform application using VS2005.
The application creates multiple Excel files using a FOR LOOP.
After about 40 Excel files are created my C# application aborts with:
InvalidOperationException was unhandled.
Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool.
This may have occurred because all pooled connections were in use and max pool size was reached.
I inspected the Windows Task Bar and clicked on the Processes tab:
Under the column titled "Image Name", I see an EXCEL.EXE row for every Excel file the application created. Each of the EXCEL.EXE rows has a memory usage value of about 25,500K.
After 40 Excel files were created, the application aborted and I noticed in Task Manager that 40 rows were created with an Image Name of EXCEL.EXE.
How would I prevent creating a separate EXCEL.EXE for each file generated?
My code is attached in a text file.