Filter the tick data from the dataset

Source: Internet
Author: User
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)!

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.