다음을 통해 공유


Context.CheckCancelled Method

Throws an exception if the query has timed out or been canceled by the user.

네임스페이스: Microsoft.AnalysisServices.AdomdServer
어셈블리: msmgdsrv (in msmgdsrv.dll)

구문

‘선언
Public Shared Sub CheckCancelled
public static void CheckCancelled ()
public:
static void CheckCancelled ()
public static void CheckCancelled ()
public static function CheckCancelled ()

주의

The exception raised by CheckCancelled should be handled, and then rethrown.

In the following example, a UDF is defined that takes a very long time to execute. Occasionally, it calls CheckCancelled to determine if the function should exit:

public string LongRunning()
{

    try
    {
        //Enter a long running loop
        for (int nIndex = 0; nIndex < 1000; nIndex++)
        {
            //Exception generated when the query is canceled or Timeout occurs
            Context.CheckCancelled();
            System.Threading.Thread.Sleep(1000);
        }
    }
    catch (System.Exception ex)
    {
        Console.WriteLine(ex.Message);
        throw ex;
    }

    return "UDF Allowed to Finish";
}

스레드 보안

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

플랫폼

개발 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

대상 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

참고 항목

참조

Context Class
Context Members
Microsoft.AnalysisServices.AdomdServer Namespace