maandag 31 januari 2011

Resolving Schema type Name error

I've downloaded the xCBL 3.5 schema from their webiste.

When just including the Order.xsd schema in a BizTalk Project, I got following error when building the solution:

Node "<schema>" - This schema file has a TypeName that collides with the RootNode TypeName of one of its root nodes. Make sure that they are different.

Now, the reason for this is quite simple - when the project is compiled, a .NET class will be generated for each top level element in your schema. If you have two schemas which share the same top level element name a clash will occur.

The solution is to change the generated type name for the schema. To do so, select the schema in the Solution Explorer and press F4 to display the Properties window. Then change the Type Name property so that it is not the same as any of the top level elements.

dinsdag 25 januari 2011

Biztalk Documenter error: unable to locate the help compiler executable

It's possible u receive following error when generating a .chm file with BizTalk Documenter: "unable to locate the help compiler executable". The reason for this is quite clear, the application can't locate the help compiler executable, either because it isn't installed or it is also possible if you're working on a 64-bit machine.

Now to solve this do following steps:

1. First of all make sure you have installed the HTML Help Workshop compiler
If this is not the case, first download and install this compiler. It can be found on the Microsoft site here.

2. Secondly make sure that the path to this help compiler is configured correctly in BizTalk Documenter. Just go to the installation path of BizTalk Documenter (for me it was 'C:\Program Files (x86)\Microsoft Services\BizTalk Documenter'). Now open Microsoft.Services.Tools.BiztalkDocumenter.exe.config and change the path for the key 'HelpCompilerLocation'. In my case it was the problem that it was configured to 'Program Files' instead of to 'Program Files (x86)'

Hope this will help you solve the problem.

vrijdag 21 januari 2011

SQL Server 2008 R2 Update for Developers Training Kit (January 2011 Update)

The SQL Server 2008 R2 Update For Developers Training Kit January 2011 Update is released. This is a great resource for developers, trainers, consultants and evangelists who need to understand the key improvements introduced in SQL Server 2008 R2 from a developer perspective. It contains a rich set of presentations, demos, hands-on labs and videos that are perfect for self-paced learning or for conducting your own training.

You can download the training kit now at the following URL:

donderdag 20 januari 2011

Next-generation Integration Platform examination (from Gartner)

Gartner publishes an examiniation of vendors whose products provide features that address the needs of systematic A2A, B2B and cloud-based application integration projects.

Microsoft, with its BizTalk Server product, comes out as one of the leaders in the Integration space.

Gartners published research:


dinsdag 18 januari 2011

GAC assemblies with right-click

As a developer you'll often need to place an assembly into the GAC (Global Assemblie Cache).
There are several ways to do this. You can do it in command line with "gacutil -if 'assembly path'" or by dragging your assembly in explorer to "C:\Windows\assembly".

Well there is another even easier way to do this. By just adding a registry key, you can place an assembly into the GAC with a simple right-click, as you can see below.

br /> To achieve this you'll need to create the registry key.
This can be done by copying following code to notepad, and save it with the .reg extension. Now double-click the created .reg file to add the registry key.
That's it!

You can also change the shown text when you right-click by changing the 'GAC-It' (written in red) to the desired text.

Windows Registry Editor Version 5.00
@="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bin\\NETFX 4.0 Tools\\gacutil.exe /if \"%1\""

By specifying the '/if', I choose to install an assembly into the global assembly cache. If an assembly with the same name already exists in the global assembly cache, the tool overwrites it.
(other possible parameters can be found here).

ATTENTION: the path to the gacutil.exe may be different on your pc. I've installed it on a 64-bit machine. you should verify the actual path of your gacutil.exe (may occur multiple times on your pc).


vrijdag 7 januari 2011

Inserting / updating SQL from C#

Creating an SQL string in C# is a poor way to do it. It might give problems with some special characters, even the data retrieved from SQL to C# might not be the exact same anymore.

You really want to bind your parameters. It prevents SQL attacks, and makes the query run faster.

Here's a simple piece of code as an example:

   1:  // we'll assume there&#39;s a connection set up in the instance
   3:  // pass a value
   4:  public void updateLog(string msg) {
   5:   // create your command, not the @msg where the parameter will go
   6:   SqlCommand cmd = 
   7:                new SqlCommand(&quot;insert into log(msg) values (@msg)&quot;, this.conn);
   9:   // bind the value to the parameter reference
  10:   cmd.Parameters.AddWithValue(&quot;@msg&quot;, msg);
  12:   // fire
  13:   try {
  14:    cmd.Connection.Open();
  15:    cmd.ExecuteNonQuery();
  16:   } finally {
  17:    cmd.Connection.Close();
  18:   }
  19:  }

Converting DatetTime from and to Custom String format

Converting from String to DateTime

Using Convert.ToDateTime method might give you the error 'String was not recognized as a valid DateTime'.
Following code for example will result in an error:

DateTime dt = Convert.ToDateTime("20100228");

You can simply do the conversion by defining the dateTime format yourself as follows:

DateTime dt = DateTime.ParseExact("20100228", "yyyyMMdd", new System.Globalization.DateTimeFormatInfo())

Converting from DateTime to String

To convert a DateTime to String is even easier, just use following code:



for an overview of all possible DateTime formats, I'll refer to

donderdag 6 januari 2011

Not able to add a BizTalk Project in Visual Studio 2008

