dataset question, might be obvious

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

Guest

Two parter:

1.) Which is better to fill a listbox or dropdownlist, a dataset or
datareader? Both use a connection, but dataset uses memory. And if you're
only fill a dropdownlist or listbox does it matter? Maybe if you need the
same data for another control?

2.) If the dataset (datatable) uses memory, then when do you set to nothing?
I know the connection close automatically, but what about the memory useage?

thanx.
 
Hi chris:

1) DataSets can be cached, while data readers cannot be cached - that
might be one reason to prefer a DataSet over a reader.

2) You don't need to manage the memory at all. The garbage collector
will reclaim the memory when the runtime needs more space. Setting a
variable to Nothing will *rarely*, if ever, have a beneficial impact.
Just let the system manage memory, but make sure to clean up the
connections and data readers with a Close.
 
Back
Top