Select
Case
e.DataCol.name
Case
"产品编号"
Dim
dr
As
DataRow = DataTables("库存").Find("产品编号 = '"
&
e.OldValue
&
"'")
If
dr
Is
Nothing
Then
dr = DataTables("库存").AddNew()
dr("产品编号") = e.DataRow("产品编号")
dr("产品名称") = e.DataRow("产品名称")
dr("产品规格") = e.DataRow("产品规格")
Else
dr("产品编号") = e.DataRow("产品编号")
End
If
Case
"产品名称","产品规格"
Dim
dr
As
DataRow = DataTables("库存").Find("产品编号 = '"
&
e.DataRow("产品编号") &
"'")
If
dr
IsNot
Nothing
Then
dr(e.DataCol.Name) = e.DataRow(e.DataCol.Name)
End
If
End
Select
2、将产品表的DataRowDeleting事件代码设置为:
Dim
dr
As
DataRow = DataTables("库存").Find("产品编号 = '"
&
e.DataRow("产品编号") &
"'")
If
dr
IsNot
Nothing
Then
dr.Delete()
End
If