Monday, November 26, 2007

MDIParent and/or Parent Property is Null! Timing Issue

One of the problems I faced today was when I was attempting to reference some properties of the MDIParent of a child form.

The code was executing in the constructor scope of the child form. It turns out that until the Activation scope any attempt to reference the parent form will result in a null value.

So I moved the neccessary code to a method wired up to the Active event of the form and received a reference as expected.

Tuesday, July 24, 2007

Finally Moved, Started with Avanade

I am officially an eastern states guy now. Pamela and I arrived in Sydney a week or so ago and have moved into our new apartment.

I started with Avanade last week. This company looks very slick. I will begin posting about my development adventures in the coming weeks.

Tuesday, July 03, 2007

Select Multiple Rows in GridView

There is an excellent control available that is an extension to the GridView component found in ASP.NET 2.0.

It essentially allows selection of multiple rows in a GridView control. I have implemented in a project and found it to be very simple to configure. The control has a few extra methods and properties to enable the multiple selection.

One thing to note that the SelectedIndices property mentioned in the article does not exist in the compiled C# binary in the download from the same page. There is however, a GetSelectedIndices method which returns an array of integers that you'd expect.

You can find this here.

Friday, June 29, 2007

Promoting Context Properties

Sometimes there is a context property on a message in BizTalk that for some reason by default does not get promoted. If you want to route the message based on this property (say in a send port), then follow these steps:

1) Create a Correlation Set and Type based on the property you want to route by in your orchestration.

2) In the Send Port properties that sends the particular message you want to route, set the Correlation Set to initialise. This is achieved through Orchestration Designer.

I found out step one via this Addictive News post. Step two is there for clarification.

There is also a custom pipeline component available that allows a bit more dynamism.

Thursday, June 28, 2007

Dropping Temp Tables in SQL Server

A typical task in a some stored procedures is to check whether or not a table exists and if so do something with it, perhaps dropping it.

If it is a temp table people sometimes are not sure how to go about this.

Here is some simple code to accomplish the task:

IF OBJECT_ID('tempdb..#tempT') IS NOT NULL

Remember that all the temp tables you create actually get created in the tempdb database, which is a system database (not the database you are using!). So replace #tempT with the name of your temp table, but leave the tempdb in there.

Friday, June 22, 2007

SSIS Package Automation (DTutil)

I was putting together a deploy script for a project I have been working on the includes a series of SSIS packages developed using Visual Studio Business Intelligence Studio. After a bit of googling I discovered the way to automate the deployment of these was with a command line utility called dtutil.

You can move SSIS packages around from any sort of store to another. Here is a basic example that involves copying a package from a a file location (perhaps your deploy folder?) to the default sql server instance on the machine you run the command from.

Note that the /Decrypt option is for password encrypted packages built using the technique described in a previous post.

dtutil /FILE MyPackage.dtsx /COPY SQL;MyPackage /Decrypt myEncryptionPassword

Automating SQL Scripts via Command Line (sqlcmd)

A typical deployment task in any systems integration project usually involves either deploying a sql database or making some modifications to an existing one.

Previous to SQL Server 2005, we could use osql to automate this task. We still can, but SQL Server 2005 brings us a command line utility with a little bit more grunt that is more purposed to our task.

This is sqlcmd. Follow that link for the msdn article about it.

This can let us do anything we can do via T-SQL via the command line. All you need to do is put all your sql into a script file and then you can run the script from the command line by inputting something like this:

sqlcmd -S localhost -i d:\deploy\DoTasks.sql -U myusername -P mypassword

Note that the switches seem to be case sensitive. You don't need to specif icy a user name and password, if you don't sqlcmd will just use your current security context.

Wednesday, June 20, 2007

BizTalk Scripts

There is a fantastic resource for various vb scripts for BizTalk admin and development tasks that can be found at gotdotnet.

Some of the scripts could be very handy for prepping a prod/preprod/test server for deployment.

Tuesday, June 19, 2007

BizTalk MsgBox Log File

Attempting to master BizTalk means having to understand how a lot of different technologies work.

Having a strong knowledge in SQL Server is something that time and again comes in very handy. Whilst I might be able to whip up a decent stored procedure, or set up a decent batch job, when it comes to the more complicated DBA type work I am still very much a learner.

I recently left a solution deployed to the test environment running over the weekend to see how it would cope over a decent period of time. When I got in on Monday there was over 60k server instances in the dehydrated or ready to run state. This was not what I wanted to see, definitely not in the expected or acceptable results ball park.

