您的位置:程序门 -> vc/mfc -> 基础类



我发现不管是nt服务还是一般的开机即启动的程序,只要跟数据库(sql server或者access)有连接,就会出错,连接不成功。


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


我发现不管是nt服务还是一般的开机即启动的程序,只要跟数据库(sql server或者access)有连接,就会出错,连接不成功。
发表于:2007-07-26 11:21:46 楼主
这种问题我不知道大家是怎么解决的?
发表于:2007-07-26 11:40:491楼 得分:0
延时启动
等sql启动完毕后再启动你的程序...
发表于:2007-07-26 11:54:592楼 得分:0
你怎么延时启动启动呀,感觉不是办法。
发表于:2007-07-26 13:14:483楼 得分:0
up
发表于:2007-07-27 09:51:054楼 得分:0
up
发表于:2007-07-27 10:01:155楼 得分:0
可以试试让你的服务程序依赖于sql   server服务
发表于:2007-07-28 08:42:186楼 得分:0
楼上的朋友,你知道怎么设置依赖吗?
发表于:2007-07-28 09:50:487楼 得分:0
up
发表于:2007-07-28 12:39:598楼 得分:0
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
);
发表于:2007-07-28 12:41:489楼 得分:0
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
);

都有依赖的选项.


快速检索

最新资讯
热门点击