这种问题我不知道大家是怎么解决的?

解决方案 »

  1.   

    延时启动
    等Sql启动完毕后再启动你的程序...
      

  2.   

    可以试试让你的服务程序依赖于SQL Server服务
      

  3.   

    BOOL ChangeServiceConfig(
      SC_HANDLE hService          // handle to service
      DWORD dwServiceType,        // type of service
      DWORD dwStartType,          // when to start service
      DWORD dwErrorControl,       // severity of start failure
      LPCTSTR lpBinaryPathName,   // service binary file name
      LPCTSTR lpLoadOrderGroup,   // load ordering group name
      LPDWORD lpdwTagId,          // tag identifier
      LPCTSTR lpDependencies,     // array of dependency names
      LPCTSTR lpServiceStartName, // account name
      LPCTSTR lpPassword,         // account password
      LPCTSTR lpDisplayName       // display name
    );
      

  4.   

    SC_HANDLE CreateService(
      SC_HANDLE hSCManager,       // handle to SCM database 
      LPCTSTR lpServiceName,      // name of service to start
      LPCTSTR lpDisplayName,      // display name
      DWORD dwDesiredAccess,      // type of access to service
      DWORD dwServiceType,        // type of service
      DWORD dwStartType,          // when to start service
      DWORD dwErrorControl,       // severity of service failure
      LPCTSTR lpBinaryPathName,   // name of binary file
      LPCTSTR lpLoadOrderGroup,   // name of load ordering group
      LPDWORD lpdwTagId,          // tag identifier
      LPCTSTR lpDependencies,     // array of dependency names
      LPCTSTR lpServiceStartName, // account name 
      LPCTSTR lpPassword          // account password
    );都有依赖的选项.