以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 不包含列名代码出错 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=121294) |
-- 作者:ZJZK2018 -- 发布时间:2018/7/3 14:42:00 -- 不包含列名代码出错 老师你好: 我不想把这{"项目状态","审核","资料类别"}三列的数据复制到“开标记录”表中,下面红色代码如何调整?谢谢! Case "招标审核" Dim fdr As DataRow = DataTables("开标记录").Find(filt) Dim nms() As String = {"项目状态","审核","资料类别"} If fdr Is Nothing AndAlso e.NewValue = "仅标录" Then Dim ndr As Row = Tables("开标记录").AddNew() For Each dc As DataCol In DataTables("开标记录").DataCols For Each nm As String In nms If e.DataTable.DataCols.Contains(dc.Name) AndAlso dc.Name.Contains(nm) = False Then ndr(dc.Name) = dr(dc.Name) End If Next Next Else If fdr IsNot Nothing Then fdr.Delete() Return End If End If |
-- 作者:有点甜 -- 发布时间:2018/7/3 15:11:00 -- Case "招标审核" Dim fdr As DataRow = DataTables("开标记录").Find(filt) Dim nms() As String = {"项目状态","审核","资料类别"} If fdr Is Nothing AndAlso e.NewValue = "仅标录" Then Dim ndr As Row = Tables("开标记录").AddNew() For Each nm As String In nms If e.DataTable.DataCols.Contains(nm) Then ndr(nm) = dr(nm) End If Next Else If fdr IsNot Nothing Then fdr.Delete() Return End If End If |
-- 作者:ZJZK2018 -- 发布时间:2018/7/3 15:20:00 -- 有点甜老师: 你可能理解相反了,我需要的是 1、历遍二个表中有相同列名 2、在相同列名中除去{"项目状态","审核","资料类别"}这三列的列名
|
-- 作者:有点甜 -- 发布时间:2018/7/3 15:46:00 -- Case "招标审核" Dim fdr As DataRow = DataTables("开标记录").Find(filt) Dim nms() As String = {"项目状态","审核","资料类别"} If fdr Is Nothing AndAlso e.NewValue = "仅标录" Then Dim ndr As Row = Tables("开标记录").AddNew() For Each dc As DataCol In DataTables("开标记录").DataCols For Each nm As String In nms If e.DataTable.DataCols.Contains(dc.Name) AndAlso array.indexof(nms, dc.name) < 0 Then ndr(dc.Name) = dr(dc.Name) End If Next Next Else If fdr IsNot Nothing Then fdr.Delete() Return End If End If |
-- 作者:ZJZK2018 -- 发布时间:2018/7/3 16:04:00 -- 有点甜老师: 下面这段代码看不懂,
array.indexof(nms, dc.name) < 0 中Array 是什么意思?? |
-- 作者:有点蓝 -- 发布时间:2018/7/3 20:20:00 -- 万能的网络:https://www.baidu.com/baidu?word=vb%20array.indexof |