共用方式為


Task Class

Definition

Defines an abstract class that implements the methods and properties common to all tasks in Integration Services.

public ref class Task abstract : Microsoft::SqlServer::Dts::Runtime::DtsObject, Microsoft::SqlServer::Dts::Runtime::IDTSManagedTask
public abstract class Task : Microsoft.SqlServer.Dts.Runtime.DtsObject, Microsoft.SqlServer.Dts.Runtime.IDTSManagedTask
type Task = class
    inherit DtsObject
    interface IDTSManagedTask
Public MustInherit Class Task
Inherits DtsObject
Implements IDTSManagedTask
Inheritance
Derived
Implements

Examples

The following code example is a very simple task implementation for a custom task that inherits from Task.

using System;  
using Microsoft.SqlServer.Dts.Runtime;  

class MyTask : Task  
{  
    private int m_value = 123;  

    public override DTExecResult Execute(Connections connections,  
Variables variables, IDTSEvents events,  
IDTSLogging log, int lastExecResult, DtsTransaction txn)  
    {  
        return m_value;  
    }  
}  
Imports System  
Imports Microsoft.SqlServer.Dts.Runtime  

Class MyTask  
    Inherits Task  
    Private m_value As Integer =  123   
    Public Overrides DTExecResult Property connections,() As Execute(Connections  
    End Property  
Variables variables, IDTSEvents events,  
IDTSLogging log,int Function txn)() As lastExecResult,DtsTransaction  
        Return m_value  
End Function  
End Class  

Remarks

A package consists of one or more tasks. These tasks define units of work that are performed as part of copying and transforming data, communicating with other processes, and performing database management functions.

Inherits from DtsObject and IDTSManagedTask.

Constructors

Task()

Initializes a new instance of the Task class.

Properties

ExecutionValue

Returns a user-defined object. This field is read-only.

TargetServerVersion
Version

*** Member deprecated; see Remarks. ***   Returns the version of the task. This property is read-only.

Methods

CanUpdate(String)

*** Member deprecated; see Remarks. ***   A Boolean that indicates whether the new package XML can update the old package XML.

Equals(Object)

Determines whether two object instances are equal.

(Inherited from DtsObject)
Execute(Connections, VariableDispenser, IDTSComponentEvents, IDTSLogging, Object)

Runs the task.

GetConnectionID(Connections, String)

Gets a String containing the ID of the connection.

GetConnectionName(Connections, String)

Gets a String containing the name of the connection.

GetHashCode()

Returns the hash code for this instance.

(Inherited from DtsObject)
InitializeTask(Connections, VariableDispenser, IDTSInfoEvents, IDTSLogging, EventInfos, LogEntryInfos, ObjectReferenceTracker)

Initializes the properties associated with the task. This method is called by the runtime and is not used in code.

Update(String)

*** Member deprecated; see Remarks. ***   This method updates the old package XML with the new package XML if CanUpdate(String) is set to true.

Validate(Connections, VariableDispenser, IDTSComponentEvents, IDTSLogging)

Verifies that the component is properly configured.

Applies to