It's possible that you're not able to add a biztalk project in your visual studio 2008.
The likely cause is a new visual studio 2008 installation, or it's updated in any way.

The solution to this problem is quite simple.You could just do a repair of your BizTalk with the setup, this should do the trick.

Or another way to accomplish this is by changing the registry key [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Projects\{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}] from ‘csproj’ to ‘csproj;btproj’.
For a 64 bit version of visual studio this would be as follows:
Somehow this key gets reset every time the Visual Studio installation is changed...


The BizTalk Orchestration Debugger

I found a neat blog on the use of the BizTalk Orchestration Debugger.
The blog provides a very extended guide to use the Orchestration Debugger.
I even discovered some capabilities that I wasn't aware of.


dinsdag 4 januari 2011

Compress and Decompress Strings with C#

To reduce the data size in our SQL tables we compress the full received message for all messages older than 90 days.
To accomplish this I use a compression and a decompression function in C#.

I've come up with 2 different solutions.
One will use the System.IO.Compression namespace, while the other uses an external referenced library, namely SharpZipLib.

First I'll show you how you can do this by just using the build in .NET functions.
the function to decompress the String looks like this:

    public static string Zip(string value)
        //Transform string into byte[]
        byte[] byteArray = new byte[value.Length];
        int indexBA = 0;
        foreach (char item in value.ToCharArray())
            byteArray[indexBA++] = (byte)item;

        //Prepare for compress
        System.IO.MemoryStream ms = new System.IO.MemoryStream();
        System.IO.Compression.GZipStream sw = new         System.IO.Compression.GZipStream(ms,

        sw.Write(byteArray, 0, byteArray.Length);
        //Close, DO NOT FLUSH cause bytes will go missing...

        //Transform byte[] zip data to string
        byteArray = ms.ToArray();
        System.Text.StringBuilder sB = new         System.Text.StringBuilder(byteArray.Length);
        foreach (byte item in byteArray)

        return sB.ToString();

The Decompression will be done by following funtion:

    public static string DecompressData(string sData)
        byte[] byteArray = new byte[sData.Length];

        int indexBa = 0;
        foreach (char item in sData)
            byteArray[indexBa++] = (byte)item;

        MemoryStream memoryStream = new MemoryStream(byteArray);
        GZipStream gZipStream = new GZipStream(memoryStream, CompressionMode.Decompress);

        byteArray = new byte[1024];

        StringBuilder stringBuilder = new StringBuilder();

        ;int readBytes;
        while ((readBytes = gZipStream.Read(byteArray, 0,byteArray.Length)) != 0)
           for (int i = 0; i < readBytes; i++)             stringBuilder.Append((char)byteArray[i]);             }         gZipStream.Close();         memoryStream.Close();         gZipStream.Dispose();         memoryStream.Dispose();          return stringBuilder.ToString();     }

Another way to solve this is by using the SharpZipLib Library, which can be found here.
This will result in following methods:

    private static string Compress(string strInput)
    byte[] bytData = System.Text.Encoding.UTF8.GetBytes(strInput);
    MemoryStream ms = new MemoryStream();
    Stream s = new DeflaterOutputStream(ms);
    s.Write(bytData, 0, bytData.Length);
    byte[] compressedData = (byte[])ms.ToArray();
    return ConvertByteToString(compressedData);
    catch (Exception e)
    return null;
    private static string DeCompress(string strInput)
    byte[] bytInput = ConvertStringToByte(strInput);
    string strResult = "";
    int totalLength = 0;
    byte[] writeData = new byte[4096];
    Stream s2 = new InflaterInputStream(new MemoryStream(bytInput));
    while (true)
    int size = s2.Read(writeData, 0, writeData.Length);
    if (size > 0)
    totalLength += size;
    strResult += System.Text.Encoding.ASCII.GetString(writeData, 0,
    return strResult;
    catch (Exception e)
    return null;
    private static byte[] ConvertStringToByte(string strInput)
        byte[] byteArray = new byte[strInput.Length];
        int indexBa = 0;
        foreach (char item in strInput)
            byteArray[indexBa++] = (byte)item;
        return byteArray;
    private static string ConvertByteToString(byte[] compressedData)
        System.Text.StringBuilder sB = new System.Text.StringBuilder(compressedData.Length);
        foreach (byte item in compressedData)
        return sB.ToString();

The second method, with the SharpZipLib library, results in a better compression than the first solution. So by using SharpZipLib you'll get the lowest data size for the resulting compressed string.

Microsoft SQL Server 2005 SP4 is released

Service Pack 4 (SP4) for Microsoft SQL Server 2005 is now available for download. SQL Server 2005 service packs are cumulative, and this service pack upgrades all service levels of SQL Server 2005 to SP4 . You can use these packages to upgrade any of the following SQL Server 2005 editions:
- Enterprise
- Enterprise Evaluation
- Developer
- Standard
- Workgroup

SQL Server 2005 SP4 includes SQL Server 2005 SP3 cumulative update 1 to 11, customer requested fixes, along with instances of the SQL Server 2005 SP4 database Engine support for DAC operations.

link for the express edition:

There is also a SP4 released for the SQL 2005 feature pack.
The Feature Pack is a collection of standalone install packages that provide additional value for SQL Server 2005. It includes:
- Latest versions of redistributable components for SQL Server 2005
- Latest versions of add-on providers for SQL Server 2005
- Latest versions of backward compatibility components for SQL Server 2005