데이터 테이블 비교하여 변동사항만 표기

안녕하세요

매일 내용이 업데이트 되는 데이터 테이블을 추출하여 변동사항만 나타나게 하고 싶은데
오늘 새롭게 추출한 데이터 테이블에 중복된 내용의 행이 있으면 제거하고 한 개 행만 표시를 합니다.
중복된 행이라도 이전 데이터 테이블에 없는 내용이라면 무조건 다 표시 하고 싶은데 다른 방법이 없을까요?

Hi @111302 ,

Please try this,

Input

(From dtRow In dt2.AsEnumerable
Where Not dt1.AsEnumerable.Any(Function(d) d("dt_A").ToString.Trim.Equals(dtRow("dt_B").ToString.Trim))
Select dtRow).CopyToDataTable

Output

image

Thanks

Hi @prasath_S
Thank you for your quick answer.

My explanation wasn’t enough, I wanted little different.
DT columns could be two or three and each column data is all different.
I wrote it down in numbers for convenience.
I want to compare with rows, not specific column data.
I think I just need to revise the expression you gave me. Can you help me more?

Except로는 원하는 방식으로 사용할 수 없는 것으로 보입니다.

dt2.AsEnumerable.Where(Function(x) Not dt1.AsEnumerable.Contains(x, DataRowComparer.Default)).CopyToDataTable

정말 감사합니다!!! 해당 식으로 바로 해결했습니다!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.