Click here to Skip to main content
15,921,382 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi people i have a very challenging application to write

just wondering of someone can help me with a problem i'm having

the application i'm writing must do backups

the network is as follows

the applications is on a server
the files it has to copy is on pc1
the files has to be copies to pc2

and the SQL Server needs to be stopped on pc1 before the backups can be done

im using the code
private ServiceController GetService()
{
    return new ServiceController((string)"MSSQLSERVER");
}

the onclick event on the stop button
System.ServiceProcess.ServiceController controller = GetService();
            controller.Stop(); 
            WaitForStatus( controller, ServiceControllerStatus.Stopped, new TimeSpan( 0,1,0) );
            stStatus.Text = "Status: " + controller.Status.ToString();
            btnStart.Enabled = false;
            btnBackup.Enabled = true;
            btnStop.Enabled = false;

to stop the local SQL server and now i wonder how the code will look to stop it on pc1 from the server?

and wondering how to copy the files from the first pc to the second pc via the server?

please answers will be nice :D

ok so how do i alter the code to do it remotely

this application is only a normal windows app not a service client only a stand alone application

is it then still possible to copy files or do you need the server client structure for that? the application is going to run on only the server and not on the pcs
Posted
Updated 19-Jan-10 2:07am
v7

1 solution

I guess code will look pretty the same if you'll call it via some remote service. It can be Remoting, WCF or WebService. It depends on what infrastructure you expect to have in the future...

P.s. For copy files between Pcs, you need to check how it can be done in client-server technology you may select.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900