Click here to Skip to main content
16,009,391 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have two DataTables

One is from local database(Populated with Stored Procedure) let say datatable1

Second one is coming from Remotely(ie From a server's database) let say datatable2

Both have same table and records,but difference is of one column (named Accessible) records is that some records of this column have different values

I want to apply a check that if datatable2 accessible is NO then update datatable1 accessible to NO
I have done folowing code:
foreach(DataTableRows dr in datatable2.Rows)
{
if(dr["Accessible"].ToString() == "NO")
{
//Here i want to apply code
}
}


How can i update dynamically datatable1?
Posted

1 solution

First you have to find the matching row in datatable1. Based on the info you provided it's impossible to say how to do that but most likely you have a key on both data tables which you could use.

You could then use for example the Select[^] method to fetch the matching row from datatable1 and compare the values.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900