How to find identical and nonidentical rows from datatable based on primary key column.

Posted by Oswaldlily under ASP.NET on 4/29/2016 | Points: 10 | Views : 232 | Status : [Member] | Replies : 1
How to find identical and nonidentical rows from datatable based on primary key column.

I don't want to mention column name directly for primary key because primary column differs for every table. (I want to make it global to accept any number of primary keys)

Tried : I used dt1.AsEnumerable().except(dt2.AsEnumerable()) which is checking lastupdated column(timestamp). So "except" not working as I expect




Responses

Posted by: Bhuvanesh6 on: 7/26/2016 [Member] Starter | Points: 25

Up
0
Down
Have you tried assigning the value of datatable to the Collection (List) where you can query and fetch data you required using LINQ operation which is also much faster and assign back to dataTable or the controls.

Let me know, if this logic works or give your exact scenario, will get you more details.

Bhuvan

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response