ConnectionManager.ConnectionString Property


Gets or sets the connection string used to establish a connection to a data source.

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

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

Property Value

Type: System.String

A String that contains the connection string value.

The format and contents of the connection string depend on the data provider, the data source, and the type of connection manager that is being created. To view a sample connection string, in SQL Server Data Tools, create a package, and then create a connection manager of the appropriate type within that package. Next, in the Properties window, examine the ConnectionString property of the connection manager that you just created.

The following code example adds an OLE DB connection manager, and then sets the connection manager name and connection string properties.

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

For an XML connection string, the connection string value is formatted similar to the following:

String myConnString = @"C:\Program Files\Microsoft SQL Server\orders.xml";

Whereas for an OLE DB connection, the connection string contains values similar to the following connection string:

String myConnString = "Server=MYSERVER;Provider=SQLOLEDB.1;Pwd= xxxxxxx;User ID= xxxxx;Initial Catalog=mySource;OLE DB Services=-2";

And an ODBC connection string may look similar to the following:

String myConnString = "DSN=LocalServer;DATABASE=MySource;PWD=xxxxxxx;UID=xxxxx";

In the properties dialog box of a connection in the SSIS Designer, this value appears as the Connection String property.

For a list of all connection managers included with the product, see Integration Services (SSIS) Connections.

The following code example creates a FileSystemTask as an Executable in a package. The FileSystemTask copies a test folder that contains two subfolders and a .txt file, to another folder. The source and destinations are existing folders. Therefore, the IsDestinationPathVariable and IsSourcePathVariable are set to false, and the Destination and Source properties are set to reference two FILE connection managers that have been created and have had their connection strings set to reference Strings containing the paths.

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