我有以下SP:
ALTER procedure [dbo].[selectService]
as
begin
select cl_mt,cl_cl_id,cl_description from REF_CLIENT_TABLE
end
我用它来填充我的组合框:
With service_combo
.DataSource = serviceTable
.DisplayMember = "cl_description"
.ValueMember = "cl_mt"
.SelectedIndex = 0
.SelectedValue = serviceTable.Rows("cl_mt")
End With
有没有办法能够选择2个值?因为我需要选择“cl_mt”和“cl_id”
答案 0 :(得分:0)
您可以通过将基于表达式的列添加到原始表来执行此操作:
serviceTable.Columns.Add(New DataColumn("binding", GetType(String),
"cl_mt + '|' + cl_id"))
With service_combo
.DataSource = serviceTable
.DisplayMember = "cl_description"
.ValueMember = "binding"
...
End With
当您现在查询service_combo.SelectedValue
时,您将获得以1|2
形式返回的值;这将是您的cl_mt
字段,后跟您的cl_id
字段。