I have the EMP
datatable it contains 500 records like this:
UserAceNumber UserID
emp001
emp002
emp003
emp004
(userid will be empty for all the 500 records)
Another Empdetails
datatable contains some records which I will keep UserID in this table like this:
UserAceNumber UserID
emp002 user002
emp004 user004
I need the result in the EMP
table like this:
UserAceNumber UserID
emp001
emp002 user002
emp003
emp004 user004
In this both table common value is UserAceNumber
I cant use any SQL queries because these datatables are coming from webservices and also the LINQ because I am using 2005
How to do this? I have done merge but but I need the columns as if in EMP
datatable.
You can use the Datatable.Select
query to achieve this the output will be a datarow.
var dataRow=dataTable.Select(string.Format("{0}='{1}'", primaryKeyColumnName, valueOfPrimaryKey));
For more infor about the API look here
Basically what you do is loop over one of the datatables identify the primary key column in this datatable use that to find a corresponding row in the second datatable