Here's how to create a C# class library in Visual Studio and invoke it from an SSIS script component (using just the teensy weensiest bit of VB.Net code):
Creationalist Assemblage
(Huh huh... see my article on the Flying Spaghetti Monster)
When you have become weary of the world and are tired of crap programming languages like VB, but you need to write a complicated piece of logic for SSIS, you may consider going down the route of programming it in an eloquent programming like C#.
Download the example code.
Create a C# class library project
You're using Visual Studio 2005, right? Create a new project - go: File -> New -> Project and choose the type of project that you want to build:
Chuck some code in
Rename your class to something useful (I called it StringUtils here) and add your clever bit of code in:
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace SSISClassLib {
- public class StringUtils {
- public static string InitCap(string input) {
- string s = input.ToString();
- s=s.Substring(0,1).ToUpper()+s.Substring(1);
- int len = s.Length;
- int pos = s.IndexOf(' ');
- while(pos!=-1 && pos < (len-1)) {
- if(pos == (len -1)) {
- s = s.Substring(0,pos) + s.Substring(pos + 1,1).ToUpper() + s.Substring(pos + 1);
- } else {
- s = s.Substring(0,pos + 1) + s.Substring(pos + 1,1).ToUpper() + s.Substring(pos + 2);
- }
- pos = s.IndexOf(' ',pos+1);
- }
- return s;
- }
- }
- }