Foxtable(狐表)用户栏目专家坐堂 → [求助]手动触发列,修改日期


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

主题:[求助]手动触发列,修改日期

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


加好友 发短信
等级:三尾狐 帖子:682 积分:5382 威望:0 精华:0 注册:2015/1/23 0:31:00
[求助]手动触发列,修改日期  发帖心情 Post By:2019/1/21 16:05:00 [只看该作者]

请问下,我在父表中增加代码,计算子表中的最早日期和最晚日期,重置列没有问题,但是在子表中增加代码后再新增行后会提示出错,提示没有引用到实例,是怎么回事儿
父表代码
Dim dt As DataTable =DataTables("无损_检测明细")
Dim F As String = "检验批编号 = '" & e.DataRow("检验批编号") & "'"
If e.DataCol.Name = "检验批" Then
    e.DataRow("检测日期_最早检测日期") = dt.SQLCompute("Min(首检_检测日期)",F)
    e.DataRow("检测日期_最后检测日期") = dt.SQLCompute("Max(首检_检测日期)",F)
End If


子表代码
If e.DataCol.name = "检验批" Then
    Dim pr As DataRow = e.DataRow.GetParentRow("无损_检验批") 
    If pr IsNot Nothing Then
        DataTables("无损_检验批").DataCols("检测日期_最早检测日期").RaiseDataColChanged(pr) 
        DataTables("无损_检验批").DataCols("检测日期_最后检测日期").RaiseDataColChanged(pr)
    End If
End If


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


加好友 发短信
等级:超级版主 帖子:106028 积分:539233 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/1/21 17:07:00 [只看该作者]

父表代码
If e.DataCol.Name = "检验批编号" Then
Dim dt As DataTable =DataTables("无损_检测明细")
Dim F As String = "检验批编号 = '" & e.DataRow("检验批编号") & "'"
    e.DataRow("检测日期_最早检测日期") = dt.SQLCompute("Min(首检_检测日期)",F)
    e.DataRow("检测日期_最后检测日期") = dt.SQLCompute("Max(首检_检测日期)",F)
End If

子表代码
If e.DataCol.name = "检验批编号" orelse e.DataCol.Name = "首检_检测日期Then
Dim F As String = "检验批编号 = '" & e.DataRow("检验批编号") & "'"
    Dim pr As DataRow = DataTables("无损_检验批").find(F) 
    If pr IsNot Nothing Then
        DataTables("无损_检验批").DataCols("检验批编号").RaiseDataColChanged(pr) 
    End If
End If
[此贴子已经被作者于2019/1/21 17:07:32编辑过]

 回到顶部