Q:

"Timeout Obtaining a Connection from the Pool"

Can any one help to get rid of this error
"Time Out expired.The time out elapsed prior to obtaining a connection from the pool .This have occurred because all pooled connections were in  use and max pool size was reached"
Thank You

A:

Make sure you're implementing using blocks for every object that you create that implements IDisposable:
using (var connection = new SqlConnection(connectionString)) {
    using (var command = new SqlCommand(query, connection)) {
        using (var reader = command.ExecuteReader()) {
            while (reader.Read()) {
                // do something with row
            }
        }
    }
}

Otherwise, you will leak resources (including connections) when an exception occurs.
BTW, in VB, that's
Using connection As SqlConnection = New SqlConnection(connectionString))
...
End Using

