I am struggling to compare two datatables.
I have two datatables with thousands of rows. Theres a column “In Stock” in both of them which contains the values (eg. 2,4,10,etc.). I want to compare these two columns if they have the exact same values or not. Please help with the LINQ.
we can join data for checking it or some other modified approaches.
Referring to Column Number “In Stock” we would assume that you will check it for particular items identified an Identity (e.g. Look for employees with their EMPid, look for Invoices with its invoice no).
Feel free to give us more information on it. Also, sample data will be helpfully for us along the description of expected output
From google drive i am downloading a csv and uploading that csv to another portal.
I want to basically check if the CSV that has been uploaded on the portal same as that of the drive one, not the old one.
So, to check, i download that uploaded CSV from the portal and compare it with the one i downloaded from the drive. If its same then its all good. The datatable looks like this
Basically i have to match the “in stock” numbers because if the new file was not uploaded on the portal the “in stock” numbers would be different and the old ones.
And if it was uploaded they would be the same as that of the one i downloaded from the drive.
Thankuou you gave some clarity…but can you explain the steps on how to go about it? which join should i take in join datatable and after that how should i check the values and everything. Really appreciate the help!
By this i am able to obtain some extra rows in the final DT. Those are the ones which did not match. But what if there are some extra rows in the second DT? Will i have to put it in the InputDataTable1 then check again?
Yes got that… we would specify it as per our needs… i have joined both the columns…and got a datatable containing some extra rows…what condition can i put now to check and return a true or false values? I’m sorry im a bit new so a bit confused
just write down the clear requirement and we will help.
in general check the join datatable result on
left Product code is Null/empty - we only have this record in dt2
right Product code is Null/empty - we only have this record in dt1
left in Stock = right In Stock - same record
Left in Stock not equals Right In Stock - we have a modifed record
This is the clear requirement:
The CSV which i will download from the portal will be only checked that whether it has been uploaded correctly or not. We will use the DT of the sheet from the drive for that comparison.
So we will take DT1 as the drive sheet and DT2 ad the Portal sheet and perform the join.
Then we have to check if there are any extra rows in DT1 which are not there in DT2. Both the datables should be exactly the same. If there are any extra rows (mismatched rows) we should get them in a separate datatable. What should be the exact steps.