C# 檔案操作方法
Directory.Exists(FILENAME); //是否有檔案 Directory.Delete(FILENAME); //刪除檔案 Directory.CreateDirectory(FILENAME); //創建檔案 System.IO.File.Move(FILENAME, FILENAME); //移動檔案
Directory.Exists(FILENAME); //是否有檔案 Directory.Delete(FILENAME); //刪除檔案 Directory.CreateDirectory(FILENAME); //創建檔案 System.IO.File.Move(FILENAME, FILENAME); //移動檔案
try{ System.IO.StreamReader sr = new System.IO.StreamReader("string_str.txt"); string[] connect_string = sr.ReadToEnd().Split(';'); string01 = connect_string[0].ToString(); string02= connect_string[1].ToString(); string03= connect_string[2].ToString(); string04= connect_string[3].ToString(); sr.Close(); }catch { MessageBox.Show("Error"); }
#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
參考:http://www.linuxea.com/1767.html 前置作業略過~有空再補 Mailer Plugin post { success { emailext ( subject: &...