Programme one:
DataSet dstemp = new DataSet (); Dstemp = Dsdt.clone (); datarow[] Drs = dsdt.tables[0]. Select ("checked= ' 1 '"); foreach (DataRow Dr in Drs) { dstemp.tables[0]. NewRow (); Dstemp.tables[0]. Rows.Add (Dr. ItemArray); } Dsdt.acceptchanges ();
Small bet
1, AcceptChanges, and RejectChanges: accepts or discards all pending changes in the dataset. When you call AcceptChanges, the RowState property of all rows with the RowState property value of added or modified is set to unchanged. Any DataRow object marked as deleted will be removed from the dataset. When RejectChanges is called, any DataRow object marked as added will be removed from the dataset, and the other modified Datrow objects will return to the previous state.
2. ItemArray: Gets or sets the value of all the columns in the row.
3.Clone and copy: Using the Copy method creates a new dataset that has the same structure and the same row as the original dataset. Using the Clone method creates a new dataset with the same structure, but does not contain any rows.
4.NewRow() creates a new DataRow with the same schema as the table.
Scenario Two:
DataSet dstemp = new DataSet ();d Stemp.merge (Dsdt.tables[0]. Select ("checked= ' 1 ')");
Small bet
Merge: Loads data from another dataset, DataTable, or a set of DataRow objects in an existing dataset.
The above is the selection of data from the dataset to filter out the content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!