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.
Платформы
Платформы разработки
Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.
Целевые платформы
Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.
См. также
Справочник
Context Class
Context Members
Microsoft.AnalysisServices.AdomdServer Namespace