SHOWcode

2020年4月1日 星期三

C# DataRow[] TO String

#region 輸入的VALUES

 string str_values = "";

 DataTable data_pigname = survive_data.DefaultView.ToTable(true, new string[] { "類別" });
 
 for (int i = 0; i < data_pigname.Rows.Count; i++){

   string str_mydata = "";

   str_values += " { name: '" + data_pigname.Rows[i][0] + "', data: [";

    for (int j = 1; j <= 12; j++){

      string str_my = ddl_time.SelectedItem.Text.Trim() + "/" + j.ToString().PadLeft(2, '0');

                    //.PadLeft(補0)

                    DataRow[] data_pignow = survive_data.Select("年月 = '" + str_my + "'and 類別 = '" + data_pigname.Rows[i][0] + "'");

                    if (data_pignow.Length != 0){
      str_mydata += data_pignow[0]["本月結存數"].ToString() + ",";

     }else{

                        str_mydata += "0,";

                    }


                }
   str_values += str_mydata.Substring(0, str_mydata.Length - 1) + "] },";

    }

    survive_actual = str_values.Substring(0, str_values.Length - 1);

  #endregion

沒有留言:

張貼留言

Jenkins-mail

參考:http://www.linuxea.com/1767.html 前置作業略過~有空再補 Mailer Plugin post { success { emailext ( subject: &...