0

我有以下 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”

4

1 回答 1

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领域。

于 2013-09-12T08:16:56.387 回答