In fact, we could use AMO in the Sript Task, just by include the AMO.dll, many guys have talked about it on the forum.
But now, O my god, I met a big problem.
I declare a AS connectionManager in the SSIS package. In the Script Task I can't use it.
If this is a OEL DB ConnectionManager and connect to SQL Sever, I know I could write this inside the Sript Task:
Public myKPIConnection As SqlClient.SqlConnection
myKPIConnection = _
DirectCast(Dts.Connections("CYF.KPIOperation").AcquireConnection(Dts.Transaction), _
SqlClient.SqlConnection)
Then I could use myKPIConnection inside the Task.
But, How to do the similar thing to a AS ConnectionManager? I need to DirectCast the AS connectionManager to What?
By the way, the only thing I want to do is to Start an AS transaction inside the Sript Task, and let a Process Task outside to be enlisted in the trransaction. So I need to use the same AS connectionmanager.
Thanks.
Your example is not correct. You cannot use an OLE-DB connection for SQL and utilise it inside a Script Task. You have to be using the ADO.NET connection, such as with sub-type of SqlClient.SqlConnection, which means you can cast the connection manager AcquireConnection to that type.
You have the same issue here, the AS connection is the MSOLAP90 OLE-DB provider, which cannot be used in .Net directly, as this a native OLE-DB provider.
The best thing to do woudl be to read the ConnectionString property from the connection and use that against a Microsoft.AnalysisServices.Server class, calling the Connect method. That is no doubt what MS have done when using AS connections in managed code.
|||Thanks, DarrenSQLIS.
I know I could do this, but I want to bound another Process Task in the package into the same stransaction of the Script Task. I mean, I could use that against a Microsoft.AnalysisServices.Server class, calling the Connect method, and begin an AS transaction inside the Script Task, then I want to enlist the Process Task into this transaction.
How could I do this?
No comments:
Post a Comment