I want to run a scheduler on daily basis. So I have created a Windows application
and stored it onto the server.
This works fine on my local machine, but I get path error as
Could not find a part of path
C\Windows\System32..
With this, I think there might be some issue related to the path.
Here is my code for that.
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's wrong with the path here,
Here is the screenshot of the error
[![Error][1]][1]