Dim cmd,cmd1 As New SQLCommand
Dim dt As DataTable
Dim lst As WinForm.ListBox = Forms("内部通讯").Controls("ListBox1")
lst.ComboList = ""
cmd.C
cmd.CommandText = "SELECT DISTINCT Name, 是否在线 From {Users}"
dt = cmd.ExecuteReader()
For Each dr As DataRow In dt.Datarows
cmd1.C
cmd1.CommandText = "Select * From {内部通讯} Where [发送者] = \'" & dr("Name") & "\' And [接收者] = \'" & _UserName & "\' And [接收时间] Is NULL"
Dim dt1 As DataTable
dt1 = cmd1.ExecuteReader
If dr("Name") <> _UserName And dr("Name") <> "待机模式" And dr("Name") <> "管理员" Then \' 不加载登录用户列表
lst.Items.Add("(" & dr("是否在线") & ")" & dr("Name") & "(" & dt1.DataRows.Count & ")")
End If
Next
If Lst.Items.Count > 0 Then
lst.SelectedIndex = 0
End If