ReportingService2005.CancelBatch 메서드

Cancels the batch that was initiated by a call to the CreateBatch method.

네임스페이스:  ReportService2005
어셈블리:  ReportService2005(ReportService2005.dll)

public void CancelBatch()

The table below shows header and permissions information on this operation.

SOAP Headers

(In) BatchHeaderValue

(Out) ServerInfoHeaderValue

Required Permissions

The user must be a database administrator or the one configured as the unattended execution account. For more information, see 실행 계정.

You must specify the ID of the batch that you want to cancel before calling the CancelBatch method. You can do this by setting the BatchHeaderValue property of the Report Server Web service to a value equal to the batch ID that was generated when the batch was created.

When the CancelBatch method is called, any method calls that are associated with the batch ID can no longer be executed. Any attempt to execute a batch with a cancelled batch ID results in a SOAP exception with the error code rsBatchNotFound.

To compile this code example, you must reference the Reporting Services Web Service Description Language (WSDL) and import certain namespaces. For more information, see Compiling and Running Code Examples. The following code example cancels a batch, attempts to execute it, and displays error details:

using System;
using System.Web.Services.Protocols;

class Sample
{
   public static void Main()
   {
      ReportingService rs = new ReportingService2005();
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

      BatchHeader bh = new BatchHeader();
      bh.BatchID = rs.CreateBatch();
      rs.BatchHeaderValue = bh;
      rs.CreateFolder("New Folder1", "/", null);
      rs.CreateFolder("New Folder2", "/", null);
      rs.CreateFolder("New Folder3", "/", null);

      Console.WriteLine("Cancelling current batch operation.");

      // Cancel the current batch.
      try
      {
         rs.CancelBatch();
      }

      catch (SoapException e)
      {
         Console.WriteLine(e.Detail.InnerXml.ToString());
      }

      try
      {
         // Generates an error because the batch has already been cancelled.
         rs.ExecuteBatch();
         Console.WriteLine("The batch executed successfully.");
      }

      catch (SoapException e)
      {
         Console.WriteLine(e.Detail.InnerXml.ToString());
         Console.WriteLine("The batch was not executed.");
      }

      finally
      {
         rs.BatchHeaderValue = null;
      }
   }
}

커뮤니티 추가 항목

추가
표시: