for each dc1 As datacol in datatables("Zstb").datacols for each dc As datacol in datatables("Zszy").datacols if dc1.name = dc.name then 'Exit For 这个不要了,否则遍历完之前一旦有相同的列,就停止执行了~ elseif dc1.name <> dc.name then Dim Len As Integer = DataTables("Zszy").DataCols(dc.name).MaxLength DataTables("Zstb").DataCols.Add(dc.name, GetType(string),len) end if next next 或者这样: for each dc1 As datacol in datatables("Zstb").datacols for each dc As datacol in datatables("Zszy").datacols iif dc1.name <> dc.name then Dim Len As Integer = DataTables("Zszy").DataCols(dc.name).MaxLength DataTables("Zstb").DataCols.Add(dc.name, GetType(string),len) else return end if next next |