How to calculate the difference in seconds between 2 datetime strings (yyyyMMdd HHmmss) in a SSIS expression

If you want to calculate the difference in seconds between 2 datetime strings (yyyyMMdd HHmmss) in a SSIS expression, you can use the following expression:   Pre @[User::StartDateTimeString] = “20100420 100000” @[User::EndDateTimeString] = “20100420 101010”   Expression DATEDIFF("ss",(DT_DBTIMESTAMP)(SUBSTRING(@[User::StartDateTimeString],5,2) + "/" + SUBSTRING(@[User::StartDateTimeString],7,2) + "/" + SUBSTRING(@[User::StartDateTimeString],1,4) + " " + …

How to add a new column to a flat file connection preserving the existing column mappings in Microsoft SQL Server Integration Services

If you created a flat file connection in Microsoft SQL Server Integration Services and the structure of the input files changed (a column is added), you can add a column to you’re flat file connection, by following the steps below. This will preserve the existing column mappings and column renames, …

Showing bmp, png, jpg or gif images as buttons in WPF in the best quality

If you want to show a bmp, png, jpg or gif image as a button in WPF in the best quality, you can use the following XAML:   XAML <Button HorizontalAlignment="Left" Margin="312,45,0,0" Name="refreshButton" VerticalAlignment="Top" Width="60" Height="45" Cursor="Hand" Click="button1_Click"> <Image Source="/Ada.Tip.WpfUserControls;component/Images/SmallSync.png" Stretch="None" /> </Button>   * The Stretch property of the …

A little command line parser in C#

If you create a  custom C# console application and want it to use parameters, you must create a command line parser to covert the command line parameters to C# variables. There are many different ways to pas parameters to a custom C# console application like: MyConsoleApp.exe –Parameter1Name “Parameter1Value” –Parameter2Name “Parameter2Value” …

How to convert a text containing a datetime in format “yyyyMMdd_HHmmss” to a datetime in C#

If you want to convert a text containing a datetime in format “yyyyMMdd_HHmmss” to a datetime vaiable in C#, use the following code:   UnitTest string dateTimeFormat = "yyyyMMdd_HHmmss"; string textContainingDateTime = string.Format("This is some text containing a datetime 20100808_080808 in the format [{0}]", dateTimeFormat); DateTime result = DateTime.Now; DateTime.TryParseExact(textContainingDateTime.Substring(40, …

TFS 2010 Best Practices and TFS Structure

We used the TFS Best Practices Guide on CodePlex for deploying and using our TFS server: http://tfsguide.codeplex.com/     Based on this guide we used the following TFS Structure:   $MyTeamProject1 /Main                                                                                    à Can contain solution (.sln) files /Source /MyApp1                                              à Contains MyApp1.sln file /ClassLibrary1                       …

How to serialize and deserialize an object in C# to a XML file

The following code shows how to serialize and deserialize an object in C# to a XML file.   Code using System; using System.Linq; using System.Collections.Generic; using System.Text; using System.IO; using System.Xml.Serialization; using System.Reflection; namespace MobileUI.BC { public class SerializationHelper<T> where T : class, new() { private string _fileName; public string …