c++ - SQL server 2008 Task Scheduler will not create a file from the program -


i running sql server 2008 , have .exe file on creates .txt file saved in same directory. (so, before running .exe file exists, after running .exe, .exe file , .txt file exist.) there, .exe file sends email using .txt file attachment.

here works perfectly: if double click on .exe file, .txt file created , email sent. or if .txt file there, overwritten new one. if double click on batch file runs .exe, works too.

here doesn't work: if try start either .exe or .bat file in task scheduler on server, peculiar: .txt file not overwritten or created. if .txt file doesn't exist, new 1 isn't created , no email sent. if put old .txt file there, email sent old file (i.e. file not overwritten). so, condensing down: task scheduler not allow .exe file create .txt file. fun, modified program (it created c++) creates .txt file no email , still won't create .txt file.

i'm assuming using code like:

if (!file.exists("logfile.txt")) {      log = new streamwriter("logfile.txt"); } else {      log = file.appendtext("logfile.txt"); } 

i find when running taskscheduler better use full path this:

if (!file.exists("c:\\program files (x86)\\company\\sales report\\logfile.txt")) {        log = new streamwriter("c:\\program files (x86)\\company\\sales report\\logfile.txt"); } else {        log = file.appendtext("c:\\program files (x86)\\company\\sales report\\logfile.txt"); } 

this applies when reading file.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -