Dim cmc As WinForm.CheckedComboBox
Dim c As String
Dim d As String
c= e.Form.Controls("ComboBox1").text
cmc = e.Form.Controls("CheckedComboBox1")
cmc.ComboList = DataTables("用户分组").SQLGetComboListString("分组")
Dim i As Integer = 0
For Index As Integer = 0 To cmc.Items.Count - 1
Dim dr As DataRow = DataTables("用户分组").Find("分组 = '" & cmc.Items(Index) & "' And 用户 = '" & c & "'")
If dr IsNot Nothing Then
i = i+1
If i = 1 Then
d= dr("分组")
Else
d= d & "," & dr("分组")
End If
End If
Next
e.Form.Controls("CheckedComboBox1").text = d
以上代码中 sql不能查询到数据,但是用find就能查到,(数据已经保存到后台数据库中)