Foxtable(狐表)用户栏目专家坐堂 → [求助] 修改代码


  共有3999人关注过本帖树形打印复制链接

主题:[求助] 修改代码

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2013/11/24 20:09:00 [显示全部帖子]

 自己改一下。

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

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2013/11/25 19:57:00 [显示全部帖子]

 试试这样

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

 回到顶部