Dim t1 As String = e.Form.Controls("编号").VALUE Dim t2 As String = e.Form.Controls("名称").VALUE Dim t3 As String = e.Form.Controls("类别").VALUE Dim t4 As String = e.Form.Controls("标准").VALUE Dim t5 As String = e.Form.Controls("型号").VALUE Dim t6 As String = e.Form.Controls("单位").VALUE Dim t7 As Single = e.Form.Controls("单价").VALUE Dim bh1 As String Dim bh2 As String Dim bh3 As String Dim bh4 As String Dim dr As DataRow If DataTables("材料信息表").DataRows.Count = 0 Then Tables("材料信息表").AddNew Else If t2 = "" Or t3 = "" Or t4 = "" Or t5 = "" Or t6 = "" Then MessageBox.show("请输入完整的材料信息","提示") Return Else '定位第1组编号 With DataTables("材料名称管理") dr = .Find("分组名称= '" & t2 & "'") If dr IsNot Nothing Then '如果找到的话 bh1 = dr("分组编号") End If End With '定位第2组编号 With DataTables("材料名称管理") dr = .Find("分组名称= '" & t3 & "'") If dr IsNot Nothing Then '如果找到的话 bh2 = dr("分组编号") End If End With '定位第3组编号 With DataTables("材料应用标准管理") dr = .Find("分组名称= '" & t4 & "'") If dr IsNot Nothing Then '如果找到的话 bh3 = dr("分组编号") End If End With '定位第4组编号 With DataTables("材料规格型号管理") dr = .Find("分组名称= '" & t5 & "'") If dr IsNot Nothing Then '如果找到的话 bh4 = dr("分组编号") End If End With t1 = bh1 & bh2 & bh3 & bh4 Dim r As Row = Tables("材料信息表").AddNew r("xxx") = t1 End If End If
|