by robotix1986
16. July 2009 16:02
Well this entry is all code.. no explanations... you figure it out yourselves
Microsoft.SqlServer.Dts.Runtime.
Package package = new Microsoft.SqlServer.Dts.Runtime.Package();
Executable executable = package.Executables.Add("STOCK:PipelineTask");
Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = executable as Microsoft.SqlServer.Dts.Runtime.TaskHost;
MainPipe dataFlowTask = thMainPipe.InnerObject as MainPipe;
// Add a flat file destination component to the data flow task
IDTSComponentMetaData100 destinationComponent = dataFlowTask.ComponentMetaDataCollection.New();
destinationComponent.Name = "FlatFileDestination";
destinationComponent.ComponentClassID = "DTSAdapter.FlatFileDestination";
// Get the design time instance of the flat file destination component.
CManagedComponentWrapper destinationInstance = destinationComponent.Instantiate();
// Initialize the flat file destination component
destinationInstance.ProvideComponentProperties();
// Configure the flat file destination component to use the Flat File connection manager
destinationComponent.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(destinationConnection);
destinationComponent.RuntimeConnectionCollection[0].ConnectionManagerID = destinationConnection.ID;
// Configure the custom properties of the Flat File destination component
destinationInstance.SetComponentProperty("Header", "");
destinationInstance.SetComponentProperty("Overwrite", true);
// Reinitialize the metadata.
destinationInstance.AcquireConnections(null);
destinationInstance.ReinitializeMetaData();
destinationInstance.ReleaseConnections();
// ADD OTHER TASKS HERE
Hope this helps.
Regards,
AlD
by robotix1986
22. June 2009 20:43
Hi g33ks,
The SSIS object model gives us the flexibility of dynamically creating SSIS packages and running them. One major boon with this is that instead of doing column mapping of DFTs at design time, we can do this at runtime and have the mapping information in the metadata.
Today instead of posting some sample code for some basic stuff in creating SSIS packages, I thought that it would make more sense to just post some links which have sample code for various kinds of basic tasks in SSIS. So here goes.
Adding connections - http://msdn.microsoft.com/en-us/library/ms136093.aspx
Variables - http://msdn.microsoft.com/en-us/library/ms136082.aspx
Adding a Data Flow Task - http://msdn.microsoft.com/en-us/library/ms135997.aspx
Adding Data Flow Components - http://msdn.microsoft.com/en-us/library/ms135932.aspx
Connecting Data Flow Components - http://msdn.microsoft.com/en-us/library/ms136086.aspx
ADO.NET Source - http://blogs.msdn.com/mattm/archive/2008/12/30/api-sample-ado-net-source.aspx
OLEDB Source & Destination - http://blogs.msdn.com/mattm/archive/2008/12/30/api-sample-oledb-source-and-oledb-destination.aspx
Saving a Package - http://msdn.microsoft.com/en-us/library/ms403347.aspx
More elaborate samples to come soon. Till then, Adeus.
Regards,
AlD
by robotix1986
19. June 2009 19:26
Hi Folks,
was just trying out some of the accelerators that are available for IE8. I got thinking, why not make a custom one of my own… was it going to be rocket science or child’s play… i was bout to find out… well it turns out that it ain’t that complex.. in fact it is pretty straight-forward.
it involves basically just two main steps: -
-
Create the XML file known as the Service XML. Refer to the sample below.
<?xml version="1.0" encoding="utf-8" ?>
<openServiceDescription xmlns="http://www.microsoft.com/schemas/openservicedescription/1.0">
<homepageUrl>http://www.robotix1986.com/code/IE8Add-ons.aspx</homepageUrl>
<display>
<name>Sample Search Accelerator</name>
<description>get a list of Friends and Family Birthdays</description>
</display>
<activity category="Search">
<activityAction context="selection">
<preview method="get" action="http://www.robotix1986.com/code/SampleSearch.aspx">
<parameter name="query" value="{selection}" type="text"></parameter>
</preview>
<execute method="get" action="http://www.robotix1986.com/code/SampleSearch.aspx">
<parameter name="query" value="{selection}" type="text"></parameter>
</execute>
</activityAction>
</activity>
</openServiceDescription>
As you can see above, the xml is pretty much self explanatory. It gives basic information pertaining to the accelerator.
-
Now that you have this XML ready all you need to do is create a page from where you can add this accelerator to your browser. All you need on the page is a button which makes a simple call. Sample is given below.
<button onclick="window.external.AddService('http://www.robotix1986.com/code/Data/SampleAccelerator.xml');"> Add SampleAccelerator to your browser</button>
Happy Exploring!!
by robotix1986
2. June 2009 11:16
So there I was, sitting at my desk staring at the computer screen working on VS 2010 and exploring a bit of F#. I just sat back and started reflecting on my college days and the interviewing season in the 7th semester. All of us, revising all our technical knowledge, solving puzzles and complex analytical problems.
As I think about it now, I think that those problems (especially the programming ones) were pretty easy ones, but in that period, preparing for your first tryst with the world outside, its a huge thing. So, feeling a little nostalgic, I thought I’ll rewrite some of those programs in C# this time.
1. How to swap two numbers without using a third variable.
public class SwapperClass
{
public static void Main()
{
int number1 = 10;
int number2 = 20;
Console.WriteLine("a = {0}, b={1}", number1, number2);
Swap(ref number1, ref number2);
Console.WriteLine("a = {0}, b={1}", number1, number2);
Console.ReadLine();
}
public static void Swap(ref int a, ref int b)
{
a = a + b;
b = a - b;
a = a - b;
}
}
2. How to find out whether a number is a power of 2 or not in O(1) or without using any loops
public class PowerOfTwo
{
public static void Main()
{
Console.WriteLine(IsPowerOfTwo(4));
Console.ReadKey();
}
public static bool IsPowerOfTwo(int a)
{
return (a != 0 && (a & (a - 1)) == 0);
}
}
Till my next post,
Adeus,
Alvaro