Turns out the cause was the there was no hard drive space left which meant log files could not be written to, intermediate xml messages coukdn't be created etc

I thought perhaps that the file output of the orchestrations had just written too much data to the poor 20gb hd in use. This turned out to be a false assumption as the culprit was the BizTalk Message Box database' log file. It had expanded to 12gb.

So in SQL Management Studio you can right click on the BizTalkMsgBoxDB and go to Tasks -> Shrink -> Files and select the log file. You'll then be able to resize the log DB.

Just as importantly is the right click Properties -> Files dialog. This lets you set auto growth options for the log file.

Friday, June 15, 2007

A Simple Yet Deceptive Trap

This is something that caught me today. It seems like a pretty simple thing, but had me frustrated for about fifteen minutes.

When compiling a BizTalk project with orchestrations enclosed you may occassionally get a "cannot find symbol" or "invalid reference" message when compiling. This seems like a simple enough problem, just reload your references and things should be fine?

Well occassionally we make silly mistakes. In this instance it turns out that I did not put double quotes around the value propertyof an orchestration variable. It turns out the Intial Value property of an orchestration variable is a live property in that it accepts referernces to objects and other variables. So if you want just a string literal you need to explicitly make Visual Studio aware that what you are entering is a string (quotation marks).

Of course it may be better to design your solution so that the initial value property is pulled from a variable elsewhere, perhaps in an XML file or database somewhere instead of hardcoding inside your orchestration!

Thursday, June 14, 2007

Tech Ed 2006 Retrospective, Windows Server 2008

It was still called longhorn back then, but essentially the same product.

So Tech Ed 2007 has just been and gone, which I sadly missed, but I'd like to share a little bit of belated news about last years festival.

One of the tidbits that the evangelists and gurus from Microsoft told us in Sydney was that apparently everything you can do in a GUI you will be able to do from the command line.

Take a moment to let that sink in.

Coming from a systems integration perspective, that is pretty great news. Some of the more recent projects I have been working on require some fairly complex deploy operations. SQL Server databases, DTS pacakges, various BizTalk artifacts, .NET assemblies to be gacked and lots of security settings. This has the potential to simplify things grandly.

If anyone has any thoughts on this please leave a comment.

SSIS DTS Package Security Woes and Fixes

In a previous blog I talked about how to get security settings to persist across servers in DTS packages made using Business Intelligence Studio for SSIS.

Well it seems sometimes no matter how many rebuilds and hard coding of connection strings into the package you do, things just don't go as planned. The dreaded "AcquireConnection" message comes up and your package fails to execute.

There is hope though. From a maitenance perspective this may in fact be a better way of doing things assuming access to SSIS is limited to the correct server team guys and gals.

In the "Run Package" dialog box you can click on the "Connection Managers" tab. This lists the various connections in your package. You can override the settings for these connections here.

In a future post I will let you know how this integrates with the SQL Server Agent jobs.

Wednesday, June 13, 2007

MMC cannot open the file ...

From time to time you may see an error message similar to this when trying to open any MMC snap-in:

Microsoft has this article about it. The solution suggested did not seem to work for me.

I was able to get around this problem by opening mmc (it's located within the scope of the path variable so you can just go "Run -> mmc" to open it). You can then add the approriate snap in.

Wednesday, June 06, 2007

Some Days

Some days are just not as productive as others!

I don't know if it was the cold weather (it got below 10 C today!), the forboding morning traffic jam or the distinct lack of satisfaction from my morning corn flakes, but when I logged on I somehow knew something was amiss.

I immediately dived into some experimental rules engine stuff (which I will hopefully tell you all about in a future blog post) and thought I had shaken the willies. I was wrong. Not long after deployment I noticed something awry. My receive ports weren't receiving and my send ports weren't sending.

Somehow every folder on my local hard drive got the read only tag.

To add to my woes I could not log on locally to my SQL Server instance. Bizarrely I used mstsc to log remotely onto a server with SQL Management Studio and connect back the other way to my local host I could use my host instance fine.

So after implementing many well intentioned hot fixes and workarounds I am still stuck. A full system scan using the office standard Symantec Antivirus is in progress and my machine is at the mercy of the desktop support team.

I am expecting great things from tomorrow :)

Tuesday, June 05, 2007

BizTalk Large Posters from Microsoft

Microsoft have provided some great BizTalk posters to print out. The BizTalk Server Team Blog has the low down.

Free Download Manager

I have been using the Free Download Manager for about a month now. I have not really used download managers of any sort for quite a few years, probably GetRight was the last one I used.

FDM I have found quite unobtrusive to my workspace, but also very stable and pretty does what a dowbload manager should do. I'd reccomend it.

