TransferSqlServerObjectsTask.Validate 方法

定义

验证任务配置正确。

public:
 override Microsoft::SqlServer::Dts::Runtime::DTSExecResult Validate(Microsoft::SqlServer::Dts::Runtime::Connections ^ connections, Microsoft::SqlServer::Dts::Runtime::VariableDispenser ^ variableDispenser, Microsoft::SqlServer::Dts::Runtime::IDTSComponentEvents ^ events, Microsoft::SqlServer::Dts::Runtime::IDTSLogging ^ log);
public override Microsoft.SqlServer.Dts.Runtime.DTSExecResult Validate(Microsoft.SqlServer.Dts.Runtime.Connections connections, Microsoft.SqlServer.Dts.Runtime.VariableDispenser variableDispenser, Microsoft.SqlServer.Dts.Runtime.IDTSComponentEvents events, Microsoft.SqlServer.Dts.Runtime.IDTSLogging log);
override this.Validate : Microsoft.SqlServer.Dts.Runtime.Connections * Microsoft.SqlServer.Dts.Runtime.VariableDispenser * Microsoft.SqlServer.Dts.Runtime.IDTSComponentEvents * Microsoft.SqlServer.Dts.Runtime.IDTSLogging -> Microsoft.SqlServer.Dts.Runtime.DTSExecResult
Public Overrides Function Validate (connections As Connections, variableDispenser As VariableDispenser, events As IDTSComponentEvents, log As IDTSLogging) As DTSExecResult

参数

connections
Connections

任务中使用的一系列连接。

variableDispenser
VariableDispenser

一个 VariableDispenser 用于锁定变量的对象。

events
IDTSComponentEvents

实现 IDTSComponentEvents 接口的对象。

log
IDTSLogging

实现 IDTSLogging 接口的对象。

返回

枚举中的 DTSExecResult 值。

示例

以下代码示例展示了如何利用 Validate 对象的方法 Package 来验证对象。

DTSExecResult myresult = pkg.Validate(myPkgConnections, myPkgVariables, myIDTSEvents, myIDTSLogging);  
Dim myresult As DTSExecResult =  pkg.Validate(myPkgConnections,myPkgVariables,myIDTSEvents, myIDTSLogging)  

注解

Validate 方法会审查属性和设置的不准确或错误设置。 该方法不接触数据,也不连接数据源以验证连接。 但它确保所需字段被填充并包含适当的值。 被验证的字段因被验证对象而异。

主要用途 Validate 是在编写自定义任务时。 当任务被丢到设计表面时,SSIS Designer 会调用该 Validate 方法,设置属性时也可能多次调用。 然而,在代码中,针对单个对象的方法 Validate 并不常用;相反,当你需要验证对象时,应该 Validate 调用该方法 Package 。 不过,如果你遇到特殊情况,这种方法也可以在单个物体上使用。

Validate该方法在自定义任务中被覆盖,无论是在 SSIS Designer 中用于验证对象,还是在代码调用时。 关于为自定义任务编写 Validate 方法的更多信息,请参见 “自定义任务编码”。

适用于