Foxtable(狐表)用户栏目专家坐堂 → [求助]datacolchange多列连续发生变化


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

主题:[求助]datacolchange多列连续发生变化

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


加好友 发短信
等级:五尾狐 帖子:1165 积分:8129 威望:0 精华:0 注册:2015/3/30 10:44:00
[求助]datacolchange多列连续发生变化  发帖心情 Post By:2015/9/19 20:49:00 [只看该作者]

我想问一下,是不是A列值发生变化,B列自动从某个表取出某个值。那就是说B列也发生了变化,那么C列值也应该可以从另外一个表取出某个值吧。
代码如下:可是没有实现,是怎么回事。
发生变化的列是怀疑模块,那么模块维护人邮箱从模块名称库取出值。
发生变化的列是模块维护人邮箱,希望研发分机号从技术支持信息表取出手机号码的值。
datacolchange代码:
If e.DataCol.Name = "怀疑模块" Then
    Dim nms() As String = {"模块维护人","模块维护人邮箱","研发组长","研发组长邮箱","研发组名","研发部门"}
    If e.NewValue Is Nothing Then
        For Each nm As String In nms
            e.DataRow(nm) = Nothing
        Next
    Else
        Dim dr As DataRow
        dr = DataTables("模块名称库").Find("[模块名称] = '" & e.NewValue & "'")
        If dr IsNot Nothing
            For Each nm As String In nms
                e.DataRow(nm) = dr(nm)
            Next
        End If
    End If
End If
If e.DataCol.Name = "模块维护人邮箱" Then
    If e.NewValue Is Nothing Then
        e.DataRow("研发分机号") = Nothing
    Else
        Dim dr As DataRow
        dr = DataTables("技术支持信息表").Find("[name] = '" & e.NewValue & "'")
        If dr IsNot Nothing
            e.DataRow("研发分机号") = dr("手机号码")
        End If
    End If
End If

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/9/20 12:46:00 [只看该作者]

            For Each nm As String In nms
                e.DataRow(nm) = dr(nm)
            Next
 
改成
 
SystemReady = False
            For Each nm As String In nms
                e.DataRow(nm) = dr(nm)
            Next
SystemReady = True

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


加好友 发短信
等级:五尾狐 帖子:1165 积分:8129 威望:0 精华:0 注册:2015/3/30 10:44:00
  发帖心情 Post By:2015/9/21 10:19:00 [只看该作者]

改为这样还是不显示研发分机号。请问哪里不对?
If e.DataCol.Name = "怀疑模块" Then
    Dim nms() As String = {"模块维护人","模块维护人邮箱","研发组长","研发组长邮箱","研发组名","研发部门"}
    If e.NewValue Is Nothing Then
        For Each nm As String In nms
            e.DataRow(nm) = Nothing
        Next
    Else
        Dim dr As DataRow
        dr = DataTables("模块名称库").Find("[模块名称] = '" & e.NewValue & "'")
        If dr IsNot Nothing
            Systemready = False
            For Each nm As String In nms
                e.DataRow(nm) = dr(nm)
            Next
            Systemready = True
        End If
    End If
End If

If e.DataCol.Name = "模块维护人邮箱" Then
    If e.NewValue Is Nothing Then
        e.DataRow("研发分机号") = Nothing
    Else
        Dim dr As DataRow
        dr = DataTables("技术支持信息表").Find("[name] = '" & e.NewValue & "'")
        If dr IsNot Nothing
            Systemready = False
            e.DataRow("研发分机号") = dr("手机号码")
            Systemready = True
        End If
    End If
End If

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/9/21 10:21:00 [只看该作者]

你修改 模块维护人邮箱 列,才会去查手机号码赋值。如果不赋值,你加入msgbox,看是否查找到数据。

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


加好友 发短信
等级:五尾狐 帖子:1165 积分:8129 威望:0 精华:0 注册:2015/3/30 10:44:00
  发帖心情 Post By:2015/9/21 11:10:00 [只看该作者]

之前模块维护人邮箱列值为空,现在怀疑模块有值,同时模块维护人邮箱也有值了。也就说说模块维护人邮箱的值变动了,那么应该在技术支持信息表,取出对应的手机号码。可实际上红色代码没执行。
If e.DataCol.Name = "怀疑模块" Then
    Dim nms() As String = {"模块维护人","模块维护人邮箱","研发组长","研发组长邮箱","研发组名","研发部门"}
    If e.NewValue Is Nothing Then
        For Each nm As String In nms
            e.DataRow(nm) = Nothing
        Next
    Else
        Dim dr As DataRow
        dr = DataTables("模块名称库").Find("[模块名称] = '" & e.NewValue & "'")
        If dr IsNot Nothing
            Systemready = False
            For Each nm As String In nms
                e.DataRow(nm) = dr(nm)
            Next
            Systemready = True
            msgbox(e.DataRow("模块维护人邮箱"))
        End If
    End If
End If

If e.DataCol.Name = "模块维护人邮箱" Then
    If e.NewValue Is Nothing Then
        e.DataRow("研发分机号") = Nothing
    Else
        Dim dr As DataRow
        dr = DataTables("技术支持信息表").Find("[name] = '" & e.NewValue & "'")
        If dr IsNot Nothing
            msgbox(1)
            Systemready = False
            e.DataRow("研发分机号") = dr("手机号码")
            Systemready = True
            msgbox(e.DataRow("研发分机号"))
        End If
    End If
End If

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/9/21 11:12:00 [只看该作者]

加入msgbox看弹出什么。是不是你的条件不对,查不到值啊

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


加好友 发短信
等级:五尾狐 帖子:1165 积分:8129 威望:0 精华:0 注册:2015/3/30 10:44:00
  发帖心情 Post By:2015/9/21 16:05:00 [只看该作者]

因为是分页加载,find改为了SQLFind,可以了。多谢。这个错误之前我也同样犯过。
dr = DataTables("技术支持信息表").SQLFind("[Name] = '" & e.NewValue & "'")

 回到顶部