Results 1 to 3 of 3

Thread: Starting SQL Server 7.0 Service from ActiveX

  1. #1
    johnweidauer
    Guest

    Starting SQL Server 7.0 Service from ActiveX

    I am using the SQLDMO Object Library. I can STOP and PAUSE the SQL Service, can anyone help me with the syntax or code to START the Service????????

    Thank you.

  2. #2
    Hyperactive Member johnweidauer's Avatar
    Join Date
    Sep 2002
    Location
    SLC, UT
    Posts
    314

    *bump*

    --------

  3. #3
    Junior Member
    Join Date
    Feb 2003
    Location
    UK
    Posts
    23
    Not sure how to do it with the SQLDMO Object Library, but you could use the StartService API function instead.

    BOOL StartService(
    SC_HANDLE hService, // handle to service
    DWORD dwNumServiceArgs, // number of arguments
    LPCTSTR* lpServiceArgVectors // array of arguments
    );

    but you can probably guess that you don't have a handle to the service at this point ... so backing up a bit ...

    1) Use the OpenSCManager to simply open the Services database.
    2) Using the newly acquired handle to the SC Manager, open the service you're after with OpenService

    Now you're in a position to kick off the StartService call.

    Don't forget to close the handles when you're finished.

    MSDN can be helpful for the specifics.

    This is the link for OpenSCManager . It has links to all the other API calls you'll need.

    Hope this helps
    Dave
    Last edited by daughey; Mar 19th, 2003 at 08:48 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width