Connection/Memory Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, I am hoping this is a simple question....
If I am processing a file and re-using the same connection object be
creating new Command objectes for each of the records on the file, do I need
to run the command.Dispose() method when I am done with each command? My
memory usage continues to grow and grow and I am trying to figure out why it
continues to grow and grow until it finally fails with an out of memory
condition.

Can I reuse the same command object for inserting multiple records into the
database - If I can, maybe this would help with my memory problem.

Thanks in advance for your assistance!!!
 
You don't need to call Dispose (though some will argue that you should
always call Dispose anything that has this method). It won't hurt to call
it, but calling it isn't going to gain you anything.

You can reuse command objects, but not reusing them shouldn't cause memory
problems.

I would guess your memory problem stems from something else.
 
Marina,
You don't need to call Dispose (though some will argue that you should
always call Dispose anything that has this method). It won't hurt to call
it,

Every instruction needs some time to process no matter how less it is.

Just my idea

:-) (I know we share that idea)

Cor
 
Jim,

Why would you use the same connection object all the time. In my idea are
you trying to do something without any sense. OOP is based on creating
objects everytime new and use them when needed. When done well than the
mechanism of Net will delete them properly.

Just my thought,

Cor
 
Back
Top