Friday, June 01, 2007

Google Gears

Slashdot is reporting that Google has released a new technology called Google Gears. I headed over to check it out...

So currently it is released as a beta. The product boasts that it can:

1) Store and serve application resources locally.
2) Store data locally in a fully-searchable relational database.
3) Run asynchronous Javascript to improve application responsiveness.

So it is touted as a "browser extension" that allows web sites a developer creates to be viewed offline.

So the database technology is actually just SqlLite. The "Local Server" is the seemingly key piece of software that allows you to view your web sites offline (i.e. without network connectivity). This is potentially quite handy for perhaps security sensitive apps.

I intend to investigate this a little more and will make another post after some decent hands on exposure. Google rarely release something to the market that doesn't have broad innovative goals in mind. This one could be easily dismissed as unnecessary , but I have a feeling that after a bit of a play this might be something potentially powerful.

DTS Packages (SSIS) Running as Scheduled Jobs

A lot of people, including myself, have been confounded by some mildly complex security settings in relation to DTS tasks.

Having deployed a DTS package to SQL Server 2005 Integration Services and then running the package from SSIS, I received no errors. The package ran as expected. I needed to run this package every ten minutes, so I set up a single step job via SQL Server Agent using the SQL Server Management Studio. When I attempted to run teh job there was no joy, simply a failed job.

I investigated the History logs as suggested by the very vague error message provided. You can do this by right-clicking on the job and selecting "View History". I discovered that the job was attempting to run as a domain service account. It turns out that when you run a job it is run by the server and not the user context. Running a package manually will use whatever user you logged on as.

So a bad way of fixing this problem would be to simply restart the SQL Server Agent windows service using the relevant user credentials (the credentials used to deploy the package to SSIS). We obviously don't want to do this.

So we must create a Credential and a Proxy, and then set up the particular step of the job to run as the Proxy rather than the SQL Server Agent account. Details can be found here.

These settings took me a bit of experimenting before I understood what was going on.

Thursday, May 31, 2007

SSIS OleDB Acquire Connection 0xC0202009 Deployment Considerations

When deploying a SSIS DTS Package to SQL Server 2005 and using any OleDB connections it is worth while considering the Protection Level property. This property is associated with your Control Flow and has a couple of different settings.

When using the "Encrypt all with Userkey" which it defaults to, you are more than likely going to run across a 0xC0202009 type error when running the package on a server other than the one you developed on. To be more specific- running the package under a user account other than the one you built the SSIS Package in Visual Studio on.

To get around this simply set the Protection Level to "Encrypt all with Password". At design time you will set your password and at deploy time you'll need to type it in. This will allow you to persist security information across servers.

There is a thread about this at Developerdex. I tend to find answers to some obscure questions there.

Matt Yeager was the chap who responded with the required information. Thanks Matt!

Check out Microsoft Surface

If you have not seen this, you must check it out.

This technology looks awesome. Minority Report type GUIs are not too far off! I have dreamt often of this sort of thing. I think in a few short years time we are going to be seeing a whole new generation of applications based around this sort of interface.

Wednesday, May 30, 2007

SSIS Extracting data from OleDB Connection with Parameters

I have been putting together a DTC package using Business Intelligence Studio for Visual Studio 2005. For those in the know, this is the IDE for working with Integration Services for SQL Server 2005.

One of the tasks I had was to pull data from an Oracle data store based on a parameter that was generated from a query to a SQL 2005 db. I would then need to move the data into the SQL 2005 database, along with a few derived columns.

Whilst I was easily able to set up connectivity to the Oracle DB using ODBC within a Data Flow scope, I needed to use parameters and the Data Reader object does not support them. OleDB does, if you use a variable with an expression you can evaluate. I'll post how to do this later.

The problem I had was that the Microsoft OleDB provider for Oracle does not seem to work very well. By that, I mean I could not get the thing to function at all within a Data Flow section, but I could get it to work within a Control Flow.

The answer to all my problems was to download and install the relevant Oracle OleDB Provider. I made the relevant adjustments to my "OLE DB Source" component and relevant connections and ran the project. Everything worked. Having now deployed the package to the test environment and created and scheduled a job, there have yet to be any further problems.

So the lesson I learnt from this was that if you are going to connect to a database from the Microsoft platform always grab the database manufacturer's providers. They are generally free and supported so hopefully fairly simple to justify the addition to deployment.

Changes in Functionality from Windows Server 2003 with SP1 to Windows Server 2008

