If e.DataCol.Name ="增加" Then
Dim dr,dr1 As DataRow
dr = e.DataRow
If dr.isnull("计划号") Then
MessageBox.Show("计划号不能为空!")
Else
Dim s As String = "计划号 = '" & dr("计划号") & "'and 材质 = '" & dr("材质") & "'"
dr1= DataTables("合同总览").find(s)
If dr1 IsNot Nothing Then
Dim val As Integer = dr("重量")
If dr("增加") = False Then
val = -val
End If
dr1("重量")+ = val
dr1.Save()
Else
Dim Ls As String() = {"计划号","合同公司","订单号","材质","重量"}
dr1 = DataTables("合同总览").AddNew()
For Each s In Ls
dr1(s) = dr(s)
Next
dr1("重量") = dr("重量")
dr1.Save()
End If
dr.Save()
If dr("增加") = True Then
s = "计划号 = '" & dr("计划号") & "'and 材质 = '" & dr("材质") & "' and 砖号 = '" & dr("砖号") & "'"
dr1= DataTables("完成情况").find(s)
If dr1 Is Nothing Then
dr1 = DataTables("完成情况").Addnew
End If
Dim nms() As String = {"计划号","合同公司","订单号","材质","砖号"}
For Each nm As String In nms
dr1(nm) = dr(nm)
Next
End If
End If
End If
狐狸爸爸这个用红色标记下来的代码是在原料的代码中又添加的一个表,如果我在想添加一个和红色代码一样的表,如何添加去,我试了半天还是不行,我手法不行,还请狐狸爸爸看一下。