This is how a strong person uses C # -- C # To create a temporary dataset for temporary data storage.

Source: Internet
Author: User
Create a temporary dataset in C # For temporary data storage
Dataset temp_ds = new dataset () outside pageload
# Region temporary storage new dataset
// Dataset temp_ds = new dataset ();
Datatable temp_dt = new datatable ();
Temp_dt.columns.add ("temp1 ");//
Temp_dt.columns.add ("temp2"); // The value of concede
Temp_dt.columns.add ("temp3"); // The value of standard_r
Temp_dt.columns.add ("temp4 ");//
Temp_dt.columns.add ("temp5 ");//
Temp_dt.columns.add ("temp6 ");//
Temp_dt.columns.add ("temp7 ");//

// SS1 = temp1;
// S2 = temp2;
// Or SS1 = textbox1.text
// String rows = {SS1, S2}; // create a data row
// Temp_dt.rows.add ("rows ");

// Foreach (datarow DR in temp_ds.tables ["temp_dt"]. Rows)
Foreach (datarow DR in temp_dt.rows)
{
Temp_ds.tables [0]. Rows [0] ["temp1"] = SS1; // League
Temp_ds.tables [0]. Rows [0] ["temp2"] = S2; // The value of concede
Temp_ds.tables [0]. Rows [0] ["temp3"] = S21; // value of standard_r
Temp_ds.tables [0]. Rows [0] ["temp4"] = ss2 ;//
Temp_ds.tables [0]. Rows [0] ["temp5"] = S1 ;//
Temp_ds.tables [0]. Rows [0] ["temp6"] = ss3 ;//
Temp_ds.tables [0]. Rows [0] ["temp7"] = S3 ;//
// SS1 = temp_ds.tables [0]. Rows [0] ["temp1"]. tostring ();
// S2 = temp_ds.tables [0]. Rows [0] ["temp2"]. tostring ();
// S21 = temp_ds.tables [0]. Rows [0] ["temp3"]. tostring ();
// Ss2 = temp_ds.tables [0]. Rows [0] ["temp4"]. tostring ();
// S1 = temp_ds.tables [0]. Rows [0] ["temp5"]. tostring ();
// Ss3 = temp_ds.tables [0]. Rows [0] ["temp6"]. tostring ();
// S3 = temp_ds.tables [0]. Rows [0] ["temp7"]. tostring ();
}

Gridview2.visible = true;
Gridview2.datasource = temp_ds;
Gridview2.databind ();

# Endregion

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.