public static void C9Tp_SaveExcel() { string sql = "select * from Trip"; accessdb = new AccessDbClass(MyMeans.strConn1); DataTable a = accessdb.SelectToDataTable(sql); DataTable dt = a; string outError = ""; DateTime dtime = DateTime.Now; string fileName = Application.StartupPath + "\\EDC7 TripRecorder\\" + DateTime.Now.ToString("yyyyMMddhhmmss") + " tp.xls"; AsposeExcelTools.Tp_DataTableToExcel(dt, fileName, out outError); if (!string.IsNullOrEmpty(outError)) { MessageBox.Show(outError); } else { Process.Start(fileName); } }
public static void id_SaveExcel() { string sql = "select * from ECD_ID"; accessdb = new AccessDbClass(MyMeans.strConn1); DataTable a = accessdb.SelectToDataTable(sql); DataTable dt = a; string outError = ""; DateTime dtime = DateTime.Now; // string fileName = Application.StartupPath + "\\EDC17 ECU ID\\" + DateTime.Now.ToString("yyyyMMddhhmmss") + "id.xls"; // string fileName = Application.StartupPath + "\\EDC17 ECU ID\\" +dtime.GetDateTimeFormats('s')[0].ToString() +"id.xls"; AsposeExcelTools.Ecu_Id_DataTableToExcel(dt, fileName, out outError); if (!string.IsNullOrEmpty(outError)) { MessageBox.Show(outError); } else { Process.Start(fileName); } }