c# - Connection manager to accept either of ADO.NET or OLEDB connection types -
please @ following piece of code. accept ado.net connection type , want make work oledb well. in other words, if connectionmanager presented oledb type connection, should not fail. connect using either of ado.net or oledb (i not looking both of them @ same time).
using microsoft.sqlserver.dts.runtime.wrapper; private sqlconnection sqlconnection; public override void acquireconnections(object transaction) { if (componentmetadata.runtimeconnectioncollection[0].connectionmanager != null) { connectionmanager cm = microsoft.sqlserver.dts.runtime.dtsconvert.getwrapper(componentmetadata.runtimeconnectioncollection[0].connectionmanager); connectionmanageradonet cmado = cm.innerobject connectionmanageradonet; if (cmado == null) throw new exception("the connectionmanager " + cm.name + " not ado.net connection."); sqlconnection = cmado.acquireconnection(transaction) sqlconnection; sqlconnection.open(); } }
any on appreciated! thanks.
found answer on question had posted. updated reference.
Comments
Post a Comment