DataBinding Question

J

Jake

Hi,

Right now in my app I am using databinding for some of my combo boxes. I
only uses databinding to display the data to the user. Here is my question.
Since, databinding keeps the dataset in memory is it better just to loop
through the dataset table and add each item? Or should I create an array
list from a datareader object to display the data? I would use the
datareader object however I would have to pass the datareader from the
database to the business component then to the UI. Any suggestions?

Thanks
 
R

Robert Morris

Suggestion: create a custom object which inherits from
CollectionBase and add each item in the datareader to the
object as a collection.

Suggestion: populate or return a Hastable of values from
the datareader, you can bind the Hashtable straight to the
combo box using it's datavaluefield and datatextfield
properties.

Suggestion: Use a DataView or DataTable and pass it back,
it has less overhead.

I have a few more if you don't like those. These are just
off the top of my head!

- Rob
 
J

Jake

Thanks for the reply. By passing the dataset and looping through the table
have that much overhead? Your suggestion passing the datatable object
probably be the best option.

Thanks again
 

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

Top