我有一个组合框,我想从 sql server 数据库中填充两列。我的代码是:
Dim cmd As New SqlCommand("Select hospno,hospno + '--- ' + name as pn from Patient order by hospno", cnn)
Dim da As New SqlDataAdapter(cmd)
Dim dt As New DataTable()
da.Fill(dt)
If dt.Rows.Count > 0 Then
cbohospno.ValueMember = "hospno"
cbohospno.DisplayMember = "pn"
cbohospno.DataSource = dt
Else
MessageBox.Show("Empty")
End If
运行时,显示的是组合框name
而不是hospno
. 如何hospno
在组合框中显示?