J
Jim Hughes
I've been following the "Re: DataReader is connected?" thread with interest.
A thought occurred to me... And I would like to hear what others think about
it.
Best practice: Open connections as late as you can, close them as soon as
you can
But rarely do you hear " and keep them open as short a time as possible "
Based on that, it would seem that retrieving data into a dataset would be a
simple, "known" method of retrieving the data in a single full stream.
(Admittedly at the expense of memory at the client)
On the contrary, using a datareader means that the data is read one row at a
time and "processing", perhaps more than simple retrieval, is performed for
each row. It would appear to me that this potentially would keep the
connection to the database open longer!
The benefit of using less memory on the client would then be outweighed by
keeping the connection to the server open longer!
My initial reaction is: "It depends on the circumstances"
Thoughts?
A thought occurred to me... And I would like to hear what others think about
it.
Best practice: Open connections as late as you can, close them as soon as
you can
But rarely do you hear " and keep them open as short a time as possible "
Based on that, it would seem that retrieving data into a dataset would be a
simple, "known" method of retrieving the data in a single full stream.
(Admittedly at the expense of memory at the client)
On the contrary, using a datareader means that the data is read one row at a
time and "processing", perhaps more than simple retrieval, is performed for
each row. It would appear to me that this potentially would keep the
connection to the database open longer!
The benefit of using less memory on the client would then be outweighed by
keeping the connection to the server open longer!
My initial reaction is: "It depends on the circumstances"
Thoughts?