new to ADO.NET and datagrids

  • Thread starter Thread starter Mike P
  • Start date Start date
M

Mike P

I have an SQLConnection to a table, with a SQLCommand that is using a
data reader to read distinct values from a field called location into a
combo box.

I want to know how to populate a data grid with data from the table
based upon the location selected in the combo box.

Can anybody tell me how I would go about this? I'm a bit unsure over
whether to use a dataset or a command, and whether I need a separate
data adapter for each dataset.


Any help would be really appreciated.


Cheers,

Mike
 
Hi,

what you describe, is a pretty straight forward to achive with databinding
to a dataview.
Once you create the DataView, set it as a Datasource of the grid, and then
on selectedItemChanged event, change the filter of the dataview. This way
you'll show the new records to teh user.

Check out the following article on MSDN - a new reading with some great
examples on databinding with windows forms:
http://msdn.microsoft.com/library/d...dnwinforms/html/databinding_winforms10_11.asp

Cheers,
Branimir
 
Back
Top