Copy values in column to another column
-
Hi all how to transfer values from one datatable to another datatable. For example there are 2 datatables Table A and Table B. If then column name in Table A is the same as Table B then all the values of that column will go into Table B of the same column name. Hope you understand me. Thank you zheng
-
Hi all how to transfer values from one datatable to another datatable. For example there are 2 datatables Table A and Table B. If then column name in Table A is the same as Table B then all the values of that column will go into Table B of the same column name. Hope you understand me. Thank you zheng
-
Hi all how to transfer values from one datatable to another datatable. For example there are 2 datatables Table A and Table B. If then column name in Table A is the same as Table B then all the values of that column will go into Table B of the same column name. Hope you understand me. Thank you zheng
If you want to add a new column from table A to table B you should foreach the data row of the table a
DataTable b, a; foreach (DataRow dr in a.Rows) { string id = dr["id"].ToString(); /// "id" is the primary key DataRow[] bDr = b.Select(string.Format("id = '{0}'", id)); bDr[0]["value"] = dr["value"]; // value is the new column you want to add }