Hello Dave,
Why do you want to do this from C#?
Why don't rather just add a scheduled task?
Or in SQL create a scheduled job?
If you really want to execute this from C# use Process:
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
myProcess.StartInfo.FileName = "OSQL.exe";
myProcess.StartInfo.WorkingDirectory = "C:\";
myProcess.StartInfo.Arguments = "-Usa -PmyPasword -n -Q \"BACKUP DATABASE msdb TO DISK = > 'c:\msdb.dat_bak'\"";
myProcess.Start();
out of memory, so it might be buggy, but give it a try.
Cheers
Pieter
I need to create an executible that will run on a nightly basis.
The executible is a simple command line statement like:
OSQL -Usa -PmyPasword -n -Q "BACKUP DATABASE msdb TO DISK =
'c:\msdb.dat_bak'"
Is it possible to use C# to create an executible that will run this
command line statement on a scheduled basis?
If so, can anyone give me some general ideas on how to go about this?