So Longhorn has a name and it Windows Server 2008. There is a document up at the Microsoft site now that has a description of all the changes from Server 2003 SP 1 to Server 2008. You can grab that here.

Monday, May 28, 2007

Oracle Import Error: Could not validate configuration of Primary Transport of Send Port

I have been attempting to import some binding information for a BizTalk application I've been working on for a couple of weeks. The specific problem has to do with the OracleDB adapter bindings.

When I tested out my deploy script on the test servers I received an error quite similar to this:

TITLE: Import Error

Failed to import "pathtomsifile".
Location of the log file is provided in the Results page.

Change requests failed for some resources. (mscorlib)

Unable to process create change request for BizTalk binding "BindingInfo.xml". Import bindings (overwrite) failed. (Microsoft.BizTalk.ResourceManagers)

Failed to update binding information. (mscorlib)

Could not validate configuration of Primary Transport of Send Port 'portname' with SSO server.
Specify user name and password (Microsoft.BizTalk.ExplorerOM)

Specify user name and password (Microsoft.BizTalk.ExplorerOM)

A solution to this can be found here. A later verson of Microsoft.biztalk.adapters.bizutil.dll is required in the GAC than the one I had! It needs to be dated 14th Sept 2006 or later.

Thursday, May 24, 2007

BizTalk Server Pattern Wizard

Available here is a freeware type tool called the BizTalk Server Pattern Wizard. It claims to help capture and reuse your BizTalk projects best practices.

SQL Server 2005 Best Practices Analyser

Available here is the February 2007 CTP of the SQL Server 2005 Best Practices Analyser. Information about this can be viewed here.

Here is a screen shot of the output of a basic scan on my locally hosted test server:

Wednesday, May 23, 2007

Beta of Orcas (Next Version of Visual Studio) Out

You can download a beta of Orcas here. This is also gives the community a glimpse at the .NET Framework 3.5 with Beta 1 provided. So for those of you who are keen to get an early start in adapting to the new technologies and development environment for what will primarily be a Vista world, check it out.

VPC images are also available, with and without Team Foundation Server.

Oracle Adapter Error

Was running into an issue with the Oracle Adapter that comes with the "Microsoft BizTalk Adpaters for Enterprise Applications" bundle. At run-time event log was reporting three errors messages, including "Runtime Error : Unable to load DLL (BAUtil.dll)."

After a bit of googling I found the following solution on the Microsoft Knowledge Base site.

This solved the problem, however it may be worth noting to check the security settings for the "C:\Program Files\Common Files\Microsoft BizTalk Adapters for Enterprise Applications" folder. You need to make sure the BTS host(s) that will be utilizing this adapter have Read/Write permissions there.

Deploy Failed, "A file load exception occurred while attempting to install the assembly into the Global Assembly Cache."

Occassionally when deploying a BizTalk resource from Visual Studio you will receive the following error message:

Error 16 Failed to add resource(s). Change requests failed for some resources. BizTalkAssemblyResourceManager failed to complete end type change request. Unable to install the "C:\Documents and Settings\foc18bs\Local Settings\Temp\BT\PID1188\BizTalkAssembly\c94a039fff06502b4de07ec61b983b9c\EPS.Schemas.dll" assembly into the Global Assembly Cache.
Exception: A file load exception occurred while attempting to install the assembly into the Global Assembly Cache. This error may occur if the assembly is delay signed, or if assembly was renamed after creating/signing.

I encountered this problem today and after a bit of exploring found out that it was happening because the assembly in question was still in use by a process. Sometimes it can get difficult to track down what process is using the file so I consulted the free Microsoft utility, Process Explorer and found out that some mmc process had a handle on it.

I killed all the non devenv processes that had a handle on the dll. I was then able to successfully redeploy.

Edit: You may have to kill some of the handles that devenv.exe has as well. Spefically those that have a handle on the instance of the dll in the GAC directory.

Tuesday, May 22, 2007

Starcraft 2

Not technically anything to do with BizTalk or .NET (although perhaps Starcraft is coded using c++/clr!), but I thought it well worth mentioning.

Starcraft 2 has been announced by Blizzard!

The orignal game was considered to be one of the best and the title has become a classic. The original created TV celebrities from Korea and still remains as one of the top RTS games today.

Friday, May 18, 2007

Multiple Hosts on a Single BTS Server

Some of you may have come across the BizTalk Server Best Practices Analyzer. You can run this tool against a BTS server and it will spit out a quite verbose listing of currently existing configuration issues and helpful recommendations.

