1、根据一个表的“标准名称”列的值中招标编号对应的“内容”去查找另一个表中是否存在这个招标编号,如没有,则增加一行
2、一个表的“标准名称”列的值与另一个表的表列名相同,则把内容复制过去下面代码如何调整,谢谢
For Each dc As DataCol In DataTables("招标信息1").DataCols
For Each r As Row In Tables("招标信息预录").Rows
Dim fdr As DataRow = DataTables("招标信息1").Find("招标编号 = '" & & "'")
If fdr Is Nothing Then
Dim ndr As DataRow = DataTables("招标信息1").AddNew()
If r("标准名称") = dc.Name
ndr(dc.Name) = r("内容")
End If
End If
Next
Next

此主题相关图片如下:166.jpg


此主题相关图片如下:1699408919799.jpg

[此贴子已经被作者于2023/11/8 10:09:25编辑过]
判断列名是否存在和这个代码没有任何关系,完全不需要
蓝老师:
我要先判断这个招标编号对就的“内容”数据在“招标信息1”表中是否存在?
For Each r As Row In Tables("招标信息预录").Rows
if DataTables("招标信息1").DataCols.contains(r("标准名称"))
Dim fdr As DataRow = DataTables("招标信息1").Find(r("标准名称") & " = '" & r("内容") & "'")
If fdr Is Nothing Then
Dim ndr As DataRow = DataTables("招标信息1").AddNew()
ndr(r("标准名称") ) = r("内容")
End If
End If
Next
老师不对的,我的需求是根据"招标编号"这个“A3301010060520085001221”唯一值判断,还有按上面代码出现增加多项,我只要一行Dim fdr As DataRow = DataTables("招标信息1").Find(r("标准名称") & " = '" & r("内容") & "'")
这个是多值判断了
此主题相关图片如下:1699413538271.jpg

[此贴子已经被作者于2023/11/8 11:18:26编辑过]
dim dr as datarow = data
Tables("招标信息预录").find("标准名称='招标编号'")if dr isnot nothing then
Dim fdr As DataRow = DataTables("招标信息1").Find("
招标编号 = '" & d
r("内容") & "'")
If fdr Is Nothing Then
Dim ndr As DataRow = DataTables("招标信息1").AddNew()
For Each r As Row In Tables("招标信息预录").Rows
if DataTables("招标信息1").DataCols.contains(r("标准名称"))
ndr(r("标准名称") ) = r("内容")
end if
next
End If
end if