views:

243

answers:

1

I have developed an SSIS custom task component. It uses a connection manager of the ado.net variety to do its database work.

I'm in the processes of adding a GUI to the component and I can't find a way to filter/display just ado.net connections.

I'm using the following code to load the connections into a list box.

    //Load up Connections to combo box 
    private const string ADO_Connection_Type = "ADO.NET:System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0,Culture=neutral, PublicKeyToken=b77a5c561934e089";
    foreach (ConnectionManager connectionManager in _dtsConnectionService.GetConnectionsOfType(ADO_Connection_Type)) 
    {
        cboConnection.Items.Add(connectionManager.Name);
    }

When I use this code nothing loads to the combo box. If I use the generic _dtsConnectionService.GetConnections() all connections including the ado.net connection show up in the combo box.

A: 

I should borrow the "It works on my machine" logo for this.

foreach(ConnectionManager connectionManager in _dtsConnectionService.GetConnections()) 
    {
        string cn = connectionManager.CreationName;
        if (cn.Contains("ADO.NET")) {
        cboConnection.Items.Add(connectionManager.Name);                                                
        }
    }
CTKeane

related questions