-- 作者:cd_tdh
-- 发布时间:2017/7/27 9:20:00
-- [求助]保存后出现错误,重新打开后行又出来了
如题,保存后行被删除了,重新打开项目重新删除的行又出来了。
错误提示如下:
此主题相关图片如下:2.jpg
DataColChanged代码如下:
\'选择项目名称自动加载项目编码及所属机构数据 If e.DataCol.Name = "项目名称" Then \'如果内容发生变动的是品名列 If e.NewValue Is Nothing Then
e.DataRow("项目编码") = Nothing e.DataRow("所属机构") = Nothing e.DataRow("建设单位") = Nothing e.DataRow("合同金额") = Nothing e.DataRow("合同工期") = Nothing e.DataRow("开工日期") = Nothing e.DataRow("竣工日期") = Nothing Else Dim dr As DataRow \'否则在产品表查找同名的产品行,将找到的行赋值给变量dr dr = DataTables("合同签订").Find("[项目名称] = \'" & e.NewValue & "\'") If dr IsNot Nothing Then \'如果找到了同名的产品行,也就是dr不是Nothing e.DataRow("项目编码") = dr("项目编码") e.DataRow("所属机构") = dr("所属机构") e.DataRow("建设单位") = dr("建设单位") e.DataRow("合同金额") = dr("合同金额") e.DataRow("合同工期") = dr("合同工期") e.DataRow("开工日期") = dr("合同工期_开工日期") e.DataRow("竣工日期") = dr("合同工期_竣工日期") End If End If End If
\'选择户名自动加载账号及开户行 If e.DataCol.Name = "户名" Then \'如果内容发生变动的是品名列 If e.NewValue Is Nothing Then \'如果新值是空白,也就是品名列的内容为空 e.DataRow("户名") = Nothing \'那么清空此行单价列的内容 e.DataRow("账号") = Nothing \'那么清空此行单价列的内容 e.DataRow("开户银行") = Nothing \'那么清空此行单价列的内容 Else Dim dr As DataRow \'否则在产品表查找同名的产品行,将找到的行赋值给变量dr dr = DataTables("分公司管理").Find("[户名] = \'" & e.NewValue & "\'") If dr IsNot Nothing Then \'如果找到了同名的产品行,也就是dr不是Nothing e.DataRow("户名") = dr("户名") e.DataRow("账号") = dr("账号") e.DataRow("开户银行") = dr("开户银行") \'那么清空此行单价列的内容 End If End If End If
\'计算竣工日期 Select Case e.DataCol.Name Case "开工日期","合同工期" If e.DataRow.IsNull("开工日期") Then e.DataRow("竣工日期") = Nothing Else e.DataRow("竣工日期") = e.DataRow("开工日期").AddDays(e.DataRow("合同工期")) e.DataRow.load End If End Select
\'勾选引用至-工程款管理 If e.DataCol.Name = "审批状态" If e.DataRow("审批状态") <> Nothing Then Dim nma() As String = {"_Identify","序号","项目编码","所属机构","项目名称","建设单位","合同工期","合同金额","计量期数","申请金额","是否是退扣款","户名","账号","开户银行","审批状态"} \'A表数据来源列 Dim nmb() As String = {"临时列", "序号","项目编码","所属机构","项目名称","建设单位","合同工期","合同金额","计量期数","申请金额","是否是退扣款","户名","账号","开户银行","审批状态"} \'B表数据接收列 e.DataRow.save Dim Filter As String = "临时列 = \'" & e.DataRow("_Identify") & "\'" Dim dr As DataRow = DataTables("工程款管理").find(filter) If dr Is Nothing Then dr = DataTables("工程款管理").AddNew For i As Integer = 0 To nma.Length - 1 dr(nmb(i)) = e.DataRow(nma(i)) Next Else systemready = False DataTables("工程款管理").deletefor("临时列 = \'" & e.DataRow("_Identify") & "\'") systemready = True End If End If \'跨表自动更新 Select Case e.DataCol.Name Case "序号","项目编码","所属机构","项目名称","建设单位","合同工期","开工日期","竣工日期","合同金额","计量期数","申请金额","户名","账号","开户银行","审批状态" Dim Filter As String = "临时列 = \'" & e.DataRow("_Identify") & "\'" Dim drs As List(Of DataRow) = DataTables("工程款管理").Select(Filter) SystemReady = False For Each dr As DataRow In drs dr(e.DataCol.Name) = e.NewValue Next SystemReady = True End Select
|