One of the more interesting recommendations it makes is about the use of multiple hosts. Using a separate host and host instance for receive ports, send ports, tracking and orchestrations allows for some significant flexibility. From an infrastructure point of view it makes upgrading your single machine installation to a multi-machine or farm a far easier task. There should be performance increases as you are separating the workload amongst a group of processes instead of one. A discussion is brewing over at topxml.


Recently I have been working on a BizTalk project that receives large messages at a fairly regular interval. Whilst BTS 2006 does implement an enhanced messaging engine that touts improvements to transformation carried out on large messages, in practice I have found the increase to be noticeable but not enough when dealing with increased traffic as well.

There is a great article of debatching inbound messages from the sql adapter over at Richard Seroters blog.

If any of you run through this, something that caught me out was not setting the Body XPath attribute on the schema designated as your envelope. This attribute, which is found in the Parse section of the your desired route node tells BizTalk where to start looping for child messages. So if you need to go three or four layers deep before you want to start looping you can get around having to create an intermediary schema by using this. If you don't set this property it is very unlikely that the debatching process will work for you.

Thursday, May 17, 2007

Windows Server 2003 Resource Kit Tools

In case any of you do not have this package, do yourself a favour and download it. Essential!

Wednesday, April 04, 2007

Web Services- ASP.Net and Credentials

I have noticed a lot of people getting stuck on some fairly basic stuff when working with ASP.NET web services. Like a lot of things in development, security can quite often trip us up.

If you have configured your ASP.NET web service to use integrated access via IIS you may be experiencing some difficulties in accessing a web service on a corporate intranet. If you are getting the message "Access denied" you most likely have not set the authentication credentials on your web service before making a call to one of its web methods.

Assuming you have an instantiated web service object called ws for our purposes, implement the following code:


This tells the web service who is trying to access it. By default the Credential property is set to null, meaning no credentials are sent through.

Wednesday, March 14, 2007

xsd Command line tool for Visual Studio

There is a perhaps quite underutilized command line tool available for Visual Studio. It is called xsd.exe and is installed in most typical configurations of Visual Studio 2005 (and 2003 for that matter). To use it, simply open a Visual Studio 2005 Command Prompt window (from the Visual Studio -> Visual Studio Tools folder in the start menu). Alternatively you can open the folder C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin substituting your custom install path if necessary.

It is capable of a number of quite useful operations including:

1) The ability to generate XSD schema files from XML files. The syntax for that is simply:
xsd %1
Where %1 is the name of the xml file. This will generate an xsd with the same filename as the xml except with an xsd extension.

2) You can generate sub classed datasets via this method:
xsd %1 /d
Where %1 is the xsd file. This will output similary named class files that provide custom datasets based on the schema provided. The smart bit about this is that hidden primary and foreign keys are added to the dataset transparently. The reason why this is so smart is that is provides a means for you to programatically link nested elements to parent elements. When a typical command like:
MyDataSet.WriteXML(@"c:\out.xml"); or
the Xml generated adheres to the schema provided during your xsd output. For some of you this may be pretty straight forward but I know some, including myself, who it took a while to figure out how this all fits together.

3) You can also generate classes for the objects, which is probably less useful, but handy for those wanting assistance to quickly create business objects for large schemas. The way to do this is:
xsd %1 /c
The %1 parameter being the xsd schema file.

4) Another useful operation for this command line utility is the ability to convert xdr to xsd. This can sometimes save a lot of effort! To do this:
xsd %1
The parameter %1 being the name of the xdr file (which must have an .xdr extension!).

Note that by default the classes (and dataset classes) that are generated output as c #. You can alter which language these output in by using the /language (or /l) switch. The possibilities are CS (C#), VB, JS, VJS or CPP. You can also instead "provide a name for a fully qualified class implementing System.CodeDom.Compiler.CodeDomProvider". This will let you output in your favourite niche langauge (anyone for IronPython or perhaps even f#?).

There are a bunch of other cool things this utility can achieve but I shall leave the exploration to you.

ASP.NET Label Control Aligning Text

A fellow developer at work today was struggling to find away to perform what should be a fairly simple task. He was attempting to align some text in an asp:label control to the right. As their is no extremely obvious align like property some confusion resulted. After a quick bit of research and trial and error we worked it out.

1) Make sure the asp:label has a fixed width. This way aligning to the right is actually meaningful.

2) In your page_load or other relevant code section insert a piece of code similar to the following:
Label1.Style.Add("text-align", "right");

note that this can also be accessed like so:
Label1.Attributes.CssStyle.Add("text-align", "right");

The attributes element is also worth exploring for your own research, it can provide an enumerator for all keys associated with the current control.