0

如何从填充的数据集中提取单列数据?

我有一个填充的数据集对象,有各种表格。我需要获取存储在其中一个表的特定列中的所有数据,并将 ComboBox ItemSource 绑定到它。(这可能需要我将数据提取出来并将其制成一个字符串集合......)

如果有人有任何好的想法,将非常感激!

4

1 回答 1

2

I assume this is ASP.Net....slightly different for windows forms... Set the comobobox datasource to the specific table in the dataset and then set the datavalue/datatext fields to the string name of the columns that you want for the value/display text.

ComboBox1.DataSource = myDataTable.tables(0)
ComboBox1.DisplayMember = "Field Name" 'the field you want to show in combo box.
于 2009-07-21T15:00:02.537 回答