代码如下
Dim s As Row=Tables("入库单").Current If Tables("入库单").Current.IsNull("货号") Then MessageBox.Show("货号不能为空!") Else Dim dt1,dt2 As DataTable dt1 = DataTables("入库单") dt2 = DataTables("实时库存表")
For Each dr As DataRow In dt1.DataRows Dim dr2 As DataRow = dt2.find("货号 = '"& dr("货号") &"'") If dr2 Is Nothing Then dr2 = dt2.AddNew dr2("货号") = dr("货号") dr2("入库数量") = 1 dr2("单价") = dr("单价") Else dr2("入库数量") = dr2("入库数量") + 1 End If Next MessageBox.Show("商品入库成功!") Forms("入库单").Close End If
|