我的需求是:
遍历所有表,如果找到“系统编号”并有dcnm列名的表,自动更新数据,但下面代码出错?
Dim dcnms() As String = {"咨询类型","项目名称","项目编号","业务性质","投标地区","工程类别","招标方式","归属部门","建设单位"}
For Each dtnm As DataTable In DataTables
If dtnm.Name <> e.DataTable.Name
For Each dc As DataCol In DataTables(dtnm.Name).DataCols
For Each dcnm As String In dcnms
If dc.Name.Contains(dcnm) Then
Select Case e.DataCol.Name
Case dc.Name '自动更新这些列的数据
Dim nmm As String = IIF(e.DataCol.Name = "系统编号",e.OldValue,dr("系统编号"))
Dim fdr As DataRow = DataTables(dtnm.Name).Find("系统编号 = '" & nmm & "'") '以单行的形式,查找符合条件的行,如果找到的话,返回找到的行
''Dim fdr As DataRow = DataTables(dtnm.Name).Find("系统编号 = '" & dr("系统编号") & "'") '以单行的形式,查找符合条件的行,如果找到的话,返回找到的行
If fdr IsNot Nothing Then
fdr(e.DataCol.Name) = e.NewValue
End If
End Select
End If
Next
Next
End If
Next