Populate List from selected and sorted DataSet

  • Thread starter Thread starter James McGivney
  • Start date Start date
J

James McGivney

In a C# program I have an SQL database.
A data adapter is connected to the database and a dataset
has been generated.
I would like to populate a listBox (or comboBox) from the
dataset such that the user can select a record to be
edited.
I would like to have the user be able to select the
information to populate the listBox from a number of
sorted database fields. ie: sorted ID#, sorted age,
sorted LastName, sorted years of service, etc.
This must be a common task in C#.
Any sample code or KB articles or other resources would
be appreciated.
Thanks in advance for your help.
Jim
 
Hi James,

Thanks for posting in this group.
Based on my understanding, you want to bind one database column with the
combobox, while the binding column is determine at runtime,(May be select
the column name from another combobox). I think you can capture the select
column name event, in it, you can bind your wanted column with the combobox.
The article below tell you how to do data binding with listbox and combobox:
http://www.akadia.com/services/dotnet_databinding.html#Example: Binding
to%20a%20ComboBox%20or%20ListBox

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top