我有一个组合框,它应该显示我们从客户端获取的文件列表,供用户选择,可选择仅活动客户端或所有客户端。客户端文件列表是 SQL Server 数据库的一部分,我已将其作为数据源添加到我的项目中(使用 VS 2010)。它最初正确显示列表,但是当我选中单选按钮以仅显示活动组时,没有任何反应。我错过了什么?
Private Sub activegroups_radiobox_Checked(sender As System.Object, e As System.EventArgs) Handles activegroups_radiobox.Click
'use sql command to display all active company names, ordered by company, in the combobox
Using myconnection As New SqlConnection("connection string")
Dim activegroups As String = "SELECT File_Name FROM ClientFileDatabase WHERE ClientStatus != 'Terminated' ORDER BY File_Name;"
Dim activegroups_sqlcommand As New SqlCommand(activegroups, myconnection)
Dim activegroups_dataadapter As New SqlDataAdapter
activegroups_dataadapter.SelectCommand = activegroups_sqlcommand
Dim activegroups_dataset As DataSet = New DataSet()
activegroups_dataadapter.Fill(activegroups_dataset, "ClientFileDatabase")
Dim activegroups_dataview = New DataView(activegroups_dataset.Tables("ClientFileDatabase"))
client_selection_combobox.DataSource = activegroups_dataset
client_selection_combobox.DisplayMember = "File_Name"
End Using
End Sub
我试着用谷歌搜索,不认为我在这里遗漏了任何步骤,但显然有些不对劲。谢谢你的帮助!