Friday, February 24, 2012

C# code convert to SSIS

Hi, all

I've seach the threads before. a lot of discussion about C# to VSA.

So could anyone with experience on conversion from C# to SSIS/VSA give me a suggestion?

I 've C# code application which complete some ETL process. Now I need to convert all the ETL process to SSIS pacakge. the function of part of C# code is to get the result from stored procedure and then write the result to excel file, not row by row.

the C# code call Microsoft.Office.Interop.Excel as a object to write excel file.

But in VSA, I can't add Microsoft.Office.Interop.Excel as a reference so I can convert C# to VB.net regarding writing excel file.

So any solution about that?

any help will be appreciated.........

To add a reference to an assembly from wit5hin VSA, it needs to be in a special folder - %windir%\Microsoft.net\framework\v2.0.xxxxx

You should also make sure it is in the GAC, as this requried at run-time.

If you have C# code already, perhaps it would be simpler to wrap this in a custom task, staying with C#, rather than swapping to VB.Net and using the script task.

Samples available from MS, and good references in Books Online for building tasks.

Is automating excel from an unattended process support yet? It was never a good idea last time I looked, and was best accompanied with a regularly scheduled "kill excel.exe" command!

|||

Darren, thanks for you response.

add a reference to assembly - based on the discussion on http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=19740&SiteID=1

it seems that no way to add, that seems the limitation of VSA.

"wrap this in a custom task" that means in the Toolbox of SSIS, there are a component named custom task? I am sorry I am fresh to SSIS. could you help to point to the location of the samples from MS or books online?

thanks.

|||

If you copy the file to the correct folder, it will then appear in the Add Reference dialog. Have you copied the assembly to the folder? The whole thread is about how you CAN add references, but how daft the method it, so it is possible, but you need to copy the file.

Referencing Other Assemblies in Scripting Solutions
(http://msdn2.microsoft.com/en-us/library/9b655bcd-19f6-43d8-9f89-1b4d299c6380.aspx)

Tasks appear in the toolbox. You can write yoru own task and add it to the toolbox. Tasks can be written in any .Net language, and obviously they are not written in VSA, but a full development tool such as Visual Studio.

Extending Packages with Custom Objects
(http://msdn2.microsoft.com/en-us/library/26616eb8-9e80-434d-b22a-ece1b00f449d.aspx)

Developing a Custom Task
(http://msdn2.microsoft.com/en-us/library/dcbd8615-fa6d-4ddb-b8a5-0b19dddd6239.aspx)

|||

Hi, Darren

for the first question "add reference".

I think I should follow the apporach "Using a Custom Managed Assembly"

which is in the URL you copied to me.

So I should copy Microsoft.Office.Interop.Excel which locates on my "c:\assembly" to %windir%\Microsoft.NET\Framework\v2.0.xxxxx, right?

Acually, this file can't be copied, no copy option when you right click.............

No comments:

Post a Comment