dataset question, might be obvious

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.
 
S

Scott Allen

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top