改成
Dim dr As Row = Tables("窗口1_Table2").Current
If dr IsNot Nothing Then
If MessageBox.Show("确定要删除该数据吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
Dim dr1 As DataRow = DataTables("产品另存表").Find("自动编号='" & dr("自动编号") & "'") '判断一下是不是需要排除重复,如果不需要就将代码去除'
If dr1 Is Nothing Then
dr1= DataTables("产品另存表").addnew
For Each cl As Col In Tables("窗口1_Table2").cols
dr1(cl.Name) = dr(cl.name)
Next
dr1.save
End If
dr.delete
End If
End If