在表格中点击审核按钮就会进行入库操作,但是现在插入一行后就会删除其余行,且插入多行数据会一模一样
以下是写在DataColsChanged代码:
'获取当前行信息
Dim r As Row = Tables("产品明细窗口_rkTable3").Current
Dim cid As String = r("产品id")
Dim tm As String = r("条码")
Dim Bomid As String = r("BOM编码")
Dim cxh As String = r("产品型号")
Dim sl As Integer = r("数量")
Dim dj As Integer = r("单价")
Dim jine As Integer = r("金额")
Dim cmd As New SQLCommand
cmd.C
'判断审核状态进行条码入库
If e.DataCol.Name = "审核" Then
If e.NewValue = True Then
cmd.CommandText = "Insert Into {入库单条码明细}(审核,产品id,条码,BOM编码,产品型号,数量,单价,金额) Values('" & e.NewValue & "','" & cid & "','" & tm & "','" & Bomid & "','" & cxh & "','" & sl & "','" & dj & "','" & jine & "')"
cmd.ExecuteNonQuery()
MessageBox.Show("产品条码入库成功")
End If
If e.NewValue = False Then
cmd.CommandText = "Delete Fro m {入库单条码明细} Where BOM编码 = '" & Bomid & "'"
cmd.ExecuteNonQuery()
MessageBox.Show("产品条码未入库")
End If
End If