ConnectionManager Class


提供连接到数据源必须具有的信息。Provides the information that you must have to connect to a data source. ConnectionManager 继承的所有类都包含相同的属性和方法。All classes that inherit from the ConnectionManager contain the same properties and methods. ConnectionManager 类可将不同连接类型的实现细节与运行时隔离。The ConnectionManager class isolates the implementation details of the different connection types from the runtime. 这可使运行时以一致且可预测的方式与每个连接管理器进行交互。This enables the runtime to interact with each connection manager in a consistent and predictable manner. 连接管理器包含一组所有连接通用的常用属性,如 NameIDDescriptionConnectionStringConnection managers contain a set of stock properties that all connections have in common, such as the Name, ID, Description, and ConnectionString. 但是,每个连接类型具有该连接类型特有的其他属性。However, each connection type has additional properties that are specific to that connection type. 可以通过 Properties 集合访问这些属性。无法继承此类。These can be accessed through the Properties collection.This class cannot be inherited.

public ref class ConnectionManager sealed : Microsoft::SqlServer::Dts::Runtime::DtsObject, IDisposable, Microsoft::SqlServer::Dts::Runtime::IDTSExecutionPath, Microsoft::SqlServer::Dts::Runtime::IDTSName, Microsoft::SqlServer::Dts::Runtime::IDTSObjectHost, Microsoft::SqlServer::Dts::Runtime::IDTSPackagePath, Microsoft::SqlServer::Dts::Runtime::IDTSPersist, Microsoft::SqlServer::Dts::Runtime::IDTSPropertiesProvider, Microsoft::SqlServer::Dts::Runtime::IDTSPropertiesProviderEx, System::ComponentModel::IComponent
public sealed class ConnectionManager : Microsoft.SqlServer.Dts.Runtime.DtsObject, IDisposable, Microsoft.SqlServer.Dts.Runtime.IDTSExecutionPath, Microsoft.SqlServer.Dts.Runtime.IDTSName, Microsoft.SqlServer.Dts.Runtime.IDTSObjectHost, Microsoft.SqlServer.Dts.Runtime.IDTSPackagePath, Microsoft.SqlServer.Dts.Runtime.IDTSPersist, Microsoft.SqlServer.Dts.Runtime.IDTSPropertiesProvider, Microsoft.SqlServer.Dts.Runtime.IDTSPropertiesProviderEx, System.ComponentModel.IComponent
type ConnectionManager = class
    inherit DtsObject
    interface IDTSObjectHost
    interface IDTSPersist
    interface IDTSName
    interface IComponent
    interface IDisposable
    interface IDTSPropertiesProvider
    interface IDTSPropertiesProviderEx
    interface IDTSPackagePath
    interface IDTSExecutionPath
Public NotInheritable Class ConnectionManager
Inherits DtsObject
Implements IComponent, IDisposable, IDTSExecutionPath, IDTSName, IDTSObjectHost, IDTSPackagePath, IDTSPersist, IDTSPropertiesProvider, IDTSPropertiesProviderEx


连接管理器是连接的逻辑表示形式。A connection manager is a logical representation of a connection. 在设计时, 可以在图形用户界面中使用连接管理器来描述运行时在包运行时创建的物理连接。At design time, in the graphical user interface, you use a connection manager to describe the physical connection that the runtime creates when the package runs. Integration Services提供了不同类型的连接管理器, 这些连接管理器使包能够连接到各种数据源。provides different types of connection managers that enable packages to connect to a variety of data sources. 例如, 有一个 ActiveX 数据对象 (ADO) 连接管理器、一个 ADO.NET 连接管理器和一个 ODBC 连接管理器等。For example, there is an ActiveX Data Objects (ADO) connection manager, an ADO.NET connection manager, an ODBC connection manager, and so on. 有关详细信息, 请参阅用自定义对象扩展包For more information, see Extending Packages with Custom Objects.



获取或设置用于与数据源建立连接的连接字符串。Gets or sets the connection string used to establish a connection to a data source.


返回运行时用于创建 ConnectionManager 对象实例和将该对象添加到 Connections 集合的字符串。Returns the string that is used by the runtime to create an instance of the ConnectionManager object and to add the object to the Connections collection. 该属性为只读。This property is read-only.


获取或设置一个布尔值, 该值指示是否将包验证推迟到运行包时。Gets or sets a Boolean that indicates whether package validation is delayed until the package runs.


获取或设置 ConnectionManager 对象的说明。Gets or sets the description of the ConnectionManager object.


获取一个值,该值指示连接管理器是否通过表达式设置了属性。Gets a value that indicates whether the connection manager has properties set through expressions.


获取一个枚举,该枚举说明正在使用连接的宿主类型。Gets an enumeration that describes the type of host that the connection is being used by. 该属性为只读。This property is read-only.


获取 ConnectionManager 的 ID。Gets the ID of the ConnectionManager. 该属性为只读。This property is read-only.


返回创建的特定连接类型。Returns the specific connection type that was created. 该属性为只读。This property is read-only.


获取或设置 ConnectionManager 对象的名称。Gets or sets the name of the ConnectionManager object.


获取或设置一个值,该值指示连接管理器是否处于脱机模式下。Gets or sets a value that indicates whether the connection manager is in offline mode.


获取 ConnectionManager 的属性对象集合。Gets a collection of property objects for the ConnectionManager. 此方法用于访问连接管理器所承载的特定连接的属性。This is the method of accessing the properties of the specific connection that is being hosted by the connection manager. 该属性为只读。This property is read-only.


获取或设置对包中包含的敏感数据执行的加密级别。Gets or sets the level of encryption performed on sensitive data that is contained in the package.


获取或设置连接管理器的限定符。Gets or sets the qualifier for the connection manager.


获取连接管理器的作用域。Gets the scope of the connection manager.


获取或设置连接管理器的站点。Gets or sets the site of the connection manager.


返回一个布尔值,该值指示连接是否支持 Microsoft 分布式事务处理协调器 (MS DTC) 事务。Returns a Boolean that indicates if the connection supports Microsoft Distributed Transaction Coordinator (MS DTC) transactions.


获取连接管理器中变量的分配器。Gets the dispenser of the variables in the connection manager.


获取连接管理器中变量的集合。Gets the collection of variables in the connection manager.



创建连接类型的实例。Creates an instance of the connection type.


释放 ConnectionManager 使用的资源。Releases the resources used by the ConnectionManager.


确定两个对象实例是否相等。Determines whether two object instances are equal.

(Inherited from DtsObject)

返回连接管理器的执行路径。Returns the execution path of the connection manager.


返回一个字符串, 该字符串包含指定的属性的表达式。Returns a String that contains the expression for the specified property. Null 表示未分配表达式。Null means that no expression has been assigned.


返回此实例的哈希代码。Returns the hash code for this instance.

(Inherited from DtsObject)

获取或设置连接应用到的包的路径。Gets or sets the path of the package that the connection applies to.

LoadFromXML(String, IDTSEvents)

此方法不能由应用程序代码调用。This method is not callable by your application code. 若要加载保存为 .xml 的包,请使用 LoadPackage(String, IDTSEvents) 方法。To load a package that has been saved as .xml, use the LoadPackage(String, IDTSEvents) method.

LoadFromXML(XmlNode, IDTSEvents)

此方法不能由应用程序代码调用。This method is not callable by your application code. 若要加载保存为 .xml 的包,请使用 LoadPackage(String, IDTSEvents) 方法。To load a package that has been saved as .xml, use the LoadPackage(String, IDTSEvents) method.


释放在 AcquireConnection(Object) 期间内建立的连接。Frees the connection established during AcquireConnection(Object). 在设计时和运行时调用。Called at design time and runtime.

SaveToXML(XmlDocument, XmlNode, IDTSEvents)

此方法不能由应用程序代码调用。This method is not callable by your application code. 若将包保存为 .xml,请使用 SaveToXml(String, Package, IDTSEvents) 方法。To save a package as .xml, use the SaveToXml(String, Package, IDTSEvents) method.

SetExpression(String, String)

将指定的表达式分配给属性。Assigns the specified expression to the property. 指定 null 将从属性中删除现有表达式。Specify null to remove an existing expression from the property.


在创建连接管理器之后但尚未在运行的包中使用它之前,更改连接管理器上的限定符。Changes a qualifier on the connection manager after the connection manager has been created but before it is used in a running package.



添加用于侦听 DisposedConnectionManager 事件的事件处理程序。Adds an event handler to listen to the Disposed event on the ConnectionManager.

Applies to