I want to run the scheduler on a daily basis. Therefore, I created a Windows application and saved it on the server.
This works fine on my local machine, but I get a path error like
Could not find part of the path
C \ Windows \ System32 ..
With this, I think there may be some kind of problem associated with this path.
Here is my code for this.
startupPath = Environment.CurrentDirectory; strExp = "RAName = '" + group.Key + "'"; DataTable dtNew = ds.Tables[1].Select(strExp).CopyToDataTable(); DataSet dsNew = new DataSet(); dsNew.Tables.Add(dtNew); dtNew.Columns.Remove("RAName"); dtNew.Columns.Remove("UserEmail"); ExcelLibrary.DataSetHelper.CreateWorkbook(startupPath + "\\Attachment\\Reminder_Sheet_ " + dtNew.Rows[0]["SR NO"].ToString() + ".xls", dsNew); ls_attach1.Add(startupPath + "\\Attachment\\Reminder_Sheet_ " + dtNew.Rows[0]["SR NO"].ToString() + ".xls"); foreach (var attach in ls_attach1) { mail.Attachments.Add(new Attachment(attach)); } ce.SendEmail(tb_RA.Rows[0]["RA1_Email"].ToString(), "", "", "Information on documents for processing", sbodyMail, "AUTOSQL", "Powersoft", ls_attach1, "ConnectionString"); foreach (Attachment attachments in mail.Attachments) { attachments.Dispose(); } if ((System.IO.File.Exists(startupPath + "\\Attachment\\Reminder_Sheet_ " + dtNew.Rows[0]["SR NO"].ToString() + ".xls"))) { System.IO.File.Delete(startupPath + "\\Attachment\\Reminder_Sheet_ " + dtNew.Rows[0]["SR NO"].ToString() + ".xls"); }
I donโt know what happened with this path,
Here is a screenshot of the error

VVVV 02 Sep '16 at 11:00 2016-09-02 11:00
source share