Click here to Skip to main content
15,797,730 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two DataTables

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

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

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

int i=0;
            foreach (DataRow dtrow in dt2.Rows)
                if (dtrow["Accessible"].ToString().ToUpper() == "NO")
                    dt1.Rows[i]["Accessible"] = "NO";

How can i check on specific row of Drow for value NO
pankajupadhyay29 28-Mar-11 1:06am    
not clear. what you mean by specific row of drow when drow is itself a datarow.

1 solution

As you said both table columns are same and I believe your table may have a key. So when condition matched then select row based on key first table key value in second table then update the row.

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