By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,041 Members | 958 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,041 IT Pros & Developers. It's quick & easy.

sqlconnection pooling

P: n/a
Hi,

I have a program that goes against SQL Server.

I have opened a connection and closed all the connections with .close() and
..dispose() but after I read in 32 records, it says it maxed out on the
connections.

Is there something I'm doing wrong?
Should I pass in the connection as a reference instead of opening and
closing the connection within the procedure?

here is a sample code.

Dim SIMSSQLCommand As New SqlCommand

Dim conn As New SqlConnection

Dim connection As New SqlConnection

Dim spreader As SqlDataReader

Dim getparamsp As New SqlCommand

DO SOMETHING HERE
'clean up the memory

If Not (connection Is Nothing) Then

connection.Close()

connection.Dispose()

End If

If Not (conn Is Nothing) Then

conn.Close()

conn.Dispose()

End If

If Not (spreader Is Nothing) Then spreader.Close()

If Not (SIMSSQLCommand Is Nothing) Then SIMSSQLCommand.Dispose()

If Not (getparamsp Is Nothing) Then getparamsp.Dispose()

thanks,

Will
Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.