Add 方法
Adds the specified log provider object, LogProvider, to the end of the collection.
命名空间: Microsoft.SqlServer.Dts.Runtime
程序集: Microsoft.SqlServer.ManagedDTS(在 Microsoft.SqlServer.ManagedDTS.dll 中)
语法
声明
Public Sub Add ( _
logProvider As LogProvider _
)
用法
Dim instance As SelectedLogProviders
Dim logProvider As LogProvider
instance.Add(logProvider)
public void Add(
LogProvider logProvider
)
public:
void Add(
LogProvider^ logProvider
)
member Add :
logProvider:LogProvider -> unit
public function Add(
logProvider : LogProvider
)
参数
- logProvider
类型:Microsoft.SqlServer.Dts.Runtime. . :: . .LogProvider
The log provider to add to the collection.
注释
This method associates a log provider to a specific container. The package is a type of container, so the code example specifies that all logs for the package go to DTS.LogProviderXMLFile.2.
You can set a SelectedLogProvider for any task by using the tasks' LoggingOptions collection inherited from DtsContainer, just like the sample shows for the package.
示例
The following code example creates a log provider, then selects is as the log provider for the package.
LogProvider provider = package.LogProviders.Add("DTS.LogProviderXMLFile.2");
provider.ConfigString = "c:\\DTSPackageLog.xml";
package.LoggingOptions.SelectedLogProviders.Add(provider);
[Visual Basic]
Dim provider As LogProvider = package.LogProviders.Add("DTS.LogProviderXMLFile.2")
provider.ConfigString = "c:\\DTSPackageLog.xml"
package.LoggingOptions.SelectedLogProviders.Add(provider)