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