SQL CPU High - SqlConnection not being closed - Related?

You should always dispose the command object when your done with it. That way the connection pooling can be used better.

You should always dispose the command object when your done with it. That way the connection pooling can be used better. Easist is to use the using statment.

Using ( var sqlCommand = new SqlCommand( "storedprocname", new SqlConnection("connectionstring")) { CommandType = CommandType. StoredProcedure }) { // do what you should.. setting params executing etc etc. }.

I believe this code is creating a connection, but not disposing it. I.e. Create the SqlConnection first and wrap it in a 'using'.

– Phil Haselden Jun 25 at 6:45.

Yes, dispose them. Otherwise ignore them for now. Possibly the pool is as large because the statements are slow.

I would more suggest: Fixing the statements. Check the applicaion that it only uses one connection PER REQUEST (i.e. Not open multiple at the same time).

If the problem does not get better after optiomizing SQL - you can revisit the pool.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions