Connections::Contains Method (Object^)


Indicates whether the ConnectionManager items in the collection can be accessed by using indexing without throwing an exception.

Namespace:   Microsoft.SqlServer.Dts.Runtime
Assembly:  Microsoft.SqlServer.ManagedDTS (in Microsoft.SqlServer.ManagedDTS.dll)

bool Contains(
	Object^ index


Type: System::Object^

The name, description, ID, or index to locate in the collection.

Return Value

Type: System::Boolean

true if the collection can be accessed by using the syntax Connections[index]. If true, the collection can be accessed by name, description, or index. false if indexing cannot be used to retrieve items from the Connections collection.

The following code sample removes a newly-added ADO.NET connection manager from the collection. It then uses the Contains method to make sure that the connection manager is removed.

No code example is currently available or this language may not be supported.

Sample Output:

The number of connections is: 3

The number of connections now is: 4

Name: Create_Execute_Process_Dest.sql

ID: {B52C0D78-5402-4544-BFEC-2BE203900C91}


Name: customers

ID: {4F945623-B43F-470F-9D1E-D2A0B09177AE}


Name: localhost.AdventureWorks

ID: {47179DDF-BD08-4E29-87C4-3A3D77105C2B}


Name: My OLEDB ConnectionManager

ID: {90DF568E-ECB1-46D2-8DCB-3E2C67391E64}


The number of connections is finally: 3

The connection is still in the collection? False

Return to top