er.Status<>SQLDMOSvc_Running) then
begin
OjobServer.Start;
end;
osqlServer.DisConnect;
oSqlServer._Release;
oSqlServer :=nil;
except
on E :Exception do
begin
application.MessageBox(Pchar(E.Message+‘啟動SQLSERVER代理錯誤!‘),‘系統提示‘,MB_OK+MB_ICONSTOP);
end;
end;
end;
//取SQL的安裝路徑
function getSqlRootPath(serverName,LoginUserName,LoginPassword:String):String;
var
osqlServer :_SqlServer;
begin
try
osqlServer :=coSqlServer.Create;
oSqlServer._AddRef;
oSqlServer.Connect(ServerName,LoginUserName,LoginPassword);
result :=oSqlServer.Registry.SQLRootPath;
osqlServer.DisConnect;
osqlServer._Release;
osqlServer :=nil;
except
Raise;
end;
end;
end.