Step1: Assume that in DataRow you have PatientData with Sequence 1 for ABCD Patient which is added and after immediate adding the row , if a same copy of the row use the below sample code: DataRow drowX= DataTableN.NewRow(); drowX["Name"]="ABCD"; drowX["ID"]="ABCD1"; drowX["Seq"]="1"; DataTableN.Rows.Add(drowX); //immediate after above line below code will create a copy of the same row. DataRow drownew = DataTableN.NewRow(); drownew.ItemArray = drowX.ItemArray;//Creats a copy of the row. drownew["Seq"] = 2; DataTableN.Rows.Add(drownew ); with out looping to next foreach we easily create copy of the row with some changes.
No comments:
Post a Comment