I am creating a ssis package and I want to use the existing OleDbConnection inside the Script Component. Here is my code:
public override void AcquireConnections(object Transaction)
{
base.AcquireConnections(Transaction);
cm = this.Connections.Connection;
con = (OleDbConnection)cm.AcquireConnection(Transaction);
MessageBox.Show(con.ToString());
}
When I close BIDS, I get the following message: "System.InvalidCastException: Cannot pass a COM object of type" System .__ ComObject "to a class type of System.Data.OleDb.OleDbConnection. Instances of types that represent COM components, cannot be attributed to types that do not represent COM components, however, they can be passed to interfaces if the underlying COM component supports QueryInterface calls for the IID of the interface.
The same code works fine with an Ado.Net connection. Can I use OleDbConnection here or Script Component only supports Ado.Net?
Thanks in advance.