Showing posts with label include. Show all posts
Showing posts with label include. Show all posts

Monday, March 19, 2012

HOW to Cast an AS ConnectionManager into a SriptTask?


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?

Friday, February 24, 2012

how to build such a report with include unkown amount of subreports?

I have spent much time but still have no idea.
I need to dynamic create the report.especially the report (A) is made up of unknown amount of one composite report(B,which include serveral subreports).
An idea is to place subreports of B directly in A.

And the subreports include some tables(not the real table in database) which columns is not fixed.|||Put the SubReport under a Group instead of under a Page header, that way you will get a subreport each time you change groups.|||Would you please explain more detail?
And the other problem is that some tables(not the real table in database) which columns is not fixed.|||I'll try to explain in more detail, but I need to know more about what you're trying to do. What version of Crystal are you using, how are you building the report (using rpt files or RDC, etc...). Give me as much details as you can about what you have already done, what's not working, and what you're trying to do.|||My crystal reports' version is 9.2.

I dont mind using RDC or RPT.

For example there are 4 database tables name (The order information of garment)OrderStyle,ColorGroup,ClothSizeCode,OrderDetails
the sub reports is
sub report A
--------------
OrderCode | StyleCode | StyleName//In OrderStyle
--------------

sub report B
-------------------
|ColorGroupCode | S | M | L | XL | XXL | ...| Summary
|-----------------
|001 |1 |5 |1 | 5 | 9 | ...|21
|002 |1 |6 |2 | 6 |1 | ...|16
|.....................................................
-------------------
|summary |2 |11|3 |11 |10 | ...|37
------------------

The S,M,L,XL,XXL are come from table ClothSizeCode and which size is selected is decided by customer. I think that to use crosstab may be a good idea.
My problem is that how to fixed these 2 subreports in one report.
In power builder it is simple but the efficiency is so poor that it may take 2 minutes to get such a report with only 6 subreport A and 6 subreport B with a few rows.|||OK, here's my guess, tell me if it's close to what you need...

Group Header #1: Customer

... SubReport1:

... ... OrderCode | StyleCode | StyleName//In OrderStyle

... SubReport2:

... ... CrossTab with ClothSizeCode as column, ColorGroupCode as row, If you choose to display Totals, it will automatically summarize it for you

Group Footer #1

Remember that each Subreport is like a whole separate report, it doesn't have to be based on the exact same criteria as your main report. Put both SubReport1 and SubReport2 in the Group Header #1 section.