We can reopen it later if we close a database connection. But if we Dispose a database connection we cannot use it anymore.We must create a new database object.
We must invoke Dispose method or Using statement whenever we have to free external resources. Else we may encounter the below error
An exception of type 'System.InvalidOperationException' occurred in System.Data.dll but was not handled in user code Additional information: 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.
Asked In: Many Interviews |