Build a parentsub-relation between two DataTable objects in DataSet

xiaoxiao2021-03-18  206

1. Establish a parent / sub-relation between two DataTable objects >>>> Datacolumn childcol; datacolumn childcol; parentcol = dataset1.tables ["customers"]; columns ["custom"]; childcol = dataset1.tables ["ots"] .Columns ["Custid"]; DataRelation RelcustOrder; RelcustOrder = New DataRelation ("CustomersRDERS", PARENTCOL, Childcol; DataSet1.ReLations.Add (RelCustOrder); 2. Obtaining data private void GetChildRowsFromDataRelation (DataTable myTable) {DataRow [] arrRows; foreach (DataRelation myRelation in myTable.ChildRelations) {foreach (DataRow myRow in myTable.Rows) {arrRows = myRow.GetChildRows (myRelation, DataRowVersion.Proposed); / / Print Values ​​of Rows. For (int i = 0; I

转载请注明原文地址:https://www.9cbs.com/read-129756.html

New Post(0)