question

InwoodGuy avatar image
InwoodGuy asked

C# VS VB.net SSIS

Just wanted to know, I am working in SSIS for a long time but i have never tried using Script task Component, the reason is that i don't know .net. So know i am planning to learn VB & C#.

But before learning i have few questions in my mind, my questions are :
1. Why do we have two different coding ways in SSIS?
2. Also give me a good example from your experience where you have used C# and VB.net separately?

ssisscript
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Oleg avatar image
Oleg answered

By now there is very little difference between the capabilities of C# vs VB.NET, though I believe that a small performance gain of less than 5% might still exist when using C# instead of VB.NET. Someone who comes from VB 6 backgound or active scripting with VbScript in old DTS packages in SQL Server 2000 usually opts to begin learning VB.NET because the this is a relatively easy thing to do, but then ends up switching to C# because the latter is newer (relative to VB 6), cleaner, and most importantly, it will force you to drop all the nasty, tattooed in the brain VB 6 baggage (using old functions like mid, left etc).

Here is an example showing that sometimes you have no choice but use C# despite all the talk about CLR allowing you to have one project written in VB.NET reference another written in C# (this assumes 2005 version):

Suppose you have a library written in C# and it exposes a custom class named Vector. From math we know that adding 2 vectors returns vector. Thus, in C# we can overload the + operator for adding 2 instances of a vector class. This library can be happily compiled and referenced by either C# or VB.Net project. The problem will come up when you will try to consume that vector class in VB.NET code the moment you try something like this:

Dim v1 as New Vector(3, 2)
Dim v2 as New Vector(4, 3)
Dim v3 as Vector

v3 = v1 + v2 ' this line will bark at you 

because VB.Net has no way of knowing what + means when applied to vectors.

The same code (simply translated) will work just fine in C# (as well as in VB.NET 2008 with Framework 3.5 which was extended to allow operator overloading)

It is not possible to come up with a definite verdict on the C# vs VB.NET. I would say if you did work with active scripts in DTS packages then it will be simply easier to start with VB.NET as you can get up to speed much quicker. If you programmed with Java, Javascript or C++ then C# will be a better choice.

Just my 2 cents.

Oleg

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Matt Whitfield avatar image
Matt Whitfield answered

Oleg is spot on, apart from one thing...

The syntax of VB.NET makes baby Jesus cry. So you should really use C#. :)

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.