<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5274981767425509778</id><updated>2011-09-20T01:35:49.214+02:00</updated><category term='Threading'/><category term='LINQ'/><category term='Scalar Function'/><category term='Windows Vista'/><category term='Sharepoint 2007'/><category term='Certification'/><category term='Web Services'/><category term='Visual Studio 2005'/><category term='SQL Server'/><category term='BizTalk'/><category term='ClickOnce'/><category term='Windows'/><category term='Oracle'/><category term='Reporting Services'/><category term='ASP.NET'/><category term='ADO.NET'/><category term='Visual Studio 2008'/><category term='.NET 1x'/><category term='Tools'/><category term='Office 2007'/><category term='User Control'/><category term='Book'/><category term='JavaScript'/><category term='WinForms'/><category term='Tips and Tricks'/><category term='.NET 2.0'/><category term='Applet'/><category term='.NET 3.5'/><category term='Quiz'/><title type='text'>Geert Verhoeven</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>47</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-995663091274405734</id><published>2010-06-25T16:50:00.003+02:00</published><updated>2010-06-25T17:03:45.046+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='BizTalk'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>BizTalk &amp; SQL Server 2008 R2 not compatible</title><content type='html'>Apparently SQL Server 2008 R2 is not verry nice for BizTalk 2009. From the moment that you run the configuration for BizTalk, it gets stuck at the configure "Group" step.&lt;br /&gt;&lt;br /&gt;The log file shows an unmeaningfull error:&lt;br /&gt;Message: Failed to create Management database "BizTalkMgmtDb" on server "...".&lt;br /&gt;Errorcode: 0x80040E1D&lt;br /&gt;&lt;br /&gt;After googling a bit I found the following discussion (&lt;a href="http://social.msdn.microsoft.com/Forums/en-US/biztalkgeneral/thread/01161388-fc0b-41ec-9c10-1f4b11a577f0"&gt;link&lt;/a&gt;) which gives a meaning to the error.&lt;br /&gt;&lt;br /&gt;Conclusion: wait until BizTalk 2010 or revert your SQL Server to SQL 2008 or earlier.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-995663091274405734?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/995663091274405734/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=995663091274405734' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/995663091274405734'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/995663091274405734'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2010/06/biztalk-sql-server-2008-r2-not.html' title='BizTalk &amp; SQL Server 2008 R2 not compatible'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-5628922906368283441</id><published>2008-06-03T21:45:00.000+02:00</published><updated>2008-07-03T09:09:31.608+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Adding references - WebSite versus WebApplication</title><content type='html'>On my current project I’m creating an ASP.NET site in Visual Studio 2005 SP1.&lt;br /&gt;&lt;br /&gt;NOTE: By default, Visual Studio 2005 only allows you to create ASP.NET sites by using the WebSite template but after installing SP1, you can also use the WebApplication template.&lt;br /&gt;&lt;br /&gt;For this project we are using the WebSite template since this is the customer’s standard. While developing the application, I noticed that when using the WebSite template, the Add Reference works differently then when using the WebApplication template.&lt;br /&gt;&lt;br /&gt;When adding a reference to dll A using the WebSite template, Visual Studio automatically adds a reference to all dll’s that dll A references. This is done to ease the deployment but it can give some unwanted side effects.&lt;br /&gt;&lt;br /&gt;To make this clearer, I’ve created a simple solution structure that shows this issue. In the image on the left, you can see 4 projects:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_DMJte_aP-lA/SGx2QnAs2vI/AAAAAAAAAJI/hyyi7FqqGPc/s1600-h/Solution+Explorer.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5218676095937469170" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://1.bp.blogspot.com/_DMJte_aP-lA/SGx2QnAs2vI/AAAAAAAAAJI/hyyi7FqqGPc/s400/Solution+Explorer.JPG" border="0" /&gt;&lt;/a&gt; &lt;div style="FLOAT: left"&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;DalLib&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;BllLib: contains a link to DalLib&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;WebSite: project using the WebSite template; contains a link to BllLib&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;WebApplication: project using the WebApplication template; contains a link to BllLib&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style="CLEAR: both"&gt;&lt;p&gt;When you compile this solution, you will notice that the Visual Studio will add the DalLib to the bin folder of the WebSite project. Because of this, you gain access to all the public classes within DalLib from the WebSite. Since I want to avoid direct access from UI to Dal, this is not what I want. When using the WebApplication template, you don’t have this problem.&lt;/p&gt;&lt;p&gt;A possible solution is to make the classes within the DalLib internal and set an InternalsVisible attribute in the AssemblyInfo.cs file of the DalLib (thanks Gert for the tip). &lt;p&gt;&lt;a href="http://2.bp.blogspot.com/_DMJte_aP-lA/SGx3LcR-flI/AAAAAAAAAJQ/cjGJ0QD_VRQ/s1600-h/Attribute.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5218677106669420114" style="CURSOR: hand" alt="" src="http://2.bp.blogspot.com/_DMJte_aP-lA/SGx3LcR-flI/AAAAAAAAAJQ/cjGJ0QD_VRQ/s400/Attribute.JPG" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;p&gt;InternalsVisible is a new attribute from.NET 2.0 and is defined in the System.Runtime.CompilerServices namespace.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-5628922906368283441?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/5628922906368283441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=5628922906368283441' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/5628922906368283441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/5628922906368283441'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2008/06/adding-references-website-versus.html' title='Adding references - WebSite versus WebApplication'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_DMJte_aP-lA/SGx2QnAs2vI/AAAAAAAAAJI/hyyi7FqqGPc/s72-c/Solution+Explorer.JPG' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-5621276623035995761</id><published>2008-03-26T20:40:00.001+01:00</published><updated>2008-03-26T20:53:01.072+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips and Tricks'/><title type='text'>Vertical split view in Visual Studio 2008</title><content type='html'>Just noticed that in Visual Studio 2008 it is possible to change the split screen behavior.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Visual Studio allows you to set the default view (Split, Source or Design) and to choose between a horizontal split and a vertical split. Especially this last option is very handy when you have a widescreen monitor.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;To change the settings, go to &lt;strong&gt;Tools\Options\Html Designer&lt;/strong&gt;&lt;/p&gt;&lt;a href="http://1.bp.blogspot.com/_DMJte_aP-lA/R-qpcZ6TOdI/AAAAAAAAAJA/hDeeUvJKga4/s1600-h/Untitled.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5182140626700024274" style="CURSOR: hand" alt="" src="http://1.bp.blogspot.com/_DMJte_aP-lA/R-qpcZ6TOdI/AAAAAAAAAJA/hDeeUvJKga4/s400/Untitled.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-5621276623035995761?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/5621276623035995761/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=5621276623035995761' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/5621276623035995761'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/5621276623035995761'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2008/03/vertical-split-view-in-visual-studio_26.html' title='Vertical split view in Visual Studio 2008'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_DMJte_aP-lA/R-qpcZ6TOdI/AAAAAAAAAJA/hDeeUvJKga4/s72-c/Untitled.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-7621360938721965550</id><published>2008-02-08T15:46:00.001+01:00</published><updated>2008-02-08T15:57:28.098+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Quiz'/><title type='text'>Quiz 1: Generic class with static fields</title><content type='html'>&lt;p&gt;In the following piece of code you can see 2 instantiations of a generic class. What is the output of this console application?&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:F2210F5F-69EB-4d4c-AFF7-B8A050E9CC72:d0460669-0da7-48e0-9691-2e9712db37fe" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; width: 472px; padding-top: 0px"&gt;&lt;pre  style="width:100%;;"&gt;&lt;div&gt;&lt;!--&lt;br /&gt;&lt;br /&gt;Code highlighting produced by Actipro CodeHighlighter (freeware)&lt;br /&gt;http://www.CodeHighlighter.com/&lt;br /&gt;&lt;br /&gt;--&gt;&lt;span style="color: #0000FF;"&gt;using&lt;/span&gt;&lt;span style="color: #000000;"&gt; System;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;using&lt;/span&gt;&lt;span style="color: #000000;"&gt; System.Collections.Generic;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;namespace&lt;/span&gt;&lt;span style="color: #000000;"&gt; DEMO&lt;br /&gt;{&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;class&lt;/span&gt;&lt;span style="color: #000000;"&gt; Program&lt;br /&gt;    {&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;static&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;void&lt;/span&gt;&lt;span style="color: #000000;"&gt; Main(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;string&lt;/span&gt;&lt;span style="color: #000000;"&gt;[] args)&lt;br /&gt;        {&lt;br /&gt;            GenClass&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;int&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt; x &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;new&lt;/span&gt;&lt;span style="color: #000000;"&gt; GenClass&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;int&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;();&lt;br /&gt;            GenClass&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;double&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt; y &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;new&lt;/span&gt;&lt;span style="color: #000000;"&gt; GenClass&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;double&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;();&lt;br /&gt;&lt;br /&gt;            x.Add(&lt;/span&gt;&lt;span style="color: #800080;"&gt;1&lt;/span&gt;&lt;span style="color: #000000;"&gt;);&lt;br /&gt;            y.Add(&lt;/span&gt;&lt;span style="color: #800080;"&gt;2&lt;/span&gt;&lt;span style="color: #000000;"&gt;);&lt;br /&gt;&lt;br /&gt;            Console.WriteLine(y.Get(&lt;/span&gt;&lt;span style="color: #800080;"&gt;0&lt;/span&gt;&lt;span style="color: #000000;"&gt;));&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;public&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;class&lt;/span&gt;&lt;span style="color: #000000;"&gt; GenClass&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;T&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;        {&lt;br /&gt;            &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;public&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;static&lt;/span&gt;&lt;span style="color: #000000;"&gt; List&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;T&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt; list &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;new&lt;/span&gt;&lt;span style="color: #000000;"&gt; List&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;T&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;();&lt;br /&gt;&lt;br /&gt;            &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;public&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;void&lt;/span&gt;&lt;span style="color: #000000;"&gt; Add(T x)&lt;br /&gt;            {&lt;br /&gt;                list.Add(x);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;public&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;string&lt;/span&gt;&lt;span style="color: #000000;"&gt; Get(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;int&lt;/span&gt;&lt;span style="color: #000000;"&gt; index)&lt;br /&gt;            {&lt;br /&gt;                &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;return&lt;/span&gt;&lt;span style="color: #000000;"&gt; list[index].ToString();&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I'll post the response in a comment.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-7621360938721965550?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/7621360938721965550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=7621360938721965550' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/7621360938721965550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/7621360938721965550'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2008/02/quiz-1-generic-class-with-static-fields.html' title='Quiz 1: Generic class with static fields'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-4445455911003149385</id><published>2008-01-27T16:23:00.001+01:00</published><updated>2008-01-27T16:45:28.889+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET 3.5'/><title type='text'>Anonymous types and equality</title><content type='html'>&lt;strong&gt;Introduction to anonymous types&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;Most of the applications created in .NET contain classes defined by the developer. There are two types of classes. First you have the type that only contains fields and is used to transfer data, then you have a second type that also provides functionality to the application by implementing logic in methods, events, ... . &lt;br /&gt;  &lt;br /&gt;As from the .NET 3.5 framework, Microsoft has added anonymous types. Anonymous types that are created dynamically at compile time. &lt;br /&gt;  &lt;br /&gt;With anonymous types, the developer no longer has to define the type structure. Sounds great doesn't it. Although there are some limitations. For example, anonymous types can only be used as local variables. This means that the definition of a type is only valid within a single method. It is possible to pass instances of an anonymous type between methods but then the parameter of the receiving method should be of type object which is mostly not a best practice and difficult to work with. &lt;br /&gt;  &lt;br /&gt;This limits the use of anonymous types. As for most of the .NET 3.5 language enhancements, anonymous types are implemented to be able to support Linq. &lt;br /&gt;  &lt;br /&gt;To create an anonymous type, you need to use the &lt;strong&gt;var&lt;/strong&gt; keyword in combination with the new object initialization syntax (also one of the .NET 3.5 language enhancements). &lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Sample&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;In the following sample, I'll show you how to create an anonymous type as well as how an anonymous type behaves when using equality methods. &lt;/p&gt;&lt;br /&gt;&lt;div class="wlWriterEditableSmartContent" id="scid:F2210F5F-69EB-4d4c-AFF7-B8A050E9CC72:45a990a1-2234-494c-97c9-2c92258b35a0" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; width: 477px; padding-top: 0px"&gt;&lt;pre  style="width:100%;;"&gt;&lt;div&gt;&lt;!--&lt;br /&gt;&lt;br /&gt;Code highlighting produced by Actipro CodeHighlighter (freeware)&lt;br /&gt;http://www.CodeHighlighter.com/&lt;br /&gt;&lt;br /&gt;--&gt;&lt;span style="color: #0000FF;"&gt;using&lt;/span&gt;&lt;span style="color: #000000;"&gt; System;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;class&lt;/span&gt;&lt;span style="color: #000000;"&gt; Program&lt;br /&gt;{&lt;br /&gt;   &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;static&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;void&lt;/span&gt;&lt;span style="color: #000000;"&gt; Main(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;string&lt;/span&gt;&lt;span style="color: #000000;"&gt;[] args)&lt;br /&gt;   {&lt;br /&gt;      &lt;/span&gt;&lt;span style="color: #008000;"&gt;//&lt;/span&gt;&lt;span style="color: #008000;"&gt; Creation of an anonymous type&lt;/span&gt;&lt;span style="color: #008000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;      var p1 &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;new&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;      {&lt;br /&gt;         FirstName &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;Geert&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;,&lt;br /&gt;         LastName &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;Verhoeven&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;,&lt;br /&gt;         Age &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #800080;"&gt;26&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;      };&lt;br /&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span style="color: #008000;"&gt;//&lt;/span&gt;&lt;span style="color: #008000;"&gt; Error: &lt;br /&gt;      &lt;/span&gt;&lt;span style="color: #008000;"&gt;//&lt;/span&gt;&lt;span style="color: #008000;"&gt; Property or indexer 'AnonymousType#1.Age' &lt;br /&gt;      &lt;/span&gt;&lt;span style="color: #008000;"&gt;//&lt;/span&gt;&lt;span style="color: #008000;"&gt; cannot be assigned to -- it is read only    &lt;br /&gt;      &lt;/span&gt;&lt;span style="color: #008000;"&gt;//&lt;/span&gt;&lt;span style="color: #008000;"&gt; p1.Age = 27;&lt;/span&gt;&lt;span style="color: #008000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;      Console.WriteLine(p1.ToString());&lt;br /&gt;&lt;br /&gt;      var p2 &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;new&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;      {&lt;br /&gt;         FirstName &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;Geert&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;,&lt;br /&gt;         LastName &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;Verhoeven&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;,&lt;br /&gt;         Age &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #800080;"&gt;26&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;      };      &lt;br /&gt;&lt;br /&gt;      var p3 &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; p1;&lt;br /&gt;      &lt;br /&gt;      &lt;/span&gt;&lt;span style="color: #008000;"&gt;//&lt;/span&gt;&lt;span style="color: #008000;"&gt; Comparison based on the == method.&lt;/span&gt;&lt;span style="color: #008000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;      Console.WriteLine(&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;person1 == person2: {0}&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;,&lt;br /&gt;          p1 &lt;/span&gt;&lt;span style="color: #000000;"&gt;==&lt;/span&gt;&lt;span style="color: #000000;"&gt; p2);&lt;br /&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span style="color: #008000;"&gt;//&lt;/span&gt;&lt;span style="color: #008000;"&gt; Comparison based on the equals method.&lt;/span&gt;&lt;span style="color: #008000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;      Console.WriteLine(&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;person1.Equals(person2): {0}&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;,&lt;br /&gt;          p1.Equals(p2));&lt;br /&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span style="color: #008000;"&gt;//&lt;/span&gt;&lt;span style="color: #008000;"&gt; Comparison based on the == method.&lt;/span&gt;&lt;span style="color: #008000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;      Console.WriteLine(&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;person1 == person3: {0}&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;,&lt;br /&gt;          p1 &lt;/span&gt;&lt;span style="color: #000000;"&gt;==&lt;/span&gt;&lt;span style="color: #000000;"&gt; p3);&lt;br /&gt;   }&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Output:&lt;a href="http://4.bp.blogspot.com/_DMJte_aP-lA/R5yiQ3ym-ZI/AAAAAAAAAIo/471hY0-Ucvg/s1600-h/Output.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5160177683797571986" style="cursor: hand" alt="" src="http://4.bp.blogspot.com/_DMJte_aP-lA/R5yiQ3ym-ZI/AAAAAAAAAIo/471hY0-Ucvg/s400/Output.jpg" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;There are some important things to note when looking at this output. &lt;br /&gt;  &lt;br /&gt;At first, if you look at the result of the ToString() method, you can see that the behavior is different then with normal types. By default, when not overridden, the ToString() method returns the&amp;#160; types fullname. This means that an anonymous type has an override for the ToString() method. &lt;br /&gt;  &lt;br /&gt;Secondly, the Equals method behaves differently as well. When not overridden, the Equals method checks whether 2 objects refer to the same memory object. This means that the anonymous type for the Equals method as well. &lt;br /&gt;  &lt;br /&gt;The == operator still acts the same as with normal objects. From these results we can conclude that when using the Equals method, an anonymous types acts like a value type. When using the == operator, the anonymous type acts like a reference type. &lt;br /&gt;  &lt;br /&gt;Now how is this possible since we didn't write any code for these overrides? When opening the assembly with a tool like Reflector, we can see the structure of the generated anonymous type and see that the compiler did this for us.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="wlWriterEditableSmartContent" id="scid:F2210F5F-69EB-4d4c-AFF7-B8A050E9CC72:52c14ea0-1b0b-4536-946b-a89437d18fc5" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; width: 472px; padding-top: 0px"&gt;&lt;pre  style="width:100%;;"&gt;&lt;div&gt;&lt;!--&lt;br /&gt;&lt;br /&gt;Code highlighting produced by Actipro CodeHighlighter (freeware)&lt;br /&gt;http://www.CodeHighlighter.com/&lt;br /&gt;&lt;br /&gt;--&gt;&lt;span style="color: #0000FF;"&gt;internal&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;sealed&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;class&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;f__AnonymousType0&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;FirstName&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;j__TPar, &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;LastName&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;j__TPar, &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;Age&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;j__TPar&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;{&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;private&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;readonly&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;Age&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;j__TPar &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;Age&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;i__Field;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;private&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;readonly&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;FirstName&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;j__TPar &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;FirstName&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;i__Field;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;private&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;readonly&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;LastName&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;j__TPar &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;LastName&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;i__Field;&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;public&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;f__AnonymousType0(&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;FirstName&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;j__TPar FirstName, &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;LastName&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;j__TPar LastName, &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;Age&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;j__TPar Age);&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;public&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;override&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;bool&lt;/span&gt;&lt;span style="color: #000000;"&gt; Equals(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;object&lt;/span&gt;&lt;span style="color: #000000;"&gt; value);&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;public&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;override&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;int&lt;/span&gt;&lt;span style="color: #000000;"&gt; GetHashCode();&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;public&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;override&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;string&lt;/span&gt;&lt;span style="color: #000000;"&gt; ToString();&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;public&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;Age&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;j__TPar Age { &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;get&lt;/span&gt;&lt;span style="color: #000000;"&gt;; }&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;public&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;FirstName&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;j__TPar FirstName { &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;get&lt;/span&gt;&lt;span style="color: #000000;"&gt;; }&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;public&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;LastName&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;j__TPar LastName { &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;get&lt;/span&gt;&lt;span style="color: #000000;"&gt;; }&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-4445455911003149385?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/4445455911003149385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=4445455911003149385' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/4445455911003149385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/4445455911003149385'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2008/01/anonymous-types-and-equality.html' title='Anonymous types and equality'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_DMJte_aP-lA/R5yiQ3ym-ZI/AAAAAAAAAIo/471hY0-Ucvg/s72-c/Output.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-6571773340096158215</id><published>2008-01-17T23:17:00.001+01:00</published><updated>2008-01-18T14:06:20.570+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET 3.5'/><title type='text'>Strange behavior with extension methods</title><content type='html'>&lt;p&gt;In a previous post, I already explained what extension methods are and how they work. While doing some tests, I noticed a strange behavior which I will explain in this post.&lt;/p&gt;&lt;p&gt;The order in which .NET searches for the method to be executed is as follow:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Instance methods of the class &lt;/li&gt;&lt;li&gt;Static methods within the class &lt;/li&gt;&lt;li&gt;Extension methods specified for the class &lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Because the static methods have a higher priority then the extension methods, this can give strange behavior.&lt;/p&gt;&lt;p&gt;In the following sample, the goal is to create an extension method that enables making comparisons on DateTime objects on different levels. The comparison level allows you for example to only compare until the month and not use the day/time while doing the comparison.&lt;/p&gt;&lt;div class="wlWriterEditableSmartContent" id="scid:F2210F5F-69EB-4d4c-AFF7-B8A050E9CC72:03e8a33e-9389-4b8d-b28c-9698755c245b" style="margin: 0px; padding: 0px; display: inline; float: none;"&gt;&lt;pre style="width: 100%;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; System;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; System.Collections.Generic;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Program&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;   static&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Main(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;[] args)&lt;br /&gt;{&lt;br /&gt;   DateTime d1 &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DateTime(&lt;/span&gt;&lt;span style="color: rgb(128, 0, 128);"&gt;2008&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(128, 0, 128);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(128, 0, 128);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;);&lt;br /&gt;   DateTime d2 &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DateTime(&lt;/span&gt;&lt;span style="color: rgb(128, 0, 128);"&gt;2008&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(128, 0, 128);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(128, 0, 128);"&gt;10&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;      //&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt; Compile time error:&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;      //&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt; Member 'object.Equals(object, object)'&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;      //&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt; cannot be accessed with an instance&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;      //&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt; reference; qualify it with a type&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;      //&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt; name instead &lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;      d1.Equals(d2, DateComparisonLevel.Month);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;enum&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DateComparisonLevel&lt;br /&gt;{&lt;br /&gt;Year,&lt;br /&gt;Month&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; MyUtils&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;   public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;bool&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Equals(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DateTime orgDate,&lt;br /&gt;     DateTime compDate, DateComparisonLevel level)&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;      switch&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; (level)&lt;br /&gt;   {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;         case&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DateComparisonLevel.Year:&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;            return&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; orgDate.Date.Equals(&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;                      new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DateTime(&lt;br /&gt;                       compDate.Year,&lt;br /&gt;                       orgDate.Month,&lt;br /&gt;                       orgDate.Day));&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;         case&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DateComparisonLevel.Month:&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;            return&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; orgDate.Date.Equals(&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;                      new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DateTime(&lt;br /&gt;                       compDate.Year,&lt;br /&gt;                       compDate.Month,&lt;br /&gt;                       orgDate.Day));&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;      return&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;false&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;;&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When trying to compile this code, you will receive a compile time error on the following line:&lt;/p&gt;&lt;div class="wlWriterSmartContent" id="scid:F2210F5F-69EB-4d4c-AFF7-B8A050E9CC72:3710d131-12de-4631-b6be-e2f6b4919014" style="margin: 0px; padding: 0px; display: inline; float: none;"&gt;&lt;pre style="width: 100%;"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;d1.Equals(d2, DateComparisonLevel.Month);&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Error:&lt;/p&gt;&lt;p&gt;&lt;span style="color: rgb(102, 102, 102);font-size:85%;" &gt;Member 'object.Equals(object, object)' cannot be accessed with an instance reference; qualify it with a type name instead.&lt;/span&gt; &lt;/p&gt;&lt;p&gt;This is because DateTime derives from System.Object. Since System.Object contains a method with definition &lt;/p&gt;&lt;pre&gt;public static &lt;a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Boolean"&gt;bool&lt;/a&gt; &lt;b&gt;&lt;a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Object/Equals%28Object,Object%29:Boolean"&gt;Equals&lt;/a&gt;&lt;/b&gt;(&lt;a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Object"&gt;object&lt;/a&gt; objA, &lt;a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Object"&gt;object&lt;/a&gt; objB);&lt;/pre&gt;&lt;p&gt;the compiler takes this method in case of the extension method. Since the method of the System.Object class is a static method, it can not be called from an instance of an object. The only way to solve this is to rename the Equals method in the code. This way, the Object.Equals method will no longer interfer.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Microsoft considers this as a bug.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-6571773340096158215?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/6571773340096158215/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=6571773340096158215' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/6571773340096158215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/6571773340096158215'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2008/01/strange-behavior-with-extension-methods.html' title='Strange behavior with extension methods'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-4433988354652615528</id><published>2008-01-17T23:03:00.001+01:00</published><updated>2008-01-18T10:03:54.994+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET 3.5'/><title type='text'>Introduction to extension methods</title><content type='html'>&lt;p&gt;&lt;strong&gt;What it is&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Extension methods allow you to extend an existing type without needing access to the type's code. Before .NET 3.5, this wasn't possible without having access to the type's code or without using the System.Reflection.Emit namespace.&lt;/p&gt;&lt;p&gt;In short, extension methods are static methods that can be executed by instances of the extended object. Behind the scenes, the call to the extension method is nothing more then a call to a static method.&lt;/p&gt;&lt;p&gt;Behind the scenes, extension methods are marked with the System.Runtime.CompilerServices.ExtensionAttribute which is located in the Systme.Core.dll. So a reference to this DLL is necessary in order to create extension methods.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;When to use&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;If you have a class that you want to extend but you don't have the source code, extension methods can be an answer. Also when extending a class with extension methods, you don't have the risk of breaking existing code which you can have when changing the type's definition.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Simple sample&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;In this sample, I'm adding a method IsWeekend to the DateTime type which will return a boolean to indicate whether a given date falls in the weekend or not.&lt;/p&gt;&lt;br /&gt;&lt;div class="wlWriterEditableSmartContent" id="scid:F2210F5F-69EB-4d4c-AFF7-B8A050E9CC72:a96cc94a-0129-425e-b8ea-e468e9c5ef9c" style="margin: 0px; padding: 0px; display: inline; float: none; width: 474px;"&gt;&lt;pre style="width: 100%;"&gt;&lt;div&gt;&lt;!--  Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/  --&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; System;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Program&lt;br /&gt;{&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Main(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;[] args)&lt;br /&gt;  {&lt;br /&gt;      &lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;//&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt; Tuesday&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;        DateTime d1 &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DateTime(&lt;/span&gt;&lt;span style="color: rgb(128, 0, 128);"&gt;2008&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(128, 0, 128);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(128, 0, 128);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;);&lt;br /&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;//&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt; Saturday&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;        DateTime d2 &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DateTime(&lt;/span&gt;&lt;span style="color: rgb(128, 0, 128);"&gt;2008&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(128, 0, 128);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(128, 0, 128);"&gt;5&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;); &lt;br /&gt;&lt;br /&gt;      Console.WriteLine(&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;{0:d} is weekend: {1}&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;,&lt;br /&gt;                          d1, d1.IsWeekend());&lt;br /&gt;      Console.WriteLine(&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;{0:d} is weekend: {1}&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;,&lt;br /&gt;                          d2, d2.IsWeekend());&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; MyUtils&lt;br /&gt;{&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;bool&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; IsWeekend(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DateTime date)&lt;br /&gt;  {&lt;br /&gt;      &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; (date.DayOfWeek &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;==&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DayOfWeek.Saturday&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;||&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; date.DayOfWeek &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;==&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DayOfWeek.Sunday);&lt;br /&gt;  }&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Extension methods must be created within a static class (each method within the class must be static as well). The first parameter of the method is marked with the &lt;strong&gt;this&lt;/strong&gt; keyword and indicates the type to which the method should be applied (in this case DateTime). It is possible to add multiple parameters. Only the parameters after the first parameter, should be provided when using the method.&lt;/p&gt;&lt;p&gt;When you've implemented an extension method for a specific type, you will see that it is showed by intellisense with a specific icon.&lt;/p&gt;&lt;a href="http://2.bp.blogspot.com/_DMJte_aP-lA/R4_SqmgaQCI/AAAAAAAAAIg/Qt52uWQo6A8/s1600-h/Screen+1+-+Intellisense.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5156571727695331362" style="" alt="" src="http://2.bp.blogspot.com/_DMJte_aP-lA/R4_SqmgaQCI/AAAAAAAAAIg/Qt52uWQo6A8/s400/Screen+1+-+Intellisense.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;It is possible to create a separate assembly with all your extension methods. Note that you need to add using statements for the namespaces where the extension methods are located.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-4433988354652615528?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/4433988354652615528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=4433988354652615528' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/4433988354652615528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/4433988354652615528'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2008/01/introduction-to-extension-methods.html' title='Introduction to extension methods'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_DMJte_aP-lA/R4_SqmgaQCI/AAAAAAAAAIg/Qt52uWQo6A8/s72-c/Screen+1+-+Intellisense.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-3926415762876276780</id><published>2007-12-26T11:03:00.000+01:00</published><updated>2008-01-03T08:07:51.695+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips and Tricks'/><title type='text'>Installation issues with Windows Live Writer when using a corporate proxy server</title><content type='html'>When installing Windows Live Writer on a machine that is connected via a corporate proxy to the internet can be a real pain. Since the installer is downloading .exe files, the files can be blocked.&lt;br /&gt;&lt;br /&gt;Today I've found this &lt;a href="http://weblogs.asp.net/rachit/archive/2007/12/20/windows-live-writer-2008-on-corporate-machine.aspx"&gt;blog post&lt;/a&gt; which shows a way to install the Windows Live tools on a corporate machine.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-3926415762876276780?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/3926415762876276780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=3926415762876276780' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/3926415762876276780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/3926415762876276780'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/12/installation-issues-with-windows-live.html' title='Installation issues with Windows Live Writer when using a corporate proxy server'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-7482413094882011590</id><published>2007-11-21T08:40:00.000+01:00</published><updated>2007-11-21T09:03:28.117+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2008'/><title type='text'>Visual Studio 2008 available</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;For those of you who didn't know yet, Visual Studio 2008 is available since a few days.&lt;br /&gt;&lt;br /&gt;MSDN Subscribers can download the full version where as others can download a 90-day trial.&lt;br /&gt;&lt;/span&gt;&lt;a href="http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx"&gt;&lt;span style="font-family:trebuchet ms;"&gt;http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Yesterday I've been able to install it on a Windows XP SP2 machine without any problems. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;NOTE: When opening a solution or project file created in a previous version, an upgrade wizard will be launched. If you upgrade your project, you can not open it any more with the previous version.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-7482413094882011590?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/7482413094882011590/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=7482413094882011590' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/7482413094882011590'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/7482413094882011590'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/11/visual-studio-2008-available.html' title='Visual Studio 2008 available'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-3194823638968024317</id><published>2007-10-04T18:52:00.000+02:00</published><updated>2007-10-04T20:15:34.364+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips and Tricks'/><title type='text'>Firefox's "functionality" to show your saved passwords in clear text</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;While making a joke about Firefox, I noticed that a lot of people don't know that Firefox has a functionality that makes it possible to show your saved passwords. This can be handy for you whenever you forget one but also very handy for someone who uses your pc with the same account.&lt;br /&gt;&lt;br /&gt;Before judging, I must say this password manager can be disabled or secured but by default it is enabled without security. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;h4&gt;The problem&lt;/h4&gt;If you browse to a site that requires you to sign in with name and password (for example &lt;a href="http://www.gmail.com/"&gt;http://www.gmail.com/&lt;/a&gt;), Firefox will give you the possibility to save your password as in IE. &lt;a href="http://2.bp.blogspot.com/_DMJte_aP-lA/RwS4_ClzlsI/AAAAAAAAAHY/-u98a3Janu8/s1600-h/1.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5117418469766436546" style="CURSOR: hand" alt="" src="http://2.bp.blogspot.com/_DMJte_aP-lA/RwS4_ClzlsI/AAAAAAAAAHY/-u98a3Janu8/s400/1.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;However, with Firefox it is possible to actually see the passwords in clear text. This is how to do it:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Go to Tools\Options and select the Security tab&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_DMJte_aP-lA/RwS5bSlzltI/AAAAAAAAAHg/ZIeErf7_g80/s1600-h/se.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5117418955097741010" style="CURSOR: hand" alt="" src="http://3.bp.blogspot.com/_DMJte_aP-lA/RwS5bSlzltI/AAAAAAAAAHg/ZIeErf7_g80/s400/se.JPG" border="0" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Click “Show Passwords”&lt;br /&gt;This will open a new screen and show you the sites and accounts; not the passwords.&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_DMJte_aP-lA/RwS5qClzluI/AAAAAAAAAHo/2fdjWPWFa0U/s1600-h/p.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5117419208500811490" style="CURSOR: hand" alt="" src="http://2.bp.blogspot.com/_DMJte_aP-lA/RwS5qClzluI/AAAAAAAAAHo/2fdjWPWFa0U/s400/p.JPG" border="0" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Click “Show Passwords” and choose “Yes” in the warning dialog (don’t do this when other people are standing next to you)&lt;br /&gt;&lt;br /&gt;This will add an additional column in the table which shows your passwords in clear text.&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_DMJte_aP-lA/RwS58ilzlvI/AAAAAAAAAHw/r1JnQLKz8Mk/s1600-h/p.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5117419526328391410" style="CURSOR: hand" alt="" src="http://4.bp.blogspot.com/_DMJte_aP-lA/RwS58ilzlvI/AAAAAAAAAHw/r1JnQLKz8Mk/s400/p.JPG" border="0" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;I think you understand that this can be dangerous! &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;h4&gt;The solution&lt;/h4&gt;As mentioned before, there is a way to disable (by unchecking the "Remember passwords for this site" option) or secure this.&lt;br /&gt;&lt;br /&gt;To secure this, Firefox uses a master passwords to access your saved passwords. You can do this by checking the “Use a master password” in the “Security” tab from the Options window. Firefox will ask you to enter a new password.&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_DMJte_aP-lA/RwS6JilzlwI/AAAAAAAAAH4/L7FjejMq24U/s1600-h/m.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5117419749666690818" style="CURSOR: hand" alt="" src="http://4.bp.blogspot.com/_DMJte_aP-lA/RwS6JilzlwI/AAAAAAAAAH4/L7FjejMq24U/s400/m.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The master password needs to be entered each time you want Firefox to use your saved passwords or to view the list of passwords.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-3194823638968024317?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/3194823638968024317/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=3194823638968024317' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/3194823638968024317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/3194823638968024317'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/10/firefox-reveals-your-passwords-in-clear.html' title='Firefox&apos;s &quot;functionality&quot; to show your saved passwords in clear text'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_DMJte_aP-lA/RwS4_ClzlsI/AAAAAAAAAHY/-u98a3Janu8/s72-c/1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-8396270798870488400</id><published>2007-09-21T16:44:00.001+02:00</published><updated>2007-09-25T07:37:35.863+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Implementing the IEquatable interface properly</title><content type='html'>I've posted an article on &lt;a href="http://www.codeproject.com/useritems/IEquatable.asp"&gt;CodeProject&lt;/a&gt; that illustrates why it is important to override the Object.Equals method when implementing the IEquatable interface.&lt;br /&gt;&lt;br /&gt;The article first explains when to use the IEquatable and how to do a proper implementation.&lt;br /&gt;&lt;br /&gt;If you have any questions or comments, feel free to post them.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-8396270798870488400?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/8396270798870488400/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=8396270798870488400' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/8396270798870488400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/8396270798870488400'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/09/implementing-iequatable-interface.html' title='Implementing the IEquatable interface properly'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-5119287938739603960</id><published>2007-09-10T19:40:00.000+02:00</published><updated>2007-09-11T07:46:00.307+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Certification'/><category scheme='http://www.blogger.com/atom/ns#' term='Book'/><title type='text'>Passed the 70-526 exam</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_DMJte_aP-lA/RuYqz6qUhhI/AAAAAAAAAHA/NBquABBp1Cw/s1600-h/9983.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5108817898706863634" style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="http://4.bp.blogspot.com/_DMJte_aP-lA/RuYqz6qUhhI/AAAAAAAAAHA/NBquABBp1Cw/s400/9983.gif" border="0" /&gt;&lt;/a&gt; &lt;span style="font-family:trebuchet ms;"&gt;Two weeks ago I've passed the MCTS exam for Windows Application (070-526). To study this exam I've used the &lt;a href="http://www.microsoft.com/MSPress/books/9983.aspx"&gt;MS PRESS&lt;/a&gt; book which helped me very good. The book explains the topics very well and contains good exercises. &lt;/span&gt;&lt;div&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;div&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:trebuchet ms;"&gt;Most of the questions where more or less discussed in the book. I did get a lot of questions on deployment and printing.&lt;br /&gt;&lt;br /&gt;After taking 2 weeks of I'm back on track for the next exam 70-548 (MCPD Windows Applications).&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-5119287938739603960?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/5119287938739603960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=5119287938739603960' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/5119287938739603960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/5119287938739603960'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/09/passed-70-526-exam.html' title='Passed the 70-526 exam'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_DMJte_aP-lA/RuYqz6qUhhI/AAAAAAAAAHA/NBquABBp1Cw/s72-c/9983.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-8632753674271293517</id><published>2007-08-20T21:47:00.001+02:00</published><updated>2007-08-20T21:51:20.983+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows Vista'/><title type='text'>How Windows Vista fills your disk</title><content type='html'>&lt;div&gt;&lt;p&gt;Recently I reinstalled my PC and installed Windows Vista on it. After using it for a month, I noticed that the free disk space was becoming very limited. In explorer the disk property showed me that I used 46GB but when I selected all my folders and retrieved the size, it was only 21GB. &lt;/p&gt;&lt;p&gt;So where did that 25GB go? Aparently it is the system restore utility (which uses shadow copies) that is happily using my free disk space. Especially on a laptop with limited disk space this is not funny. Opposed to Windows XP, Vista doesn't provide a graphical utility to manage the system restore memory settings. Although, there is a way to change these settings.&lt;/p&gt;&lt;p&gt;If you open a command prompt and type &lt;strong&gt;vssadmin list shadowstorage&lt;/strong&gt;, you can see the used space.&lt;/p&gt;&lt;a href="http://3.bp.blogspot.com/_DMJte_aP-lA/Rsnwa6qUhfI/AAAAAAAAAGw/3PKX5mKfp9E/s1600-h/Screen+1.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5100872398187824626" style="CURSOR: hand" alt="" src="http://3.bp.blogspot.com/_DMJte_aP-lA/Rsnwa6qUhfI/AAAAAAAAAGw/3PKX5mKfp9E/s400/Screen+1.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;To change the settings, you need to use the &lt;strong&gt;vssadmin resize shadowstorage /for=[disk_drive]: /on=[disk_drive]: /maxsize=[max_size]&lt;/strong&gt;. The sample below sets these settings on my machine to a maximum of 1GB:&lt;/p&gt;&lt;a href="http://2.bp.blogspot.com/_DMJte_aP-lA/RsnwhqqUhgI/AAAAAAAAAG4/0PllB3A-YPE/s1600-h/Vista+2.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5100872514151941634" style="CURSOR: hand" alt="" src="http://2.bp.blogspot.com/_DMJte_aP-lA/RsnwhqqUhgI/AAAAAAAAAG4/0PllB3A-YPE/s400/Vista+2.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;vssadmin resize shadowstorage /for=c: /on=c: /maxsize=1GB&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;References:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a title="http://blogs.technet.com/filecab/archive/2006/11/16/identifying-how-much-disk-space-is-used-for-restore-points-in-windows-vista.aspx" href="http://blogs.technet.com/filecab/archive/2006/11/16/identifying-how-much-disk-space-is-used-for-restore-points-in-windows-vista.aspx"&gt;http://blogs.technet.com/filecab/archive/2006/11/16/identifying-how-much-disk-space-is-used-for-restore-points-in-windows-vista.aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-8632753674271293517?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/8632753674271293517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=8632753674271293517' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/8632753674271293517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/8632753674271293517'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/08/how-windows-vista-fills-your-disk.html' title='How Windows Vista fills your disk'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_DMJte_aP-lA/Rsnwa6qUhfI/AAAAAAAAAGw/3PKX5mKfp9E/s72-c/Screen+1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-8164071288592821527</id><published>2007-08-06T21:37:00.001+02:00</published><updated>2007-08-06T21:40:14.376+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows Vista'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2005'/><title type='text'>"Upgrade patch can not be installed ..." while installing Visual Studio SP1 for Vista</title><content type='html'>To be able to use Visual Studio 2005 on a Windows Vista machine, you need to install a special service pack: (&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=90E2942D-3AD1-4873-A2EE-4ACC0AACE5B6&amp;displaylang=en"&gt;Visual Studio 2005 Service Pack 1 Update for Windows Vista&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;When starting the installation I received the following error:&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_DMJte_aP-lA/Rrd47P5h_CI/AAAAAAAAAGo/DYU2sAjoUvs/s1600-h/Windows+Installer+Error.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5095674462668454946" style="CURSOR: hand" alt="" src="http://3.bp.blogspot.com/_DMJte_aP-lA/Rrd47P5h_CI/AAAAAAAAAGo/DYU2sAjoUvs/s400/Windows+Installer+Error.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="color:#999999;"&gt;The upgrade patch cannot be installed by the Windows Installer service because the program to be upgraded may be missing, or the upgrade patch may update a different version of the program. Verify that the program to be upgraded exists on your computer and that you have the correct upgrade patch.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The service pack is searching for specific components that are not available. These components ship with the &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=BB4A75AB-E2D4-4C96-B39D-37BAF6B5B1DC&amp;amp;displaylang=en"&gt;standard SP1&lt;/a&gt;. So before installing the Vista specific service pack, you need to install the standard SP1.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-8164071288592821527?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/8164071288592821527/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=8164071288592821527' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/8164071288592821527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/8164071288592821527'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/08/patch-can-not-be-installed-while.html' title='&amp;quot;Upgrade patch can not be installed ...&amp;quot; while installing Visual Studio SP1 for Vista'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_DMJte_aP-lA/Rrd47P5h_CI/AAAAAAAAAGo/DYU2sAjoUvs/s72-c/Windows+Installer+Error.jpg' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-6116199574958793493</id><published>2007-08-06T21:25:00.001+02:00</published><updated>2007-08-06T21:41:03.686+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows Vista'/><category scheme='http://www.blogger.com/atom/ns#' term='Reporting Services'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>Reporting Services on a Vista machine</title><content type='html'>Since a while I have reinstalled my test pc to be able to experiment with the new Windows operating system. When trying to install Reporting Services 2005, the setup gave me the following warning:&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_DMJte_aP-lA/Rrd19f5h_AI/AAAAAAAAAGY/V9qa0kIlx7k/s1600-h/Configuration+Check.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5095671202788277250" style="CURSOR: hand" alt="" src="http://4.bp.blogspot.com/_DMJte_aP-lA/Rrd19f5h_AI/AAAAAAAAAGY/V9qa0kIlx7k/s400/Configuration+Check.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;a href="http://1.bp.blogspot.com/_DMJte_aP-lA/Rrd2Bv5h_BI/AAAAAAAAAGg/UlkyBOMQzsg/s1600-h/IIS+Feature+Requirement.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5095671275802721298" style="CURSOR: hand" alt="" src="http://1.bp.blogspot.com/_DMJte_aP-lA/Rrd2Bv5h_BI/AAAAAAAAAGg/UlkyBOMQzsg/s400/IIS+Feature+Requirement.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="color:#666666;"&gt;IIS Feature Requirement ...&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;It seems that Reporting Services can't find IIS although it is installed on my PC (note Vista has IIS 7).&lt;/p&gt;&lt;p&gt;After googling a while, I found the following article: &lt;a title="http://support.microsoft.com/kb/920201/en-us" href="http://support.microsoft.com/kb/920201/en-us"&gt;http://support.microsoft.com/kb/920201/en-us&lt;/a&gt;. Apparently it is necessary to install specific IIS 7 components in order to be able to install Reporting Services on a Vista machine. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-6116199574958793493?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/6116199574958793493/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=6116199574958793493' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/6116199574958793493'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/6116199574958793493'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/08/reporting-services-on-vista-machine.html' title='Reporting Services on a Vista machine'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_DMJte_aP-lA/Rrd19f5h_AI/AAAAAAAAAGY/V9qa0kIlx7k/s72-c/Configuration+Check.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-725880457898331785</id><published>2007-07-28T10:22:00.001+02:00</published><updated>2007-07-28T10:31:02.138+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Certification'/><category scheme='http://www.blogger.com/atom/ns#' term='Book'/><title type='text'>Passed the 70-536 exam</title><content type='html'>&lt;p&gt;Yesterday I've passed the &lt;a href="http://www.microsoft.com/learning/exams/70-536.mspx"&gt;70-536&lt;/a&gt; exam (TS: Microsoft .NET Framework 2.0—Application Development Foundation). &lt;/p&gt; &lt;p&gt;&lt;a href="http://www.microsoft.com/MSPress/books/9469.aspx" target="_blank" atomicselection="true"&gt;&lt;img height="101" src="http://www.microsoft.com/MSPress/books/imgt/9469.gif" width="101" align="right"&gt;&lt;/a&gt; &amp;nbsp;To study the exam I've used the &lt;a href="http://www.microsoft.com/MSPress/books/9469.aspx" target="_blank"&gt;Microsoft Training Kit&lt;/a&gt;. The book is easy to read and has good practices. It covers all the topics discussed in the exam. Sometimes not in so much details but that is normal I guess.&lt;/p&gt; &lt;p&gt;The next exam that I'm going to do is &lt;a href="http://www.microsoft.com/learning/exams/70-526.mspx"&gt;70-526&lt;/a&gt; (TS: Microsoft .NET Framework 2.0 – Windows-Based Client Development). I could have choosen for the upgrade exam (MCSD to MCPD) but I prefer to do the exams one by one. This gives me an extra review on things that I don't use that often.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-725880457898331785?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/725880457898331785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=725880457898331785' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/725880457898331785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/725880457898331785'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/07/passed-70-536-exam.html' title='Passed the 70-536 exam'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-5187973722221334418</id><published>2007-07-25T20:10:00.001+02:00</published><updated>2007-07-25T20:15:10.196+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips and Tricks'/><title type='text'>Windows Live Writer: creating blog entries in just a few seconds</title><content type='html'>In a &lt;a href="http://geertverhoeven.blogspot.com/2007/07/blogging-with-office-2007_17.html"&gt;previous&lt;/a&gt; post I've mentioned the possibilities of Word 2007 to create new blog entries. A &lt;a href="http://weblog.shaoken.be/"&gt;colleague&lt;/a&gt; of me informed me about a tool names Windows Live Writer which is a tool created by Microsoft to create blog entries. After testing it for a while, I'm now using Live Writer as my primary blogging tool. You can download it &lt;a href="http://born2code.net/go.php?http://download.microsoft.com/download/f/9/a/f9a19f2d-cec4-4a25-9b0b-eb9655ea7561/Writer.msi"&gt;here&lt;/a&gt; (currently in Beta).&lt;br /&gt;&lt;p&gt;Especially in combination with the free &lt;a href="http://www.istaysharp.net/index.php?title=SyntaxColor4Writer"&gt;SyntaxColor4Writer&lt;/a&gt; plug-in, creating posts that contains code is no longer a time consuming job. The plug-in allows you to add code to your blog without having to worry about the colors and formatting.&lt;/p&gt;&lt;p&gt;Currently it supports 20 different formats including C#, VB.NET, HTML, XML, SQL, ...&lt;/p&gt;&lt;a href="http://2.bp.blogspot.com/_DMJte_aP-lA/RqeSj_5h-_I/AAAAAAAAAGQ/IwC-kAoKdQA/s1600-h/ScreenShot.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5091199050911448050" style="CURSOR: hand" alt="" src="http://2.bp.blogspot.com/_DMJte_aP-lA/RqeSj_5h-_I/AAAAAAAAAGQ/IwC-kAoKdQA/s400/ScreenShot.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-5187973722221334418?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/5187973722221334418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=5187973722221334418' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/5187973722221334418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/5187973722221334418'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/07/windows-live-writer-creating-blog.html' title='Windows Live Writer: creating blog entries in just a few seconds'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_DMJte_aP-lA/RqeSj_5h-_I/AAAAAAAAAGQ/IwC-kAoKdQA/s72-c/ScreenShot.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-8513247236689214570</id><published>2007-07-25T19:17:00.000+02:00</published><updated>2007-07-25T14:27:34.317+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>Create a function that returns a table</title><content type='html'>In SQL Server it is easy to create a function that returns a table when used in the from clause. In Oracle this is not as easy as it seems but since my current client uses Oracle, I was forced to find a solution so here it is. &lt;br /&gt;&lt;br&gt;To create a function that returns a table in Oracle you need to follow a few steps:&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Create a type that corresponds to a single record &lt;br /&gt;&lt;li&gt;Create a type that corresponds to a table and that has the previously declared type as recordtype &lt;br /&gt;&lt;li&gt;Create the function&lt;/li&gt;&lt;/ul&gt;To use the function, you need to include it in the TABLE() function.&lt;br&gt;&lt;br /&gt;Here is an example on how to do it:&lt;ul&gt;&lt;br /&gt;&lt;li&gt;First I create a simple table that will be used for the sample. &lt;br /&gt;&lt;div class="wlWriterEditableSmartContent" id="F2210F5F-69EB-4d4c-AFF7-B8A050E9CC72:4cdc8cf7-be65-42d3-8ea7-b7d2629de8ea" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; width: 476px; padding-top: 0px"&gt;&lt;pre style="width: 100%"&gt;&lt;div&gt;&lt;!--&lt;br /&gt;&lt;br /&gt;Code highlighting produced by Actipro CodeHighlighter (freeware)&lt;br /&gt;http://www.CodeHighlighter.com/&lt;br /&gt;&lt;br /&gt;--&gt;&lt;span style="color: #008080"&gt;--&lt;/span&gt;&lt;span style="color: #008080"&gt; Create a dummy table to show how it works.&lt;/span&gt;&lt;span style="color: #008080"&gt;&lt;br /&gt;--&lt;/span&gt;&lt;span style="color: #008080"&gt; The table contains a hierarchy between boss &lt;/span&gt;&lt;span style="color: #008080"&gt;&lt;br /&gt;--&lt;/span&gt;&lt;span style="color: #008080"&gt; and employee.&lt;/span&gt;&lt;span style="color: #008080"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;TABLE&lt;/span&gt;&lt;span style="color: #000000"&gt; employee&lt;br /&gt;(&lt;br /&gt;  emp_id       &lt;/span&gt;&lt;span style="font-weight: bold; color: #000000"&gt;NUMBER&lt;/span&gt;&lt;span style="color: #000000"&gt;(&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;10&lt;/span&gt;&lt;span style="color: #000000"&gt;),&lt;br /&gt;  full_name    &lt;/span&gt;&lt;span style="font-weight: bold; color: #000000"&gt;VARCHAR2&lt;/span&gt;&lt;span style="color: #000000"&gt;(&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;50&lt;/span&gt;&lt;span style="color: #000000"&gt;),&lt;br /&gt;  emp_boss_id  &lt;/span&gt;&lt;span style="font-weight: bold; color: #000000"&gt;NUMBER&lt;/span&gt;&lt;span style="color: #000000"&gt;(&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;10&lt;/span&gt;&lt;span style="color: #000000"&gt;)&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #008080"&gt;--&lt;/span&gt;&lt;span style="color: #008080"&gt; Insert dummy data:&lt;/span&gt;&lt;span style="color: #008080"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;INSERT&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;INTO&lt;/span&gt;&lt;span style="color: #000000"&gt; employee &lt;/span&gt;&lt;span style="color: #0000ff"&gt;VALUES&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;Geert Verhoeven&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;&lt;span style="color: #000000"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;INSERT&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;INTO&lt;/span&gt;&lt;span style="color: #000000"&gt; employee &lt;/span&gt;&lt;span style="color: #0000ff"&gt;VALUES&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;2&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;Ford Parker&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;&lt;span style="color: #000000"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;INSERT&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;INTO&lt;/span&gt;&lt;span style="color: #000000"&gt; employee &lt;/span&gt;&lt;span style="color: #0000ff"&gt;VALUES&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;3&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;Al Bino&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;INSERT&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;INTO&lt;/span&gt;&lt;span style="color: #000000"&gt; employee &lt;/span&gt;&lt;span style="color: #0000ff"&gt;VALUES&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;4&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;April May&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;INSERT&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;INTO&lt;/span&gt;&lt;span style="color: #000000"&gt; employee &lt;/span&gt;&lt;span style="color: #0000ff"&gt;VALUES&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;5&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;Abbie Birthday&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;3&lt;/span&gt;&lt;span style="color: #000000"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;INSERT&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;INTO&lt;/span&gt;&lt;span style="color: #000000"&gt; employee &lt;/span&gt;&lt;span style="color: #0000ff"&gt;VALUES&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;6&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;Gene E. Yuss&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;3&lt;/span&gt;&lt;span style="color: #000000"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;INSERT&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;INTO&lt;/span&gt;&lt;span style="color: #000000"&gt; employee &lt;/span&gt;&lt;span style="color: #0000ff"&gt;VALUES&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;7&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;Juana Bea&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;3&lt;/span&gt;&lt;span style="color: #000000"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;INSERT&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;INTO&lt;/span&gt;&lt;span style="color: #000000"&gt; employee &lt;/span&gt;&lt;span style="color: #0000ff"&gt;VALUES&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;8&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;Willie Maykit&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;4&lt;/span&gt;&lt;span style="color: #000000"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;INSERT&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;INTO&lt;/span&gt;&lt;span style="color: #000000"&gt; employee &lt;/span&gt;&lt;span style="color: #0000ff"&gt;VALUES&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;9&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;Zoltan Pepper&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;4&lt;/span&gt;&lt;span style="color: #000000"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;INSERT&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;INTO&lt;/span&gt;&lt;span style="color: #000000"&gt; employee &lt;/span&gt;&lt;span style="color: #0000ff"&gt;VALUES&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;10&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;Scott Shawn DeRocks&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;4&lt;/span&gt;&lt;span style="color: #000000"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;COMMIT&lt;/span&gt;&lt;span style="color: #000000"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br&gt;&lt;li&gt;Then I create the types needed to be able to return a table&lt;br /&gt;&lt;div class="wlWriterEditableSmartContent" id="F2210F5F-69EB-4d4c-AFF7-B8A050E9CC72:e41e93c6-bd1e-4115-bfe4-e5e402e1a269" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="width: 100%"&gt;&lt;div&gt;&lt;!--&lt;br /&gt;&lt;br /&gt;Code highlighting produced by Actipro CodeHighlighter (freeware)&lt;br /&gt;http://www.CodeHighlighter.com/&lt;br /&gt;&lt;br /&gt;--&gt;&lt;span style="color: #008080"&gt;--&lt;/span&gt;&lt;span style="color: #008080"&gt; Create a type that corresponds to a row that you want to have returned.&lt;/span&gt;&lt;span style="color: #008080"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt;&lt;span style="color: #000000"&gt; TYPE ind_employee &lt;/span&gt;&lt;span style="color: #0000ff"&gt;AS&lt;/span&gt;&lt;span style="color: #000000"&gt; OBJECT (emp_id &lt;/span&gt;&lt;span style="font-weight: bold; color: #000000"&gt;NUMBER&lt;/span&gt;&lt;span style="color: #000000"&gt;(&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;10&lt;/span&gt;&lt;span style="color: #000000"&gt;), full_name  &lt;/span&gt;&lt;span style="font-weight: bold; color: #000000"&gt;VARCHAR2&lt;/span&gt;&lt;span style="color: #000000"&gt;(&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;50&lt;/span&gt;&lt;span style="color: #000000"&gt;));&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #008080"&gt;--&lt;/span&gt;&lt;span style="color: #008080"&gt;&lt;br&gt; Create a type that corresponds to a table of rows with the specified type.&lt;/span&gt;&lt;span style="color: #008080"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt;&lt;span style="color: #000000"&gt; TYPE ind_employee_table &lt;/span&gt;&lt;span style="color: #0000ff"&gt;AS&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;TABLE&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;OF&lt;/span&gt;&lt;span style="color: #000000"&gt; ind_employee;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;li&gt;After this is done, you can create a function that returns a table.&lt;br /&gt;&lt;div class="wlWriterEditableSmartContent" id="F2210F5F-69EB-4d4c-AFF7-B8A050E9CC72:068f0910-168c-4494-ad77-a5b29d39de13" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; width: 446px; padding-top: 0px"&gt;&lt;pre style="width: 100%"&gt;&lt;div&gt;&lt;!--&lt;br /&gt;&lt;br /&gt;Code highlighting produced by Actipro CodeHighlighter (freeware)&lt;br /&gt;http://www.CodeHighlighter.com/&lt;br /&gt;&lt;br /&gt;--&gt;&lt;span style="color: #008080"&gt;--&lt;/span&gt;&lt;span style="color: #008080"&gt; Create the function.&lt;/span&gt;&lt;span style="color: #008080"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #808080"&gt;OR&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #ff00ff"&gt;REPLACE&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;FUNCTION&lt;/span&gt;&lt;span style="color: #000000"&gt; FN_GET_EMPLOYEE_DESCENDANTS (&lt;br /&gt;    pin_emp_id &lt;/span&gt;&lt;span style="color: #808080"&gt;IN&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="font-weight: bold; color: #000000"&gt;NUMBER&lt;/span&gt;&lt;span style="color: #000000"&gt;&lt;br /&gt;) &lt;/span&gt;&lt;span style="color: #0000ff"&gt;RETURN&lt;/span&gt;&lt;span style="color: #000000"&gt; ind_employee_table PIPELINED &lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;IS&lt;/span&gt;&lt;span style="color: #000000"&gt;  &lt;br /&gt;    &lt;br /&gt;TYPE t_ref_cursor &lt;/span&gt;&lt;span style="color: #0000ff"&gt;IS&lt;/span&gt;&lt;span style="color: #000000"&gt; REF &lt;/span&gt;&lt;span style="color: #0000ff"&gt;CURSOR&lt;/span&gt;&lt;span style="color: #000000"&gt;;    &lt;br /&gt;lc_employees        t_ref_cursor;&lt;br /&gt;lr_out_rec          ind_employee :&lt;/span&gt;&lt;span style="color: #808080"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; ind_employee(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;NULL&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;NULL&lt;/span&gt;&lt;span style="color: #000000"&gt;);&lt;br /&gt;    &lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;BEGIN&lt;/span&gt;&lt;span style="color: #000000"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;OPEN&lt;/span&gt;&lt;span style="color: #000000"&gt; lc_employees &lt;/span&gt;&lt;span style="color: #0000ff"&gt;FOR&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;br /&gt;        &lt;/span&gt;&lt;span style="color: #008080"&gt;--&lt;/span&gt;&lt;span style="color: #008080"&gt; The connect by prior handles the hierarchy.&lt;/span&gt;&lt;span style="color: #008080"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;br /&gt;            emp_id,&lt;br /&gt;            full_name &lt;br /&gt;        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt;&lt;span style="color: #000000"&gt; employee    &lt;br /&gt;        START &lt;/span&gt;&lt;span style="color: #0000ff"&gt;WITH&lt;/span&gt;&lt;span style="color: #000000"&gt; emp_id &lt;/span&gt;&lt;span style="color: #808080"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; pin_emp_id&lt;br /&gt;        CONNECT &lt;/span&gt;&lt;span style="color: #0000ff"&gt;BY&lt;/span&gt;&lt;span style="color: #000000"&gt; PRIOR emp_id &lt;/span&gt;&lt;span style="color: #808080"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; emp_boss_id;&lt;br /&gt;  &lt;br /&gt;        LOOP&lt;br /&gt;            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;FETCH&lt;/span&gt;&lt;span style="color: #000000"&gt; lc_employees &lt;br /&gt;            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;INTO&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;br /&gt;                lr_out_rec.emp_id,    &lt;br /&gt;                lr_out_rec.full_name;&lt;br /&gt;            &lt;br /&gt;            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;EXIT&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;WHEN&lt;/span&gt;&lt;span style="color: #000000"&gt; lc_employees&lt;/span&gt;&lt;span style="color: #808080"&gt;%&lt;/span&gt;&lt;span style="color: #000000"&gt;NOTFOUND;&lt;br /&gt;            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;PIPE&lt;/span&gt;&lt;span style="color: #000000"&gt; ROW(lr_out_rec);&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;END&lt;/span&gt;&lt;span style="color: #000000"&gt; LOOP;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;CLOSE&lt;/span&gt;&lt;span style="color: #000000"&gt; lc_employees;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;RETURN&lt;/span&gt;&lt;span style="color: #000000"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;END&lt;/span&gt;&lt;span style="color: #000000"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br&gt;REMARKS: The PIPELINED command and PIPE ROW() method, work together to make sure that each row is returned to the caller immediately after it is processed. This helps to avoid having big objects in memory. &lt;br&gt;&lt;br /&gt;&lt;li&gt;To use the function, you need to use the TABLE() function.&lt;br /&gt;&lt;div class="wlWriterEditableSmartContent" id="F2210F5F-69EB-4d4c-AFF7-B8A050E9CC72:7873f7a5-4bfe-4e70-a6f4-c77f171d5607" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="width: 100%"&gt;&lt;div&gt;&lt;!--&lt;br /&gt;&lt;br /&gt;Code highlighting produced by Actipro CodeHighlighter (freeware)&lt;br /&gt;http://www.CodeHighlighter.com/&lt;br /&gt;&lt;br /&gt;--&gt;&lt;span style="color: #008080"&gt;--&lt;/span&gt;&lt;span style="color: #008080"&gt; Sample query:&lt;/span&gt;&lt;span style="color: #008080"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #808080"&gt;*&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;TABLE&lt;/span&gt;&lt;span style="color: #000000"&gt;(FN_GET_EMPLOYEE_DESCENDANTS(&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;));&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;li&gt;This gives the following results:&lt;br /&gt;&lt;div class="wlWriterEditableSmartContent" id="F2210F5F-69EB-4d4c-AFF7-B8A050E9CC72:50ad5bb9-2515-4a25-8452-bbb6d4d91392" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="width: 100%"&gt;&lt;div&gt;&lt;!--&lt;br /&gt;&lt;br /&gt;Code highlighting produced by Actipro CodeHighlighter (freeware)&lt;br /&gt;http://www.CodeHighlighter.com/&lt;br /&gt;&lt;br /&gt;--&gt;&lt;span style="color: #000000"&gt;EMP_ID    FULL_NAME&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;    Geert Verhoeven&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;3&lt;/span&gt;&lt;span style="color: #000000"&gt;    Al Bino&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;5&lt;/span&gt;&lt;span style="color: #000000"&gt;    Abbie Birthday&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;6&lt;/span&gt;&lt;span style="color: #000000"&gt;    Gene E. Yuss&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;7&lt;/span&gt;&lt;span style="color: #000000"&gt;    Juana Bea&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;4&lt;/span&gt;&lt;span style="color: #000000"&gt;    April May&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;8&lt;/span&gt;&lt;span style="color: #000000"&gt;    Willie Maykit&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;9&lt;/span&gt;&lt;span style="color: #000000"&gt;    Zoltan Pepper&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: #800000"&gt;10&lt;/span&gt;&lt;span style="color: #000000"&gt;    Scott Shawn DeRocks&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-8513247236689214570?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/8513247236689214570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=8513247236689214570' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/8513247236689214570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/8513247236689214570'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/07/create-function-that-returns-table.html' title='Create a function that returns a table'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-7568740517373982407</id><published>2007-07-19T19:05:00.001+02:00</published><updated>2007-07-19T19:05:41.142+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Threading'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>How (not) to create a deadlock with the Thread.Join() method</title><content type='html'>&lt;p&gt;In one of my projects I needed to be able to execute multiple tasks at the same&amp;nbsp;time and show the results when all the tasks were finished. &lt;/p&gt; &lt;p&gt;The tasks included updating of the user interface. Since you cannot update a control on the user interface from a thread different than the thread that owns the control, you need to use the Control.Invoke method. &lt;/p&gt; &lt;p&gt;Control.Invoke(delegate method) executes the specified delegate on the thread that owns the control. So this way, you can&amp;nbsp;have&amp;nbsp;a&amp;nbsp;second&amp;nbsp;thread&amp;nbsp;make a call to the main thread to update the user interface. So far so good.&lt;/p&gt; &lt;p&gt;The goal was to load&amp;nbsp;multiple datasets in different threads and call a Control.Invoke for each dataset to bind it to a control on&amp;nbsp;the form. After all the threads were finished, I wanted to show the form to the&amp;nbsp;user.&amp;nbsp;&lt;/p&gt; &lt;p&gt;To be able to check that all the threads were finished, I used the Thread.Join() method. This method blocks the main method until the thread finishes. If you create a loop that loops through all the threads you started and call Thread.Join() you are sure that all threads have finished.&lt;/p&gt; &lt;p&gt;The issue with this is that Thread.Join() blocks the main thread. So it also blocks the calls made via Control.Invoke. This is why you can't use Thread.Join() in combination with Control.Invoke. Pretty logic but if you don't realize what is going wrong, you can spent quite some time on it.&lt;/p&gt; &lt;p&gt;References:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a title="http://msdn2.microsoft.com/en-us/library/system.threading.thread.join(vs.80).aspx" href="http://msdn2.microsoft.com/en-us/library/system.threading.thread.join(vs.80).aspx"&gt;http://msdn2.microsoft.com/en-us/library/system.threading.thread.join(vs.80).aspx&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a title="http://msdn2.microsoft.com/en-us/library/zyzhdc6b(vs.80).aspx" href="http://msdn2.microsoft.com/en-us/library/zyzhdc6b(vs.80).aspx"&gt;http://msdn2.microsoft.com/en-us/library/zyzhdc6b(vs.80).aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-7568740517373982407?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/7568740517373982407/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=7568740517373982407' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/7568740517373982407'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/7568740517373982407'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/07/how-not-to-create-deadlock-with.html' title='How (not) to create a deadlock with the Thread.Join() method'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-6563501503101731054</id><published>2007-07-17T12:10:00.001+02:00</published><updated>2007-07-17T12:11:09.686+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips and Tricks'/><category scheme='http://www.blogger.com/atom/ns#' term='Office 2007'/><title type='text'>Blogging with Office 2007</title><content type='html'>&lt;span xmlns=""&gt;&lt;p&gt;Since a few days I'm using Word 2007 to create new blog entries. I've tried several utilities to add new blog entries but was always struggling with the layout. After doing a few tests, I'm very pleased with Word 2007. The only pity is that since I'm using Blogger, I can't upload images and don't have the possibility to add tags (Categories). &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;Here is a link on how to get it started &lt;a href="http://spsfactory.blogspot.com/2007/03/blogger-is-integrated-in-microsoft.html"&gt;http://spsfactory.blogspot.com/2007/03/blogger-is-integrated-in-microsoft.html&lt;/a&gt;.&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-6563501503101731054?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/6563501503101731054/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=6563501503101731054' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/6563501503101731054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/6563501503101731054'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/07/blogging-with-office-2007_17.html' title='Blogging with Office 2007'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-9113012858186974809</id><published>2007-07-09T21:31:00.001+02:00</published><updated>2007-07-09T21:41:02.743+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Add a new code group based on a .snk file by using the caspol command line</title><content type='html'>&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;For one of my projects, I needed to be able to give the FullTrust permission to my smart client applications. Since all the applications created at the client are signed using the same strong name key, I've used this to set up the security requirements. &lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;p&gt;Normally I would use the ".NET Framework 2.0 Configuration" but not all the user's have the .NET Framework SDK installed (which includes the configuration tool), I used the caspol.exe command line to set the security permissions. &lt;/p&gt;&lt;p&gt;Since it took me quiet some time to get all the parameters right, I thought to give you a head start by posting the commands. &lt;/p&gt;&lt;p&gt;Steps to follow to add a new code group that gives fulltrust to all applications signed by a given snk file. In order to add the strong name to the security policies, you either need to have a signed dll/exe or the snk file. The below sample uses an .snk file. &lt;/p&gt;&lt;ol&gt;&lt;li&gt;Extract the public key from the .snk file (in this case Sample.snk) by using the sn.exe tool:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;br /&gt;sn -p sample.snk sample.pk&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;li&gt;Now you need to have the hex value of the public key (saved in sample.pk). Since notepad doesn't support the format of the .pk file, you need to have a hex editor to open it. I used the free HxD tool which has all the features you need (&lt;/span&gt;&lt;a href="http://mh-nexus.de/hxd/"&gt;&lt;span style="font-family:trebuchet ms;"&gt;http://mh-nexus.de/hxd/&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:trebuchet ms;"&gt;).&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;Open HxD.exeOpen the sample.pk file and copy the hex value.&lt;br /&gt;&lt;/span&gt;&lt;a href="http://3.bp.blogspot.com/_DMJte_aP-lA/RpKOLDnKpvI/AAAAAAAAAGA/dqOci7K2lxs/s1600-h/Screen1.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5085283249853998834" style="CURSOR: hand" alt="" src="http://3.bp.blogspot.com/_DMJte_aP-lA/RpKOLDnKpvI/AAAAAAAAAGA/dqOci7K2lxs/s400/Screen1.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;3. The following command creates the new key in the machine security policy:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;caspol -machine -addgroup 1 -strong -hex "0024000004800000940000000602000000240000525341310004000001000100DDEEAD8B27321D3FB0E872FABDFA62627CCA03864AF3F7A19C6D978788F5DCD89BEFD1B897BAC5C74253091FB6747E2723D5239B802F074B1AC930A9C187D52FCF3ED65AF467F4F656F392CF5E6E2FF69071C398EA931B2EB862F6CE832350B24A6524F06F9F5F630A2B00B30F59A87BC847989D2D09DDD7A49BE92FE2EFB5B2" -noname -noversion FullTrust -name "Code Group Name" -description "Code Group Description" -exclusive on&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;The hex key can not contain any spaces or carriage returns so you need to remove them from the copied result.&lt;br /&gt;&lt;/span&gt;&lt;a href="http://1.bp.blogspot.com/_DMJte_aP-lA/RpKOUjnKpwI/AAAAAAAAAGI/6C-ra4dCR_4/s1600-h/Screen2.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5085283413062756098" style="CURSOR: hand" alt="" src="http://1.bp.blogspot.com/_DMJte_aP-lA/RpKOUjnKpwI/AAAAAAAAAGI/6C-ra4dCR_4/s400/Screen2.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;References: &lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;sn.exe: &lt;/span&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/k5b5tt23(VS.80).aspx"&gt;&lt;span style="font-family:trebuchet ms;"&gt;http://msdn2.microsoft.com/en-us/library/k5b5tt23(VS.80).aspx&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;caspol.exe: &lt;/span&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/cb6t8dtz(VS.80).aspx"&gt;&lt;span style="font-family:trebuchet ms;"&gt;http://msdn2.microsoft.com/en-us/library/cb6t8dtz(VS.80).aspx&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-9113012858186974809?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/9113012858186974809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=9113012858186974809' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/9113012858186974809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/9113012858186974809'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/07/add-new-code-group-based-on-snk-file-by.html' title='Add a new code group based on a .snk file by using the caspol command line'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_DMJte_aP-lA/RpKOLDnKpvI/AAAAAAAAAGA/dqOci7K2lxs/s72-c/Screen1.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-4024221504209381822</id><published>2007-07-06T19:21:00.000+02:00</published><updated>2007-07-06T19:47:23.799+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ClickOnce'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Problems when signing my ClickOnce application</title><content type='html'>&lt;div&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-family:trebuchet ms;"&gt;When I tried to sign my ClickOnce application, I received the following error: &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://4.bp.blogspot.com/_DMJte_aP-lA/Ro56iTnKppI/AAAAAAAAAFQ/88Y_SHr4uMo/s1600-h/error.JPG"&gt;&lt;span style="font-family:trebuchet ms;color:#000000;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5084135759146559122" style="CURSOR: hand" alt="" src="http://4.bp.blogspot.com/_DMJte_aP-lA/Ro56iTnKppI/AAAAAAAAAFQ/88Y_SHr4uMo/s400/error.JPG" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="color:#000000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;em&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:78%;color:#666666;"&gt;Unable to find manifest signing certificate in the certificate store.&lt;/span&gt; &lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;I’ve noticed that even after removing the sign option in the project properties page, the .csproj file (opened with notepad) still contained parameters indicating that the application needed to be signed. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;span style="color:#990000;"&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;SignManifests&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;b&gt;true&lt;/b&gt;&lt;span style="color:#990000;"&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;SignManifests&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#990000;"&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;ManifestCertificateThumbprint&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;b&gt;ACBE668D16D794DA9E35301D49C834864C4D9C2A&lt;/b&gt;&lt;span style="color:#990000;"&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;ManifestCertificateThumbprint&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#990000;"&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;ManifestKeyFile&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;b&gt;GuiWinApp_TemporaryKey.pfx&lt;/b&gt;&lt;span style="color:#990000;"&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;ManifestKeyFile&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-family:trebuchet ms;"&gt;After removing these lines of code and reselecting the .snk file in the property pages, everything worked fine.&lt;/span&gt;&lt;/span&gt; &lt;/div&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_DMJte_aP-lA/Ro6AFjnKpuI/AAAAAAAAAF4/Ui_3weBrwrg/s1600-h/screen.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5084141862295086818" style="CURSOR: hand" alt="" src="http://1.bp.blogspot.com/_DMJte_aP-lA/Ro6AFjnKpuI/AAAAAAAAAF4/Ui_3weBrwrg/s400/screen.JPG" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-4024221504209381822?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/4024221504209381822/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=4024221504209381822' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/4024221504209381822'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/4024221504209381822'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/07/problems-when-signing-my-clickonce.html' title='Problems when signing my ClickOnce application'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_DMJte_aP-lA/Ro56iTnKppI/AAAAAAAAAFQ/88Y_SHr4uMo/s72-c/error.JPG' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-5197066778065663276</id><published>2007-04-05T20:42:00.000+02:00</published><updated>2007-09-11T07:54:02.920+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips and Tricks'/><title type='text'>Creating and using code snippets</title><content type='html'>&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;One of the features that I really appreciate in Visual Studio 2005 is "code snippets". Code snippets help you to speed up the development by giving you shortcuts to frequently used code. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;For example if you want to create a for loop, you simply type for and press the "TAB" button twice. &lt;/span&gt;&lt;/p&gt;&lt;a href="http://2.bp.blogspot.com/_DMJte_aP-lA/RhVDZan9nFI/AAAAAAAAAEw/mzbuPA66UHw/s1600-h/Screen+1.bmp"&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5050016661088607314" style="CURSOR: hand" alt="" src="http://2.bp.blogspot.com/_DMJte_aP-lA/RhVDZan9nFI/AAAAAAAAAEw/mzbuPA66UHw/s400/Screen+1.bmp" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;Visual Studio will then automatically generate the code for you as you can see below. &lt;/span&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_DMJte_aP-lA/RhVDqan9nGI/AAAAAAAAAE4/DCZRAPH--tc/s1600-h/Screen+2.bmp"&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5050016953146383458" style="CURSOR: hand" alt="" src="http://2.bp.blogspot.com/_DMJte_aP-lA/RhVDqan9nGI/AAAAAAAAAE4/DCZRAPH--tc/s400/Screen+2.bmp" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;By using the tab key, you can navigate to the marked words which enables to specify your own names.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;That's not all. The nicest thing about code snippets is that you can create your own code snippets.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;In the following example, I'll show you how.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Create a new file &lt;strong&gt;cend.snippet &lt;/strong&gt;within Visual Studio 2005 and save it under the ...\&lt;strong&gt;My Documents\Visual Studio 2005\Code Snippets\Visual C#\My Code Snippets&lt;/strong&gt; folder.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Copy the following code in the file, I'll explain the code in a minute:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color:#990000;"&gt;xml&lt;/span&gt; &lt;span style="color:#cc0000;"&gt;version&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;=&lt;/span&gt;"&lt;span style="color:#3333ff;"&gt;1.0&lt;/span&gt;" &lt;span style="color:#cc0000;"&gt;encoding&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;=&lt;/span&gt;"&lt;span style="color:#3333ff;"&gt;utf-8&lt;/span&gt;" &lt;span style="color:#3333ff;"&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#990000;"&gt;CodeSnippets&lt;/span&gt; &lt;span style="color:#cc0000;"&gt;xmlns&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;=&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&lt;u&gt;http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet&lt;/u&gt;&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#990000;"&gt;CodeSnippet&lt;/span&gt; &lt;span style="color:#cc0000;"&gt;Format&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;=&lt;span style="color:#000000;"&gt;"&lt;/span&gt;1.0&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#990000;"&gt;Header&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#990000;"&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;Shortcut&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;span style="color:#000000;"&gt;cend&lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#990000;"&gt;Shortcut&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#990000;"&gt;Title&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;span style="color:#000000;"&gt;End console&lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#990000;"&gt;Title&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#990000;"&gt;Description&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;Code snippet for ending a console application&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#990000;"&gt;Description&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#990000;"&gt;Header&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#990000;"&gt;Snippet&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#990000;"&gt;Declarations&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#990000;"&gt;Literal&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#990000;"&gt;ID&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;EndMessage&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#990000;"&gt;ID&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#990000;"&gt;Default&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;Press any key to continue ... &lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#990000;"&gt;Default&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#990000;"&gt;Literal&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#990000;"&gt;Declarations&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#990000;"&gt;Code&lt;/span&gt; &lt;span style="color:#cc0000;"&gt;Language&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;=&lt;span style="color:#000000;"&gt;"&lt;/span&gt;CSharp&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;![CDATA[&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#999999;"&gt;Console.WriteLine("$EndMessage$");&lt;br /&gt;Console.ReadLine();&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;]]&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#990000;"&gt;Code&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#990000;"&gt;Snippet&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#990000;"&gt;CodeSnippet&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#990000;"&gt;CodeSnippets&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Save the file and open a C# application. In one of the .cs files, type cend which will popup the intellisense menu.&lt;br /&gt;&lt;/span&gt;&lt;a href="http://1.bp.blogspot.com/_DMJte_aP-lA/RhVGnKn9nHI/AAAAAAAAAFA/24xKKcN_TRo/s1600-h/Screen+3.bmp"&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5050020195846691954" style="CURSOR: hand" alt="" src="http://1.bp.blogspot.com/_DMJte_aP-lA/RhVGnKn9nHI/AAAAAAAAAFA/24xKKcN_TRo/s400/Screen+3.bmp" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;When you press the "TAB" key twice, the following code will be generated:&lt;br /&gt;&lt;/span&gt;&lt;a href="http://3.bp.blogspot.com/_DMJte_aP-lA/RhVG1qn9nII/AAAAAAAAAFI/lyQ0xBKHmgs/s1600-h/Screen+4.bmp"&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5050020444954795138" style="CURSOR: hand" alt="" src="http://3.bp.blogspot.com/_DMJte_aP-lA/RhVG1qn9nII/AAAAAAAAAFI/lyQ0xBKHmgs/s400/Screen+4.bmp" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;How does it work:&lt;br /&gt;The second line in the snippet file informs Visual Studio to use an xsd to help you by providing intellisense (the xsd is located in C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas\1033\snippetformat.xsd depending on where you installed VS):&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;&lt;/span&gt;&lt;span style="color:#990000;"&gt;CodeSnippets&lt;/span&gt; &lt;span style="color:#cc0000;"&gt;xmlns&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;=&lt;/span&gt;"&lt;span style="color:#3333ff;"&gt;&lt;u&gt;http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet&lt;/u&gt;&lt;/span&gt;"&lt;span style="color:#3333ff;"&gt;&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;The shortcut contains the shortcut that you can use to reference to your code snippet. You can also reference the code snippets via the menu or via the &lt;strong&gt;Ctrl+K, Ctrl+X &lt;/strong&gt;combination.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;A literal is a variable that can be used within your code snippet. When using the code snippet, each literal is a placeholder for user input. You can add a default value as done in the sample.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Within the code element, comes the real code snippet. It is embedded in a CDATA element to be able to include special elements in the xml document.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;It is possible to create multiple snippets (1 snippet per file).&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-5197066778065663276?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/5197066778065663276/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=5197066778065663276' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/5197066778065663276'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/5197066778065663276'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/04/creating-and-using-code-snippets.html' title='Creating and using code snippets'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_DMJte_aP-lA/RhVDZan9nFI/AAAAAAAAAEw/mzbuPA66UHw/s72-c/Screen+1.bmp' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-3933156906817776921</id><published>2007-03-18T20:07:00.000+01:00</published><updated>2007-03-19T08:10:45.369+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Certification'/><category scheme='http://www.blogger.com/atom/ns#' term='Book'/><title type='text'>Finally passed the 70-300 exam</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;The last weeks it has been very quited on my blog since I've been busy with studying for the 070-300 exam. This is one of the exams that I was planning for a long time but never had the time to do it. So last friday I finally passed it.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;I've used the MS PRESS book (Analyzing Requirements and Defining Microsoft .NET Solution Architectures, Exam 70-300) to study for the exam. The book is pretty good but I found that the MOC 2710 was more related to the exam.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-3933156906817776921?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/3933156906817776921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=3933156906817776921' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/3933156906817776921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/3933156906817776921'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/03/finally-passed-70-300-exam.html' title='Finally passed the 70-300 exam'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-3501677682620526931</id><published>2007-03-01T20:05:00.000+01:00</published><updated>2008-01-18T10:04:33.447+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 3.5'/><category scheme='http://www.blogger.com/atom/ns#' term='LINQ'/><title type='text'>Could not load file or assembly after installing LINQ May 2006 CTP</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;When working with the class designer in Visual Studio 2005 I received the following error:&lt;br /&gt;&lt;/span&gt;&lt;a href="http://3.bp.blogspot.com/_DMJte_aP-lA/Recl5ntjn5I/AAAAAAAAAEI/PrNaJjmrMzU/s1600-h/Error.JPG"&gt;&lt;/a&gt;&lt;a href="http://3.bp.blogspot.com/_DMJte_aP-lA/Recmfntjn6I/AAAAAAAAAEQ/30ty2_atnNA/s1600-h/Error.JPG"&gt;&lt;/a&gt;&lt;a href="http://4.bp.blogspot.com/_DMJte_aP-lA/Recm_3tjn7I/AAAAAAAAAEY/78VbFzVI6ec/s1600-h/Error.JPG"&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5037037586965831602" style="" alt="" src="http://4.bp.blogspot.com/_DMJte_aP-lA/Recm_3tjn7I/AAAAAAAAAEY/78VbFzVI6ec/s400/Error.JPG" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;span style="color: rgb(102, 102, 102);font-size:78%;" &gt;&lt;em&gt;Could not load file or assembly 'Microsoft.VisualStudio.CSharp.Services.Language, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I remembered that I installed the "Microsoft Visual Studio Code Name “Orcas” Language-Integrated Query, May 2006 Community Technology Preview" the day before. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;After uninstalling the Linq CTP, everything worked fine again. I didn't find a real solution yet but since it is a CTP version I don't bother too much.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-3501677682620526931?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/3501677682620526931/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=3501677682620526931' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/3501677682620526931'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/3501677682620526931'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/03/after-installing-linq-may-2006-ctp.html' title='Could not load file or assembly after installing LINQ May 2006 CTP'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_DMJte_aP-lA/Recm_3tjn7I/AAAAAAAAAEY/78VbFzVI6ec/s72-c/Error.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-3042079358143993338</id><published>2007-02-22T20:06:00.000+01:00</published><updated>2007-07-09T21:45:07.282+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ADO.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>Get the value of the identity column after inserting a record</title><content type='html'>&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;Aparently there are still a lot of people who are having problems when inserting rows in a table that has an identity field. Sometimes you need to have the id of the record you just inserted to be able to use it afterwards.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;Yesterday I saw someone doing a &lt;span style="font-family:courier new;"&gt;&lt;span style="color:#3333ff;"&gt;SELECT&lt;/span&gt; &lt;span style="color:#cc33cc;"&gt;MAX&lt;/span&gt;(id) &lt;span style="color:#3333ff;"&gt;FROM&lt;/span&gt; MyTable&lt;/span&gt; to be able to get the maximum id and then raise it by 1. This gives 2 issues:&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;what if someone else has added a row after you selected the maximum value?&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;what if the identity increment is not 1?&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;In SQL Server there is a function SCOPE_IDENTITY() that returns the last used identity within the scope of the statement. If you add this to the end of your statement, you can return the value of the identity column.&lt;br /&gt;&lt;br /&gt;Here is a sample that shows you how to do it (NOTE the end of the select statement):&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="OVERFLOW-X: scroll; OVERFLOW: auto; WIDTH: 460px"&gt;&lt;pre style="WIDTH: 1000px"&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#3333ff;"&gt;static void &lt;/span&gt;Main(&lt;span style="color:#3333ff;"&gt;string&lt;/span&gt;[] args)&lt;br /&gt;{&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt; identity = -1;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;string&lt;/span&gt; connectionString = &lt;span style="color:#990000;"&gt;"Data Source=LP51; Initial Catalog=Northwind; User Id=sa; Password=P@ssw0rd;"&lt;/span&gt;;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;string&lt;/span&gt; sql = &lt;span style="color:#990000;"&gt;"INSERT INTO Employees (LastName, FirstName) VALUES (@LastName, @FirstName) SELECT SCOPE_IDENTITY()"&lt;/span&gt;;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#339999;"&gt;   SqlConnection&lt;/span&gt; conn = &lt;span style="color:#3333ff;"&gt;new&lt;/span&gt;&lt;span style="color:#339999;"&gt; SqlConnection&lt;/span&gt;(connectionString);&lt;br /&gt;   &lt;span style="color:#339999;"&gt;SqlCommand&lt;/span&gt; cmd = &lt;span style="color:#3333ff;"&gt;new&lt;/span&gt; &lt;span style="color:#339999;"&gt;SqlCommand&lt;/span&gt;(sql, conn);&lt;br /&gt;   cmd.Parameters.&lt;span style="color:#000000;"&gt;AddWithValue(&lt;/span&gt;&lt;span style="color:#990000;"&gt;"@LastName"&lt;/span&gt;, &lt;span style="color:#990000;"&gt;"Verhoeven"&lt;/span&gt;);&lt;br /&gt;   cmd.Parameters.AddWithValue(&lt;span style="color:#990000;"&gt;"@FirstName"&lt;/span&gt;, &lt;span style="color:#990000;"&gt;"Geert"&lt;/span&gt;);&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:courier new;"&gt;&lt;p&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;try&lt;/span&gt;&lt;br /&gt;   {&lt;br /&gt;      conn.Open();&lt;br /&gt;      identity = &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt;.Parse(cmd.ExecuteScalar().ToString());&lt;br /&gt;   }&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;catch&lt;/span&gt;&lt;br /&gt;   {&lt;br /&gt;      &lt;span style="color:#009900;"&gt;// implement exception handling here&lt;/span&gt;&lt;br /&gt;   }&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;finally&lt;/span&gt;&lt;br /&gt;   {&lt;br /&gt;      conn.Dispose();&lt;br /&gt;      cmd.Dispose();&lt;br /&gt;   }&lt;/p&gt;&lt;p&gt;&lt;br /&gt;   &lt;span style="color:#339999;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color:#990000;"&gt;"The identity is {0}"&lt;/span&gt;, identity);&lt;br /&gt;   &lt;span style="color:#339999;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color:#990000;"&gt;"Press any key to continue ..."&lt;/span&gt;);&lt;br /&gt;   &lt;span style="color:#339999;"&gt;Console&lt;/span&gt;.ReadLine();&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-3042079358143993338?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/3042079358143993338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=3042079358143993338' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/3042079358143993338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/3042079358143993338'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/02/get-value-of-identity-column-after.html' title='Get the value of the identity column after inserting a record'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-1352163361143149416</id><published>2007-02-14T21:08:00.000+01:00</published><updated>2007-02-14T21:32:17.763+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>"This database does not have a valid dbo user ..." message when creating database diagrams</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;When you try to create a database diagram on a SQL Server 2005 database, it happens that you receive the following message:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://3.bp.blogspot.com/_DMJte_aP-lA/RdNtmPYlsRI/AAAAAAAAADY/o_JOYh2NGKs/s1600-h/Screen1.jpg"&gt;&lt;/a&gt;&lt;a href="http://3.bp.blogspot.com/_DMJte_aP-lA/RdNuBPYlsSI/AAAAAAAAADg/IALQsbd93Hw/s1600-h/Screen1.jpg"&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5031486176291565858" style="CURSOR: hand" alt="" src="http://3.bp.blogspot.com/_DMJte_aP-lA/RdNuBPYlsSI/AAAAAAAAADg/IALQsbd93Hw/s400/Screen1.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;em&gt;This database does not have a valid dbo user or you do not have permissions to impersonate the dbo user, so database diagramming is not available. Do you want to make yourself the dbo of this database in order to use database diagramming?&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When you click Yes, you sometimes also receive the following message:&lt;br /&gt;&lt;/span&gt;&lt;a href="http://1.bp.blogspot.com/_DMJte_aP-lA/RdNvBvYlsTI/AAAAAAAAADo/aq7IaMklrWE/s1600-h/Screen2.jpg"&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5031487284393128242" style="CURSOR: hand" alt="" src="http://1.bp.blogspot.com/_DMJte_aP-lA/RdNvBvYlsTI/AAAAAAAAADo/aq7IaMklrWE/s400/Screen2.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;em&gt;This database does not have a valid dbo user or you do not have permissions to impersonate the dbo user, so database diagramming is not available. Ensure the dbo account is valid and ensure you have impersonate permission on the dbo account.&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;NOTE&lt;/u&gt;&lt;/strong&gt;: This message can also show up when you access the database diagrams while using a domain account and are disconnected from the network.&lt;br /&gt;&lt;br /&gt;The problem is the owner of the database.&lt;br /&gt;&lt;br /&gt;Here is a procedure to fix the issue: &lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Install the "&lt;strong&gt;Microsoft SQL Server Management Studio Express&lt;/strong&gt;" (&lt;/span&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796"&gt;&lt;span style="font-family:trebuchet ms;"&gt;link&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:trebuchet ms;"&gt;)&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Close all the connections to the database&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Open the Microsoft SQL Server Management Studio Express and connect to your SQL Server Express instance&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Right click the &lt;strong&gt;Databases&lt;/strong&gt; folder in the &lt;strong&gt;Object Explorer&lt;/strong&gt; and click &lt;strong&gt;Attach...&lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Browse to the &lt;strong&gt;.mdf&lt;/strong&gt; file of your database and click Ok&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Open the &lt;strong&gt;Properties&lt;/strong&gt; page of the database and select the &lt;strong&gt;Files&lt;/strong&gt; tab&lt;/span&gt;&lt;/li&gt;&lt;a href="http://1.bp.blogspot.com/_DMJte_aP-lA/RdNxGvYlsUI/AAAAAAAAADw/U1_MVgaEWCw/s1600-h/Files.JPG"&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5031489569315729730" style="CURSOR: hand" alt="" src="http://1.bp.blogspot.com/_DMJte_aP-lA/RdNxGvYlsUI/AAAAAAAAADw/U1_MVgaEWCw/s400/Files.JPG" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;In the files tab, you can see that the &lt;strong&gt;Owner&lt;/strong&gt; is not filled in.&lt;br /&gt;Select your account as owner and click Ok.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;This should do the trick. &lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-1352163361143149416?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/1352163361143149416/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=1352163361143149416' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/1352163361143149416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/1352163361143149416'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/02/this-database-does-not-have-valid-dbo.html' title='&quot;This database does not have a valid dbo user ...&quot; message when creating database diagrams'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_DMJte_aP-lA/RdNuBPYlsSI/AAAAAAAAADg/IALQsbd93Hw/s72-c/Screen1.jpg' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-1152486091003178605</id><published>2007-02-10T14:48:00.000+01:00</published><updated>2007-07-09T21:45:41.277+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Checked and Unchecked keyword</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;When reading an article I noticed the checked keyword for the first time.&lt;br /&gt;&lt;br /&gt;The checked and unchecked keywords are used to control the overflow-checking for integral-type arithmetic operations and conversions. It can be used as an operator or a statement.&lt;br /&gt;&lt;br /&gt;In a checked context, if an expression produces a value that is outside the range of the destination type, an exception will be thrown.&lt;br /&gt;&lt;br /&gt;In an unchecked context, if an expression produces a value that is outside the range of the destination type, the value will be truncated.&lt;br /&gt;&lt;br /&gt;The following sample shows the use of the checked keyword which forces an exception when an overflow occurs:&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;static void &lt;/span&gt;Main(&lt;span style="color:#3333ff;"&gt;string&lt;/span&gt;[] args)&lt;br /&gt;{&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt; x = &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt;.MaxValue;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt; y = &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt;.MaxValue;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt; z = 0;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;try&lt;/span&gt;&lt;br /&gt;   {&lt;br /&gt;      &lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;span style="color:#009900;"&gt;// Checked in its statement form:&lt;br /&gt;&lt;/span&gt;      &lt;span style="color:#3333ff;"&gt;checked&lt;/span&gt;&lt;br /&gt;      {&lt;br /&gt;         z = x + y;&lt;br /&gt;      }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;catch&lt;/span&gt; (System.&lt;span style="color:#339999;"&gt;OverflowException&lt;/span&gt; e)&lt;br /&gt;   {&lt;br /&gt;      &lt;span style="color:#339999;"&gt;Console&lt;/span&gt;.WriteLine(e.Message);&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:#339999;"&gt;Console&lt;/span&gt;.WriteLine(z.ToString());&lt;br /&gt;   &lt;span style="color:#339999;"&gt;Console&lt;/span&gt;.ReadLine();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;Result:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;&lt;code&gt;Arithmetic operation resulted in an overflow.&lt;br /&gt;0&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The following sample shows the use of the unchecked keyword which truncates the result when an overflow occurs:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;span style="color:#3333ff;"&gt;static void &lt;/span&gt;Main(&lt;span style="color:#3333ff;"&gt;string&lt;/span&gt;[] args)&lt;br /&gt;{&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt; x = &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt;.MaxValue;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt; y = &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt;.MaxValue;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;int&lt;/span&gt; z = 0;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;try&lt;/span&gt;&lt;br /&gt;   {&lt;br /&gt;      &lt;span style="color:#009900;"&gt;// Unchecked in the operator form:&lt;/span&gt;&lt;br /&gt;      z = &lt;span style="color:#3333ff;"&gt;unchecked&lt;/span&gt;(x + y);&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;catch&lt;/span&gt; (System.&lt;span style="color:#339999;"&gt;OverflowException&lt;/span&gt; e)&lt;br /&gt;   {&lt;br /&gt;      &lt;span style="color:#339999;"&gt;Console&lt;/span&gt;.WriteLine(e.Message);&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:#339999;"&gt;Console&lt;/span&gt;.WriteLine(z.ToString());&lt;br /&gt;   &lt;span style="color:#339999;"&gt;Console&lt;/span&gt;.ReadLine();&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;u&gt;&lt;b&gt;&lt;span style="font-family:trebuchet ms;"&gt;Result: &lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;&lt;code&gt;&lt;span style="font-family:trebuchet ms;"&gt;-2&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;REMARKS: If neither checked nor unchecked is used, a constant expression uses the default overflow checking at compile time, which is checked. Otherwise, if the expression is non-constant, the run-time overflow checking depends on other factors such as compiler options and environment configuration.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-1152486091003178605?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/1152486091003178605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=1152486091003178605' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/1152486091003178605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/1152486091003178605'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/02/checked-and-unchecked-keyword_10.html' title='Checked and Unchecked keyword'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-6976483428251296948</id><published>2007-02-02T12:43:00.000+01:00</published><updated>2007-03-19T08:11:12.934+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Certification'/><category scheme='http://www.blogger.com/atom/ns#' term='Book'/><title type='text'>Passed the 70-441 exam</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;This morning I finally passed the Microsoft SQL Server 2005 Database Solutions Design (70-441) exam!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Trebuchet MS;"&gt;In total I received 56 questions based on 5 different scenario's. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;To study the exam, I used the &lt;em&gt;&lt;span style="color:#3333ff;"&gt;&lt;a href="http://www.sybex.com/WileyCDA/SybexTitle/productCd-0470040521.html"&gt;SYBEX - MCITP Developer: Microsoft SQL Server 2005 Database Solutions Design Study Guide (Exam 70-441) &lt;/a&gt;&lt;/span&gt;&lt;/em&gt;book. The book covers the exam really good and is a good book to use as a reference. &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-6976483428251296948?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/6976483428251296948/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=6976483428251296948' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/6976483428251296948'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/6976483428251296948'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/02/passed-70-441-exam.html' title='Passed the 70-441 exam'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-8928570270812219209</id><published>2007-01-29T20:46:00.000+01:00</published><updated>2007-01-29T21:44:47.547+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><category scheme='http://www.blogger.com/atom/ns#' term='Scalar Function'/><title type='text'>Converting seconds to HH:MM:SS</title><content type='html'>&lt;p&gt;&lt;span style="font-family:'Trebuchet MS',sans-serif;"&gt;Since a lot of people are asking for a good way to convert seconds to HH:MM:SS format, I created a small function to do this. After posting my answer to the tek-tips forum, I received an even better solution. So here it is:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#3333ff;"&gt;CREATE FUNCTION&lt;/span&gt; SecTimeDay (@sec integer)&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;RETURNS VARCHAR&lt;/span&gt;(19)&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;AS&lt;br /&gt;BEGIN&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;DECLARE&lt;/span&gt; @DayTime &lt;span style="color:#3333ff;"&gt;VARCHAR&lt;/span&gt;(19)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#009900;"&gt;/* Calculate # of days and display if necessary */&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#3333ff;"&gt;SELECT&lt;/span&gt; @DayTime =&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#3333ff;"&gt;CASE WHEN&lt;/span&gt; @Sec &gt;= 86400&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#3333ff;"&gt;THEN&lt;/span&gt; &lt;span &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;style="color:#cc33cc;"&gt;CONVERT&lt;/span&gt;(&lt;span &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;style="color:#3333ff;"&gt;VARCHAR&lt;/span&gt;(5), @Sec/86400) + &lt;span &amp;nbsp;&amp;nbsp;&amp;nbsp;style="color:#cc0000;"&gt;' days '&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#3333ff;"&gt;ELSE&lt;/span&gt; &lt;span style="color:#cc0000;"&gt;''&lt;br /&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#3333ff;"&gt;END&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#009900;"&gt;/* Add HH:MM:SS to number of days (or ') for output */&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;+ &lt;span style="color:#cc33cc;"&gt;CONVERT&lt;/span&gt;(&lt;span style="color:#3333ff;"&gt;VARCHAR&lt;/span&gt;(8), &lt;span style="color:#cc33cc;"&gt;DATEADD&lt;/span&gt;(Second, @Sec, 0), 108)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#3333ff;"&gt;RETURN&lt;/span&gt; @DayTime&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;END&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-8928570270812219209?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/8928570270812219209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=8928570270812219209' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/8928570270812219209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/8928570270812219209'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/01/converting-seconds-to-hhmmss.html' title='Converting seconds to HH:MM:SS'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-1500014308988186732</id><published>2007-01-23T21:05:00.000+01:00</published><updated>2007-01-23T21:31:27.641+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>Combining SQL Server Profiler and Windows Performance Logs and Alerts to monitor performance issues</title><content type='html'>&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;SQL Server Profiler can give you a great hand when troubleshooting performance in a SQL Server database. If you combine Profiler with the Performance Logs and Alerts snap in, you can put your sql statements next to the performance counter to make it easy to find the weak points.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;In the following example, I'll show you how you can find a deadlock by combining both tools:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;Set up of the performance counter&lt;/span&gt;:&lt;/span&gt; &lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Open the Performance Logs and Alerts snap-in (Administrative Tools)&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Expand &lt;strong&gt;Performance Logs and Alerts&lt;/strong&gt;, right-click &lt;strong&gt;Counter Logs&lt;/strong&gt; and click &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:trebuchet ms;"&gt;New Log Settings&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_DMJte_aP-lA/RbZquxmCjWI/AAAAAAAAAC0/FySCQPuhuuM/s1600-h/1.PNG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5023319786197781858" style="CURSOR: hand" alt="" src="http://2.bp.blogspot.com/_DMJte_aP-lA/RbZquxmCjWI/AAAAAAAAAC0/FySCQPuhuuM/s320/1.PNG" border="0" /&gt;&lt;/a&gt; &lt;/span&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Choose a name for the log (I've used DeadlockLogging)&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;In the &lt;strong&gt;General&lt;/strong&gt; tab click &lt;strong&gt;Add Counters&lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Set the properties as below:&lt;/span&gt;&lt;/li&gt;&lt;a href="http://2.bp.blogspot.com/_DMJte_aP-lA/RbZq2xmCjXI/AAAAAAAAAC8/CvDnexSa9Fk/s1600-h/2.PNG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5023319923636735346" style="CURSOR: hand" alt="" src="http://2.bp.blogspot.com/_DMJte_aP-lA/RbZq2xmCjXI/AAAAAAAAAC8/CvDnexSa9Fk/s320/2.PNG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Performance object: &lt;strong&gt;SQLServer:Locks&lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Select counters from list: &lt;strong&gt;Number of Deadlocks/sec&lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Select instances from list: &lt;strong&gt;_Total&lt;/strong&gt;&lt;/span&gt; &lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Click &lt;strong&gt;Close&lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;In the General tab, change the Interval to &lt;strong&gt;1&lt;/strong&gt; second&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;In the &lt;strong&gt;Log Files&lt;/strong&gt; tab, select &lt;strong&gt;Text File (Comma delimited)&lt;/strong&gt; for the Log File Type&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;In the &lt;strong&gt;Schedule&lt;/strong&gt; tab, select both Start and Stop methods to &lt;strong&gt;Manually&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Click &lt;strong&gt;OK&lt;/strong&gt; (if a warning message occurs to create the directory, click Yes) &lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Select the counter you just created and start it&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;Set up of the SQL Server Profiler&lt;/span&gt;:&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Open SQL Server Profiler (All Programs\Microsoft SQL Server 2005\Performance Tools\SQL Server Profiler)&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Create a &lt;strong&gt;new trace&lt;/strong&gt; (File\New Trace ...) and connect to the server&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;In the &lt;em&gt;Use the template box&lt;/em&gt;, select &lt;strong&gt;TSQL_Replay&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Check the &lt;strong&gt;Save to file&lt;/strong&gt; and specify a location for the file&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Click &lt;strong&gt;Run&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;Create a deadlock situation&lt;/span&gt;:&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Open SQL Server Management Studio&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Run the following query:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#3333ff;"&gt;USE&lt;/span&gt; tempdb;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;CREATE TABLE&lt;/span&gt; Product (&lt;br /&gt;ProdID &lt;span style="color:#3333ff;"&gt;INT&lt;/span&gt;,&lt;br /&gt;ProdName &lt;span style="color:#3333ff;"&gt;VARCHAR&lt;/span&gt;(50)&lt;br /&gt;)&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;INSERT INTO&lt;/span&gt; Product &lt;span style="color:#3333ff;"&gt;VALUES&lt;/span&gt; (1, &lt;span style="color:#990000;"&gt;'Book'&lt;/span&gt;)&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;CREATE TABLE&lt;/span&gt; ProdOrder (&lt;br /&gt;ProdOrderID &lt;span style="color:#3333ff;"&gt;INT&lt;/span&gt;,&lt;br /&gt;ProdID &lt;span style="color:#3333ff;"&gt;INT&lt;/span&gt;,&lt;br /&gt;OrderCode &lt;span style="color:#3333ff;"&gt;VARCHAR&lt;/span&gt;(10)&lt;br /&gt;)&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;INSERT INTO&lt;/span&gt; ProdOrder &lt;span style="color:#3333ff;"&gt;VALUES&lt;/span&gt; (1, 1, &lt;span style="color:#990000;"&gt;'BKO1'&lt;/span&gt;)&lt;br /&gt;GO&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Enter the following query but do not run it yet:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#3333ff;"&gt;USE&lt;/span&gt; tempdb;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;BEGIN TRAN&lt;br /&gt;UPDATE&lt;/span&gt; Product&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;SET&lt;/span&gt; ProdName = &lt;span style="color:#990000;"&gt;'DVD' &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;WHERE&lt;/span&gt; ProdID = 1&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;WAITFOR&lt;/span&gt; DELAY &lt;span style="color:#990000;"&gt;'00:00:10'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;UPDATE&lt;/span&gt; ProdOrder&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;SET&lt;/span&gt; OrderCode = &lt;span style="color:#990000;"&gt;'DVD01'&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;WHERE&lt;/span&gt; ProdOrderID = 1&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Open a new query window and type the following statement:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#3333ff;"&gt;USE&lt;/span&gt; tempdb;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;BEGIN TRAN&lt;br /&gt;UPDATE&lt;/span&gt; ProdOrder&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;SET&lt;/span&gt; OrderCode = &lt;span style="color:#990000;"&gt;'BK01'&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;WHERE&lt;/span&gt; ProdOrderID = 1&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;WAITFOR&lt;/span&gt; DELAY &lt;span style="color:#990000;"&gt;'00:00:10'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;UPDATE&lt;/span&gt; Product&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;SET&lt;/span&gt; ProdName = &lt;span style="color:#990000;"&gt;'BOOK' &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;WHERE&lt;/span&gt; ProdID = 1&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Start both queries&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;You will see that after a few seconds, the following error will be shown: "Msg 1205, Level 13, State 45, Line 8 Transaction (Process ID 53) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction." &lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;Look up the deadlock in Profiler&lt;/span&gt;:&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Open the Performance Log and Alerts and stop the &lt;strong&gt;DeadlockLogging&lt;/strong&gt; counter&lt;/span&gt; &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Switch to SQL Server Profiler and stop the trace&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Close SQL Server Profiler and open the trace file you just created&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;From the &lt;strong&gt;File&lt;/strong&gt; menu, select &lt;strong&gt;Import Performance Data&lt;/strong&gt; and select the log file created by Performance Log and Alerts&lt;/span&gt; &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;In the Performance Counter Limit Dialog window make sure that everything is selected and click OK&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;Now you can loop throught the timebar and see which select statement performed the deadlock&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_DMJte_aP-lA/RbZtIBmCjYI/AAAAAAAAADM/IUs2a9jyZck/s1600-h/4.PNG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5023322419012734338" style="CURSOR: hand" alt="" src="http://3.bp.blogspot.com/_DMJte_aP-lA/RbZtIBmCjYI/AAAAAAAAADM/IUs2a9jyZck/s320/4.PNG" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-1500014308988186732?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/1500014308988186732/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=1500014308988186732' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/1500014308988186732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/1500014308988186732'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/01/combining-sql-server-profiler-and.html' title='Combining SQL Server Profiler and Windows Performance Logs and Alerts to monitor performance issues'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_DMJte_aP-lA/RbZquxmCjWI/AAAAAAAAAC0/FySCQPuhuuM/s72-c/1.PNG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-2993163699710886919</id><published>2007-01-23T13:07:00.000+01:00</published><updated>2008-01-21T20:23:04.342+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='Book'/><title type='text'>FREE Book: 7 Development Projects for MS Office Sharepoint Server 2007 and Windows Sharepoint Services Version 3.0</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;While browsing the net I found that Microsoft is offering a free eBook about Sharepoint 2007: &lt;em&gt;&lt;strong&gt;&lt;span style="color:#000099;"&gt;7 Development Projects for MS Office Sharepoint Server 2007 and Windows Sharepoint Services Version 3.0&lt;/span&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Download it here: &lt;/span&gt;&lt;a href="http://download.microsoft.com/download/0/2/f/02f0f661-88e1-43c2-b523-88d2e9e6802f/7%20Development%20Projects%20with%20the%202007%20Microsoft%20Office%20System%20and%20Windows%20SharePoint%20Services%202007.pdf"&gt;&lt;span style="font-family:trebuchet ms;"&gt;link&lt;/span&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-2993163699710886919?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/2993163699710886919/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=2993163699710886919' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/2993163699710886919'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/2993163699710886919'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/01/book-7-development-projects-for-ms.html' title='FREE Book: 7 Development Projects for MS Office Sharepoint Server 2007 and Windows Sharepoint Services Version 3.0'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-7791790603009443816</id><published>2007-01-18T16:17:00.000+01:00</published><updated>2007-01-18T16:23:57.586+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Applet'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Get rid of "Click to activate and use this control"</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;The latest browsers have changed the way to handle the rendering of ActiveX components. When an ActiveX component needs to be rendered, a message with "Click to activate and use this control" will be shown to the user. This is good for security but can be frustating for the users of your site.&lt;br /&gt;&lt;br /&gt;It is possible to avoid this by setting the ActiveX component via an external script. So in case of having your object tag in your html page, you need to put it in a .js file &lt;strong&gt;&lt;span style="color:#3333ff;"&gt;OUTSIDE&lt;/span&gt;&lt;/strong&gt; the HTML page (it does not work when generated inside the html page) and reference it from your html/aspx page.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;em&gt;Here is an example&lt;/em&gt;&lt;/u&gt;:&lt;br /&gt;Content of the html page which has a loads the content of a javascript file:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#3333ff;"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#3333ff;"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#3333ff;"&gt;...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#3333ff;"&gt;&amp;lt;script type="text/javascript" language="javascript" src="script.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#3333ff;"&gt;...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#3333ff;"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;span style="font-family:courier new;color:#3333ff;"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;Content of the script.js file:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#3333ff;"&gt;document.write("&amp;lt;object id='myApplet' classid='MyActiveX.dll#Namespace.ClassName'&amp;gt;&amp;lt;/object&amp;gt;");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;In case of using a JavaScript file, it is also possible to do the same via an innerHTML or via the DOM as long as you add the object from outside the HTML page. &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-7791790603009443816?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/7791790603009443816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=7791790603009443816' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/7791790603009443816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/7791790603009443816'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/01/get-rid-of-click-to-activate-and-use.html' title='Get rid of &quot;Click to activate and use this control&quot;'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-3538209536959111319</id><published>2007-01-18T13:21:00.001+01:00</published><updated>2007-01-27T17:53:46.742+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>Intellisense in SQL Server Management Studio</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;SQL Prompt is a handy tool that adds intellisense functionality to your SQL Server Management Studio. After changing some settings, it becomes a real time saver.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Unfortunately, it is no longer for free.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Info: &lt;a href="http://www.red-gate.com/products/SQL_Prompt/index.htm"&gt;http://www.red-gate.com/products/SQL_Prompt/index.htm&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-3538209536959111319?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/3538209536959111319/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=3538209536959111319' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/3538209536959111319'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/3538209536959111319'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/01/intellisense-in-sql-server-management_18.html' title='Intellisense in SQL Server Management Studio'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-3651151744836441285</id><published>2007-01-18T11:40:00.000+01:00</published><updated>2007-07-09T21:47:19.058+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='Applet'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 1x'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='User Control'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Error when referencing a javascript via the &lt;LINK&gt; tag in combination with .NET Applet (ActiveX)</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;When embedding a JavaScript file with the below code in combination with .NET Applets, strange things might happen.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&amp;lt;link href="../script/myJavaScript.js" type="text/javascript"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;If you run your page, you will receive the following message:&lt;/span&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_DMJte_aP-lA/Ra9RulfLn7I/AAAAAAAAAB8/IDD26z0mMDY/s1600-h/ErrorScreen.JPG"&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5021321970320121778" style="CURSOR: hand" alt="" src="http://3.bp.blogspot.com/_DMJte_aP-lA/Ra9RulfLn7I/AAAAAAAAAB8/IDD26z0mMDY/s320/ErrorScreen.JPG" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Details:&lt;/span&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_DMJte_aP-lA/Ra9Rz1fLn8I/AAAAAAAAACE/0cBS1lciaeY/s1600-h/ErrorScreenDetails.JPG"&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5021322060514435010" style="CURSOR: hand" alt="" src="http://4.bp.blogspot.com/_DMJte_aP-lA/Ra9Rz1fLn8I/AAAAAAAAACE/0cBS1lciaeY/s320/ErrorScreenDetails.JPG" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;When looking in eventviewer you can see the following:&lt;/span&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_DMJte_aP-lA/Ra9R91fLn9I/AAAAAAAAACM/CaCXmWXmEwQ/s1600-h/EventVwr.JPG"&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5021322232313126866" style="CURSOR: hand" alt="" src="http://4.bp.blogspot.com/_DMJte_aP-lA/Ra9R91fLn9I/AAAAAAAAACM/CaCXmWXmEwQ/s320/EventVwr.JPG" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Faulting application iexplore.exe, version 7.0.5730.11, faulting module msvcr80.dll, version 8.0.50727.762, fault address 0x00014904.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;To solve this problem, you need to include your JavaScript with a SCRIPT tag like this:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&amp;lt;script src="../script/myJavaScript.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;NOTE: Close the script tag explicitly since otherwise the page stops rendering at the end of the script line.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-3651151744836441285?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/3651151744836441285/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=3651151744836441285' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/3651151744836441285'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/3651151744836441285'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/01/error-when-referencing-javascript-via.html' title='Error when referencing a javascript via the &amp;lt;LINK&amp;gt; tag in combination with .NET Applet (ActiveX)'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_DMJte_aP-lA/Ra9RulfLn7I/AAAAAAAAAB8/IDD26z0mMDY/s72-c/ErrorScreen.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-2723775545788533468</id><published>2007-01-12T17:20:00.000+01:00</published><updated>2007-07-09T21:46:43.578+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET 1x'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>What's so bad about string concatenation?</title><content type='html'>&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;A lot of developers use the + operator to concatenate multiple strings. This works fine so what is wrong with this approach?&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;First of all, strings are immutable objects. An immutable object is an object that can't be modified after it has been created. So when using the + operator, in case of adding the second string at the end of the first string, .NET creates a new string with the content of both strings. This can cause an object-allocation overhead and put pressure on the garbage collector.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;There are 2 possible solutions to avoid this:&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:Trebuchet MS;"&gt;use the string.Format() method&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Trebuchet MS;"&gt;use the StringBuilder class&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;I'll give an example of both methods. Since the String.Format method is normally used for formatting strings, as the name suggests, I will focus myself on the StringBuilder.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;strong&gt;I. String.Format() method&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;When using this method to concatenate strings, you need to create one string with a number of &lt;em&gt;"replacers" &lt;/em&gt;({0}, {1}, {2}, ..., {n}). Each replacer will be replaced by the referenced argument ({0} will reference to the first argument, {1} will reference to the second argument). The number of replacers must be same as the number of arguments.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;Here is an example:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#3333ff;"&gt;string&lt;/span&gt; value1 = &lt;span style="color:#990000;"&gt;"Geert Verhoeven"&lt;/span&gt;;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;string&lt;/span&gt; value2 = &lt;span style="color:#990000;"&gt;"Belgium"&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;string&lt;/span&gt; result = &lt;span style="color:#3333ff;"&gt;string&lt;/span&gt;.Format(&lt;span style="color:#990000;"&gt;"My name is {0} and I live in {1}."&lt;/span&gt;, value1, value2);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;The string in result will be: My name is Geert Verhoeven and I live in Belgium.&lt;br /&gt;&lt;br /&gt;Extra info: &lt;a href="http://msdn2.microsoft.com/en-us/library/fht0f5be.aspx"&gt;http://msdn2.microsoft.com/en-us/library/fht0f5be.aspx&lt;/a&gt;&lt;/span&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;strong&gt;II. StringBuilder method&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;The &lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;StringBuilder class can be found in the System.Text namespace so you will need to add a using statement. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;First you need to create a StringBuilder object. The StringBuilder class has a method "Append" to append strings. When you added the last string to the StringBuilder, you can retrieve the entire string by using the ToString() method of the StringBuilder class.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#339999;"&gt;StringBuilder&lt;/span&gt; sb = &lt;span style="color:#3333ff;"&gt;new&lt;/span&gt; &lt;span style="color:#339999;"&gt;StringBuilder&lt;/span&gt;();&lt;br /&gt;sb.Append(&lt;span style="color:#990000;"&gt;"This is the first part of the string"&lt;/span&gt;);&lt;br /&gt;sb.Append(&lt;span style="color:#990000;"&gt;"This is the second part of the string"&lt;/span&gt;);&lt;br /&gt;sb.Append(&lt;span style="color:#990000;"&gt;"This is the third part of the string"&lt;/span&gt;);&lt;br /&gt;sb.Append(&lt;span style="color:#990000;"&gt;"This is the fourth part of the string"&lt;/span&gt;);&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;br /&gt;string&lt;/span&gt; entireString = sb.ToString();&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;u&gt;How it works&lt;/u&gt;:&lt;br /&gt;A StringBuilder object internally contains a character buffer. This buffer expands as you append characters. When creating a StringBuilder it has enough space for 16 characters. If you go beyond 16 characters, the class creates a new buffer which is double the size as the previous buffer. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;Too much expanding can affect the performance of the StringBuilder class. To avoid this, you can specify the initial size of the buffer when creating a new StringBuilder instance.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;StringBuilder&lt;/span&gt; sb = &lt;span style="color:#3333ff;"&gt;new&lt;/span&gt; &lt;span style="color:#339999;"&gt;StringBuilder&lt;/span&gt;(1024);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;br /&gt;Extra info: &lt;a href="http://msdn2.microsoft.com/en-us/library/system.text.stringbuilder.aspx"&gt;http://msdn2.microsoft.com/en-us/library/system.text.stringbuilder.aspx&lt;/a&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-2723775545788533468?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/2723775545788533468/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=2723775545788533468' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/2723775545788533468'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/2723775545788533468'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/01/what-is-so-bad-about-string.html' title='What&apos;s so bad about string concatenation?'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-5868282545992957353</id><published>2007-01-12T14:58:00.000+01:00</published><updated>2007-01-13T15:51:23.794+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>Use CHAR instead of VARCHAR when the size of the content is known in advance</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;When browsing the MSDN forums, I see a lot of people using the datatype VARCHAR for fixed length columns. The VARCHAR datatype&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt; is good if you don't know the size of the content in advance but if you do know the size in advance it is better to use the CHAR datatype.&lt;br /&gt;&lt;br /&gt;Here is a comparison between both datatypes concerning the storage:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;table border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;&lt;span style="font-family:trebuchet ms;"&gt;Data Type&lt;/span&gt;&lt;/th&gt;&lt;th&gt;&lt;span style="font-family:trebuchet ms;"&gt;Range&lt;/span&gt;&lt;/th&gt;&lt;th&gt;&lt;span style="font-family:trebuchet ms;"&gt;Storage&lt;/span&gt;&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="font-family:trebuchet ms;"&gt;CHAR(n)&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-family:trebuchet ms;"&gt;1 to 8000 characters&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-family:trebuchet ms;"&gt;(n) bytes&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="font-family:trebuchet ms;"&gt;NCHAR(n)&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-family:trebuchet ms;"&gt;1 to 4000 unicode characters&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-family:trebuchet ms;"&gt;(n * 2) bytes&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="font-family:trebuchet ms;"&gt;VARCHAR(n)&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-family:trebuchet ms;"&gt;1 to 8000 characters&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-family:trebuchet ms;"&gt;Variable. Storage is the actual length &lt;strong&gt;&lt;span style="color:#cc0000;"&gt;plus 2 bytes&lt;/span&gt;&lt;/strong&gt;.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="font-family:trebuchet ms;"&gt;NVARCHAR(n)&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-family:trebuchet ms;"&gt;1 to 4000 unicode characters&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-family:trebuchet ms;"&gt;Variable. Storage is the actual length &lt;strong&gt;&lt;span style="color:#cc0000;"&gt;plus 2 bytes&lt;/span&gt;&lt;/strong&gt;.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;The difference is that the VARCHAR and the NVARCHAR data types, need an additional 2 bytes opposed to theire fixed versions. You wont see the difference with small tables. For bigger tables, this can give a waste of disk space and be less performant since the table requires more pages. &lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-5868282545992957353?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/5868282545992957353/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=5868282545992957353' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/5868282545992957353'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/5868282545992957353'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/01/use-char-instead-of-varchar-when-size.html' title='Use CHAR instead of VARCHAR when the size of the content is known in advance'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-7486063964496841991</id><published>2007-01-12T12:19:00.000+01:00</published><updated>2007-01-12T12:24:15.796+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips and Tricks'/><title type='text'>Visual Studio .NET Code Editing Tips &amp; Tricks</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;While surfing the net, I bumped up an interesting document that contains tips &amp;amp; tricks to increase your productivity in Visual Studio .NET 2005.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.agiledeveloper.com/articles/VSDOTNETCodeEditingTipsAndTricks.pdf"&gt;&lt;span style="font-family:trebuchet ms;"&gt;http://www.agiledeveloper.com/articles/VSDOTNETCodeEditingTipsAndTricks.pdf&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Most of the tips in the article are handy shortcuts.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-7486063964496841991?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/7486063964496841991/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=7486063964496841991' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/7486063964496841991'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/7486063964496841991'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/01/visual-studio-net-code-editing-tips.html' title='Visual Studio .NET Code Editing Tips &amp; Tricks'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-4831515679160878704</id><published>2007-01-12T11:36:00.000+01:00</published><updated>2007-01-26T22:53:25.017+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><category scheme='http://www.blogger.com/atom/ns#' term='Scalar Function'/><title type='text'>Get the quarter of a given date in datetime format</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;In SQL Server you can get the quarter of a year by using the datepart function. This will return 1/1/year, 4/1/year, 7/1/year or 10/1/year depending on the date you entered.&lt;br /&gt;&lt;br /&gt;Sometimes, it is necessary to get the quarter of a given date in datetime format. Here is a simple scalar function how to do it:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#000099;"&gt;&lt;span style="color:#3333ff;"&gt;CREATE FUNCTION&lt;/span&gt; &lt;/span&gt;GetQuarter (@date &lt;span style="color:#3333ff;"&gt;DATETIME&lt;/span&gt;) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#3333ff;"&gt;   RETURNS DATETIME&lt;br /&gt;AS&lt;br /&gt;BEGIN&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#3333ff;"&gt;   RETURN&lt;/span&gt; &lt;span style="color:#cc33cc;"&gt;CONVERT&lt;/span&gt;(&lt;span style="color:#3333ff;"&gt;DATETIME&lt;/span&gt;, &lt;span style="color:#cc33cc;"&gt;CONVERT&lt;/span&gt;(&lt;span style="color:#3333ff;"&gt;CHAR&lt;/span&gt;(8),&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;      DATEPART&lt;/span&gt;(&lt;span style="color:#cc33cc;"&gt;YEAR&lt;/span&gt;, @date) * 10000 +&lt;br /&gt;      (&lt;span style="color:#cc33cc;"&gt; DATEPART&lt;/span&gt;(&lt;span style="color:#cc33cc;"&gt;QUARTER&lt;/span&gt;, @date) * 3 - 2) * 100 +&lt;br /&gt;      1),&lt;br /&gt;      112)&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;END&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:trebuchet ms;"&gt;Use the function like this:&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;SELECT&lt;/span&gt; dbo.GetQuarter(dateColumn) &lt;span style="color:#3333ff;"&gt;AS&lt;/span&gt; Quarter &lt;span style="color:#3333ff;"&gt;FROM&lt;/span&gt; myTable&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-4831515679160878704?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/4831515679160878704/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=4831515679160878704' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/4831515679160878704'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/4831515679160878704'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/01/get-quarter-of-given-date-in-datetime.html' title='Get the quarter of a given date in datetime format'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-7477829238034918377</id><published>2007-01-10T21:03:00.000+01:00</published><updated>2007-01-12T11:59:20.374+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips and Tricks'/><title type='text'>Map IP address to specific pcname</title><content type='html'>&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;Sometimes there is a need to map the name of a pc to a different ip address. In Windows this is possible by editing the hosts file.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;For example when a part of an application connects to a productionserver PROD01 which is down, it can be handy to forward the requests to a developer server. Of course, this is only usefull if you don't have access to the connectionstring in the application.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;The following steps explain how to do this:&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt; &lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;go to &lt;strong&gt;&lt;em&gt;C:\Windows\system32\drivers\etc&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;open the &lt;strong&gt;&lt;em&gt;hosts&lt;/em&gt;&lt;/strong&gt; file&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;at the end of the file add a new entry as seen in the screenshot&lt;br /&gt;&lt;/span&gt;&lt;a href="http://1.bp.blogspot.com/_DMJte_aP-lA/RaVHOlfLn5I/AAAAAAAAABk/Y05vkV4GmKQ/s1600-h/hostsFile.JPG"&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5018495675680923538" style="WIDTH: 364px; CURSOR: hand; HEIGHT: 233px" alt="" src="http://1.bp.blogspot.com/_DMJte_aP-lA/RaVHOlfLn5I/AAAAAAAAABk/Y05vkV4GmKQ/s320/hostsFile.JPG" width="382" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:trebuchet ms;"&gt;This will forward all requests to PROD01 to 10.10.10.1 which can be the IP address of a different pc (for example the development server).&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-7477829238034918377?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/7477829238034918377/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=7477829238034918377' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/7477829238034918377'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/7477829238034918377'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/01/map-ip-address-to-specific-pcname.html' title='Map IP address to specific pcname'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_DMJte_aP-lA/RaVHOlfLn5I/AAAAAAAAABk/Y05vkV4GmKQ/s72-c/hostsFile.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-4717850409785111427</id><published>2007-01-04T22:29:00.001+01:00</published><updated>2007-01-05T09:13:06.572+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Threading'/><category scheme='http://www.blogger.com/atom/ns#' term='WinForms'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Using the BackgroundWorker</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;The backgroundworker component is a new component in .NET 2.0 that allows you to easily run costly processes in the background. This way the user interface is not blocked.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;In this sample I'm using the BackgroundWorker to read a 12MB large xml file in a dataset. After the xml file is read, I'll show its contents in a datagrid on a WinForms application. When refreshing the grid you will see that the UI is not blocked.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Trebuchet MS;"&gt;Here we go:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:Trebuchet MS;"&gt;Create a new WinForms application (the example code is written in C#)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Trebuchet MS;"&gt;Add a Button and a DataGridView control to the form&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Trebuchet MS;"&gt;Add a BackgroundWorker component to the form&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Trebuchet MS;"&gt;Double click on the &lt;strong&gt;DoWork&lt;/strong&gt; and &lt;strong&gt;RunWorkerCompleted&lt;/strong&gt; events in the propertygrid to create the associated methods&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Trebuchet MS;"&gt;The code in the &lt;strong&gt;DoWork&lt;/strong&gt; event handler is run on a separate and dedicated thread.&lt;br /&gt;Here we will add the code to read the xml file in a dataset and return it to the calling method.&lt;br /&gt;&lt;br /&gt;Copy the following code in the DoWork eventhandler (explanation will folow):&lt;br /&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#3333ff;"&gt;private void&lt;/span&gt; backgroundWorker1_DoWork(&lt;span style="color:#3333ff;"&gt;object &lt;/span&gt;sender,&lt;br /&gt;                                     &lt;span style="color:#339999;"&gt; DoWorkEventArgs&lt;/span&gt; e)&lt;br /&gt;{&lt;br /&gt;   &lt;span style="color:#009900;"&gt;// Use the parameter that has been passed&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;string&lt;/span&gt; fileName = (&lt;span style="color:#3333ff;"&gt;string&lt;/span&gt;)e.Argument;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:#009900;"&gt;// Load the file in the dataset&lt;br /&gt;&lt;/span&gt;   &lt;span style="color:#339999;"&gt;DataSet&lt;/span&gt; ds = new &lt;span style="color:#339999;"&gt;DataSet&lt;/span&gt;();&lt;br /&gt;   ds.ReadXml(fileName);&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:#009900;"&gt;// Set the dataset to the result property to make it&lt;br /&gt;   // available to the calling thread&lt;/span&gt;&lt;br /&gt;   e.Result = ds;&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Trebuchet MS;"&gt;To pass a parameter to the background thread we can use the DoWorkEventArgs.Argument property.&lt;br /&gt;To pass the result back to the calling thread, we use the DoWorkEventArgs.Result property.&lt;/span&gt;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Trebuchet MS;"&gt;When the background process is finished, we need to do something with the result. This is done in the &lt;strong&gt;RunWorkerCompleted&lt;/strong&gt; eventhandler. The following code retrieves the DataSet out of the &lt;strong&gt;Result&lt;/strong&gt; property from the &lt;strong&gt;RunWorkerCompletedEventArgs&lt;/strong&gt; argument.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#3333ff;"&gt;private void&lt;/span&gt; backgroundWorker1_RunWorkerCompleted(&lt;span style="color:#3333ff;"&gt;object&lt;/span&gt; sender, &lt;span style="color:#339999;"&gt;RunWorkerCompletedEventArgs&lt;/span&gt; e)&lt;br /&gt;{&lt;br /&gt;   &lt;span style="color:#009900;"&gt;// Get the dataset out of the result property&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:#339999;"&gt;DataSet&lt;/span&gt; xmlContent = (&lt;span style="color:#339999;"&gt;DataSet&lt;/span&gt;)e.Result;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#009900;"&gt;// Bind the dataset to the gridview&lt;br /&gt;&lt;/span&gt;   dgvXmlContent.DataSource = xmlContent.Tables[0];&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Trebuchet MS;"&gt;Now the only thing that rests us is tell the BackgroundWorker to start.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#3333ff;"&gt;private void&lt;/span&gt; btnLoadXML_Click(&lt;span style="color:#3333ff;"&gt;object&lt;/span&gt; sender, &lt;span style="color:#339999;"&gt;EventArgs&lt;/span&gt; e)&lt;br /&gt;{&lt;br /&gt;   &lt;span style="color:#3333ff;"&gt;string&lt;/span&gt; fileName = &lt;span style="color:#990000;"&gt;@"C:\Sample.xml";&lt;/span&gt;&lt;br /&gt;   backgroundWorker1.RunWorkerAsync(fileName);&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Trebuchet MS;"&gt;That's all there is to it. When the data is loaded and you click again on the Load button, you will see that you can continue working with the grid. At a certain moment, it will flash indicating that a new databinding has occured.&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-4717850409785111427?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/4717850409785111427/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=4717850409785111427' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/4717850409785111427'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/4717850409785111427'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2007/01/using-backgroundworker.html' title='Using the BackgroundWorker'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-1569463398743659192</id><published>2006-12-31T16:58:00.000+01:00</published><updated>2007-01-05T09:16:52.340+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Book'/><title type='text'>FREE Book: Petzold's .NET Book Zero</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;Charles Petzold is offering a free eBook on his site. The book is called: What the C or C++ Programmer Needs to Know About C# and the .NET Framework.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://www.charlespetzold.com/dotnet/"&gt;&lt;span style="font-family:trebuchet ms;"&gt;http://www.charlespetzold.com/dotnet/&lt;/span&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-1569463398743659192?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/1569463398743659192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=1569463398743659192' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/1569463398743659192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/1569463398743659192'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2006/12/free-book-petzolds-net-book-zero.html' title='FREE Book: Petzold&apos;s .NET Book Zero'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-4866135109303820596</id><published>2006-12-31T12:38:00.000+01:00</published><updated>2007-01-09T08:03:41.877+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='Web Services'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Method overloading in webservices created with Visual Studio 2005</title><content type='html'>&lt;span style="font-family:trebuchet;font-size:100%;"&gt;&lt;span style="font-family:trebuchet ms;font-size:100%;"&gt;When creating a webservice in Visual Studio 2005, the IDE adds the following WebServiceBinding:&lt;/span&gt; &lt;/span&gt;&lt;div&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet;font-size:100%;"&gt;&lt;span style="font-family:courier new;"&gt;[&lt;span style="color:#339999;"&gt;WebServiceBinding&lt;/span&gt;(ConformsTo = &lt;span style="color:#339999;"&gt;WsiProfiles&lt;/span&gt;.BasicProfile1_1)]&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:trebuchet ms;"&gt;This line indicates that your webservice conforms to the Web Services Interopability Organization's (WS-I) Baisc Profile 1.1. The Basic Profile defines a set of rules to which your webservice must conform. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:trebuchet ms;"&gt;One of its rules is that the webservice may not include method overloading. If you run a webservice that uses method overloading lile the one below, you will receive an errormessage telling that your service is not conform to WS-I Basic Profile v1.1:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:trebuchet ms;"&gt;Code:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:100%;color:#0000ff;"&gt;using&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color:#000000;"&gt; System.Web.Services; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;&lt;div&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color:#000000;"&gt;&lt;br /&gt;[&lt;span style="color:#339999;"&gt;WebService&lt;/span&gt;(Namespace &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&lt;span style="color:#990000;"&gt;http://tempuri.org/&lt;/span&gt;&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color:#000000;"&gt;)]&lt;br /&gt;[&lt;span style="color:#339999;"&gt;WebServiceBinding&lt;/span&gt;(ConformsTo &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color:#000000;"&gt; &lt;span style="color:#339999;"&gt;WsiProfiles&lt;/span&gt;.BasicProfile1_1)]&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;class&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color:#000000;"&gt; Service : System.Web.Services.&lt;span style="color:#339999;"&gt;WebService&lt;/span&gt;&lt;br /&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color:#000000;"&gt;   [&lt;span style="color:#339999;"&gt;WebMethod&lt;/span&gt;(MessageName &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&lt;span style="color:#990000;"&gt;HelloWorld&lt;/span&gt;&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color:#000000;"&gt;)]&lt;br /&gt;   &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color:#000000;"&gt; HelloWorld()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color:#000000;"&gt;   { &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;      &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&lt;span style="color:#990000;"&gt;Hello World&lt;/span&gt;&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color:#000000;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color:#000000;"&gt;   }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;/div&gt;&lt;div&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color:#000000;"&gt;   [&lt;span style="color:#339999;"&gt;WebMethod&lt;/span&gt;(MessageName &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&lt;span style="color:#990000;"&gt;HelloWorldWithName&lt;/span&gt;&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color:#000000;"&gt;)]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;   &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;&lt;span style="color:#000000;"&gt; HelloWorld(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color:#000000;"&gt; name)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color:#000000;"&gt;   { &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;      &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&lt;span style="color:#008080;"&gt;&lt;span style="color:#990000;"&gt;Hello world&lt;/span&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;+&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:100%;color:#000000;"&gt; name;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:courier new;font-size:100%;color:#000000;"&gt;   }&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;div&gt;&lt;span style="font-family:trebuchet ms;"&gt;Exception:&lt;/span&gt;&lt;/div&gt;&lt;a href="http://1.bp.blogspot.com/_DMJte_aP-lA/RZelR0ocQ-I/AAAAAAAAABE/Ac5cbDyFnBs/s1600-h/Exception.JPG"&gt;&lt;/a&gt;&lt;div&gt;&lt;a href="http://4.bp.blogspot.com/_DMJte_aP-lA/RZelykocQ_I/AAAAAAAAABM/iNGtpCtnbuQ/s1600-h/Exception.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5014658998345679858" style="CURSOR: hand" alt="" src="http://4.bp.blogspot.com/_DMJte_aP-lA/RZelykocQ_I/AAAAAAAAABM/iNGtpCtnbuQ/s320/Exception.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet;font-size:100%;"&gt;&lt;span style="font-family:trebuchet ms;font-size:100%;"&gt;Message: Service 'Service' does not conform to WS-I Basic Profile V1.1. Please examine each of the normative statement violations below ...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:trebuchet;font-size:100%;"&gt;&lt;span style="font-family:trebuchet ms;font-size:100%;"&gt;&lt;br /&gt;To be able to still use method overloading, you need to change the WebServiceBinding as follows&lt;/span&gt;:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;[&lt;span style="color:#339999;"&gt;WebServiceBinding&lt;/span&gt;(ConformsTo = &lt;span style="color:#339999;"&gt;WsiProfiles&lt;/span&gt;.None)]&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:trebuchet;font-size:100%;"&gt;&lt;span style="font-family:trebuchet ms;font-size:100%;"&gt;References&lt;/span&gt;:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.ws-i.org/Profiles/BasicProfile-1.1.html"&gt;&lt;span style="font-family:trebuchet ms;"&gt;http://www.ws-i.org/Profiles/BasicProfile-1.1.html&lt;/span&gt;&lt;/a&gt;&lt;a href="http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html"&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-4866135109303820596?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/4866135109303820596/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=4866135109303820596' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/4866135109303820596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/4866135109303820596'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2006/12/method-overloading-in-webservices.html' title='Method overloading in webservices created with Visual Studio 2005'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_DMJte_aP-lA/RZelykocQ_I/AAAAAAAAABM/iNGtpCtnbuQ/s72-c/Exception.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-6179047558303081049</id><published>2006-12-20T09:50:00.000+01:00</published><updated>2007-02-01T21:26:34.789+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Applet'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='User Control'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>My first .NET Applet</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;In one of the current projects I'm working on, performance has become an issue. To gain more performance, we decided to implement the solution as a .NET applet. At first it looked a bit strange. I always associated applets with Java. But apparently this is not the case. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;A .NET applet is nothing more than a windows form control hosted in Internet Explorer. As a sample, I've created a small application that shows the current time in a .NET applet.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Here is how to do it:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;First you need to create a new Windows Control Library project. Add a button and a textbox &lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;to the usercontrol.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_DMJte_aP-lA/RYj7qEocQ6I/AAAAAAAAAAY/DcdZbHeMegw/s1600-h/UserControl.JPG"&gt;&lt;/a&gt;&lt;a href="http://1.bp.blogspot.com/_DMJte_aP-lA/RYkOXUocQ9I/AAAAAAAAAA4/6QiphzIV4Nw/s1600-h/UserControl.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5010551854264501202" style="CURSOR: hand" alt="" src="http://1.bp.blogspot.com/_DMJte_aP-lA/RYkOXUocQ9I/AAAAAAAAAA4/6QiphzIV4Nw/s320/UserControl.JPG" border="0" /&gt;&lt;/a&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;p&gt;Add code to the Click event of the button as shown below: &lt;/p&gt;&lt;p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;pre&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt;&lt;span style="color:#000000;"&gt; System;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt;&lt;span style="color:#000000;"&gt; System.ComponentModel;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt;&lt;span style="color:#000000;"&gt; System.Drawing;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt;&lt;span style="color:#000000;"&gt; System.Windows.Forms;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;namespace&lt;/span&gt;&lt;span style="color:#000000;"&gt; MyApplet&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;class&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span style="color:#33ccff;"&gt;TimeControl&lt;/span&gt; : &lt;span style="color:#33ccff;"&gt;UserControl&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; TimeControl()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            InitializeComponent();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; btnShowTime_Click(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt;&lt;span style="color:#000000;"&gt; sender, &lt;span style="color:#33ccff;"&gt;&lt;span style="color:#33ccff;"&gt;EventArgs&lt;/span&gt; &lt;/span&gt;e)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            txtTime.Text &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span style="color:#33ccff;"&gt;DateTime&lt;/span&gt;.Now.ToString();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; ShowTime(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt;&lt;span style="color:#000000;"&gt; sender, &lt;span style="color:#33ccff;"&gt;&lt;span style="color:#33ccff;"&gt;EventArgs&lt;/span&gt; &lt;/span&gt;e)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            txtTime.Text &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span style="color:#33ccff;"&gt;DateTime&lt;/span&gt;.Now.ToString();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:trebuchet ms;"&gt;Now that you have your control, you need to create an application that hosts it. In this example we will use Internet Explorer as host. &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:trebuchet ms;"&gt;So &lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;add a new website to your solution. Within the default.aspx page, you will create a reference to your control via an object tag. To be able to do this, you need to copy the DLL to your website. Don't copy it in the bin folder because that folder isn't browsable. T&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;he object tag will look like this:&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:#3366ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#993300;"&gt;object &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="color:#3366ff;"&gt;="applet1" &lt;span style="color:#ff0000;"&gt;classid&lt;/span&gt;="http:MyApplet.dll#MyApplet.TimeControl"&amp;gt;&amp;lt;/&lt;span style="color:#993300;"&gt;object&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:trebuchet ms;"&gt;The classid needs to be in the format &lt;em&gt;&lt;span style="color:#3366ff;"&gt;&lt;strong&gt;http:NameOfDll.dll#&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;em&gt;&lt;span style="color:#3366ff;"&gt;&lt;strong&gt;Namespace.ClassName&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;.&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:trebuchet ms;"&gt;NOTE: It is best to use a separate tag to close the object, otherwise the tags after the object tag can give problems.&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:trebuchet ms;"&gt;If you now run the example it should look like the screen below:&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt; &lt;a href="http://3.bp.blogspot.com/_DMJte_aP-lA/RYkNa0ocQ8I/AAAAAAAAAAs/Kjs9co7MOLk/s1600-h/Screenshot.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5010550814882415554" style="CURSOR: hand" alt="" src="http://3.bp.blogspot.com/_DMJte_aP-lA/RYkNa0ocQ8I/AAAAAAAAAAs/Kjs9co7MOLk/s320/Screenshot.JPG" border="0" /&gt;&lt;/a&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="font-family:trebuchet ms;"&gt;Note:&lt;/span&gt;&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;.NET applets are restricted to Internet Explorer.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:trebuchet ms;"&gt;In some companies ActiveX components are not allowed.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-6179047558303081049?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/6179047558303081049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=6179047558303081049' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/6179047558303081049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/6179047558303081049'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2006/12/my-first-net-applet.html' title='My first .NET Applet'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_DMJte_aP-lA/RYkOXUocQ9I/AAAAAAAAAA4/6QiphzIV4Nw/s72-c/UserControl.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-65652518304369939</id><published>2006-12-19T13:56:00.000+01:00</published><updated>2007-01-05T09:15:23.703+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2005'/><title type='text'>Microsoft® Visual Studio® 2005 Service Pack 1</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;Microsoft has released a Service Pack for the Visual Studio 2005 products. Fixes in the Service Pack include stability, perfomance and security enhancements made in many areas of the product. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Additional info:&lt;/span&gt;&lt;br /&gt;&lt;a href="http://support.microsoft.com/?kbid=928957"&gt;&lt;span style="font-family:trebuchet ms;"&gt;http://support.microsoft.com/?kbid=928957&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Download:&lt;br /&gt;&lt;/span&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=BB4A75AB-E2D4-4C96-B39D-37BAF6B5B1DC&amp;displaylang=en"&gt;&lt;span style="font-family:trebuchet ms;"&gt;http://www.microsoft.com/downloads/details.aspx?familyid=BB4A75AB-E2D4-4C96-B39D-37BAF6B5B1DC&amp;amp;displaylang=en&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-65652518304369939?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/65652518304369939/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=65652518304369939' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/65652518304369939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/65652518304369939'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2006/12/microsoft-visual-studio-2005-service.html' title='Microsoft® Visual Studio® 2005 Service Pack 1'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-1887683526209256819</id><published>2006-12-14T13:44:00.000+01:00</published><updated>2007-01-05T09:12:43.696+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='Web Services'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 2.0'/><title type='text'>Editing a .NET project file from within the WSDL tool</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;For one of my projects I had the need to customize the proxy classes created by the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0" onclick="BLOG_clickHandler(this)"&gt;WSDL&lt;/span&gt; tool when performing "Add Web Reference..." within Visual Studio .NET 2005. When the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1" onclick="BLOG_clickHandler(this)"&gt;WSDL&lt;/span&gt; tool detects a class that it doesn't recognize, it creates a new class definition within the proxy class. In case of having this new class definition, I wanted to use my own class definition.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;After googling a while, I bounced on an article from &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2" onclick="BLOG_clickHandler(this)"&gt;Jelle&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3" onclick="BLOG_clickHandler(this)"&gt;Druyts&lt;/span&gt; who explained exactly what I needed (&lt;/span&gt;&lt;a href="http://www.microsoft.com/belux/msdn/nl/community/columns/jdruyts/wsproxy.mspx"&gt;&lt;span style="font-family:trebuchet ms;"&gt;Article&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:trebuchet ms;"&gt;). &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;The only difference for my particular scenario was the need for a file with the mappings in the project folder. The problem is that when implementing a custom class that extends the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4" onclick="BLOG_clickHandler(this)"&gt;SchemaImporterExtension&lt;/span&gt;, you don't have immediate access to the calling project.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;With a little help from a colleague, &lt;a href="http://pointerx.net/blogs/glozano/default.aspx"&gt;Gabriel &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5" onclick="BLOG_clickHandler(this)"&gt;Lozano&lt;/span&gt;-&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6" onclick="BLOG_clickHandler(this)"&gt;Morán&lt;/span&gt;&lt;/a&gt;, I succeeded to get a reference to the calling project.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;This is the code to retrieve the calling project from within the custom &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7" onclick="BLOG_clickHandler(this)"&gt;SchemaImporterExtension&lt;/span&gt;:&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8" onclick="BLOG_clickHandler(this)"&gt;EnvDTE&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt;&lt;span style="color:#000000;"&gt; System;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt;&lt;span style="color:#000000;"&gt; System.Collections;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt;&lt;span style="color:#000000;"&gt; System.Runtime.InteropServices;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt;&lt;span style="color:#000000;"&gt; System.Runtime.InteropServices.ComTypes;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;p&gt;&lt;span style="color:#0000ff;"&gt;&lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;class&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9" onclick="BLOG_clickHandler(this)"&gt;CallingClass&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt;  &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;static&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10" onclick="BLOG_clickHandler(this)"&gt;ChangeProjectName&lt;/span&gt;(&lt;span style="color:#6666cc;"&gt;string&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11" onclick="BLOG_clickHandler(this)"&gt;newName&lt;/span&gt;)&lt;br /&gt;  {&lt;br /&gt;    _&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12" onclick="BLOG_clickHandler(this)"&gt;DTE&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13" onclick="BLOG_clickHandler(this)"&gt;ide&lt;/span&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14" onclick="BLOG_clickHandler(this)"&gt;DTEHelper&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15" onclick="BLOG_clickHandler(this)"&gt;GetCurrentIDE&lt;/span&gt;();&lt;br /&gt;    Array &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16" onclick="BLOG_clickHandler(this)"&gt;projs&lt;/span&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; (Array)&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17" onclick="BLOG_clickHandler(this)"&gt;ide&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18" onclick="BLOG_clickHandler(this)"&gt;ActiveSolutionProjects&lt;/span&gt;;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:#009900;"&gt;    // The &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19" onclick="BLOG_clickHandler(this)"&gt;proj&lt;/span&gt; object allows you to edit the project.&lt;/span&gt;&lt;br /&gt;    Project &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20" onclick="BLOG_clickHandler(this)"&gt;proj&lt;/span&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; (Project)&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_21" onclick="BLOG_clickHandler(this)"&gt;projs&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22" onclick="BLOG_clickHandler(this)"&gt;GetValue&lt;/span&gt;(&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;0&lt;/span&gt;&lt;span style="color:#000000;"&gt;);&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;    &lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_23" onclick="BLOG_clickHandler(this)"&gt;proj&lt;/span&gt;.Name = &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_24" onclick="BLOG_clickHandler(this)"&gt;newName&lt;/span&gt;;&lt;br /&gt;  }&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;static&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;class&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_25" onclick="BLOG_clickHandler(this)"&gt;DTEHelper&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt;  [&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_26" onclick="BLOG_clickHandler(this)"&gt;DllImport&lt;/span&gt;(&lt;/span&gt;&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&lt;span style="color:#008080;"&gt;ole32.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_27" onclick="BLOG_clickHandler(this)"&gt;dll&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&lt;span style="color:#000000;"&gt;)]&lt;br /&gt;  &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;static&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_28" onclick="BLOG_clickHandler(this)"&gt;extern&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_29" onclick="BLOG_clickHandler(this)"&gt;uint&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_30" onclick="BLOG_clickHandler(this)"&gt;GetRunningObjectTable&lt;/span&gt;(&lt;br /&gt;     &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_31" onclick="BLOG_clickHandler(this)"&gt;uint&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; reserved, &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;out&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_32" onclick="BLOG_clickHandler(this)"&gt;IRunningObjectTable&lt;/span&gt; ROT);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;&lt;br /&gt;  [&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_33" onclick="BLOG_clickHandler(this)"&gt;DllImport&lt;/span&gt;(&lt;/span&gt;&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&lt;span style="color:#008080;"&gt;ole32.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_34" onclick="BLOG_clickHandler(this)"&gt;dll&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&lt;span style="color:#000000;"&gt;)]&lt;br /&gt;  &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;static&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_35" onclick="BLOG_clickHandler(this)"&gt;extern&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_36" onclick="BLOG_clickHandler(this)"&gt;uint&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_37" onclick="BLOG_clickHandler(this)"&gt;CreateBindCtx&lt;/span&gt;(&lt;br /&gt;     &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_38" onclick="BLOG_clickHandler(this)"&gt;uint&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; reserved, &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;out&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_39" onclick="BLOG_clickHandler(this)"&gt;IBindCtx&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_40" onclick="BLOG_clickHandler(this)"&gt;ctx&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:#000000;"&gt;&lt;br /&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;static&lt;/span&gt;&lt;span style="color:#000000;"&gt; _&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_41" onclick="BLOG_clickHandler(this)"&gt;DTE&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_42" onclick="BLOG_clickHandler(this)"&gt;GetCurrentIDE&lt;/span&gt;()&lt;br /&gt;  {&lt;br /&gt;    &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_43" onclick="BLOG_clickHandler(this)"&gt;IRunningObjectTable&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_44" onclick="BLOG_clickHandler(this)"&gt;runningObjectTable&lt;/span&gt;;&lt;br /&gt;    &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_45" onclick="BLOG_clickHandler(this)"&gt;IEnumMoniker&lt;/span&gt; iterator;&lt;br /&gt;    &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_46" onclick="BLOG_clickHandler(this)"&gt;IMoniker&lt;/span&gt;[] monikers &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_47" onclick="BLOG_clickHandler(this)"&gt;IMoniker&lt;/span&gt;[&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;1&lt;/span&gt;&lt;span style="color:#000000;"&gt;];&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:#000000;"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;int&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_48" onclick="BLOG_clickHandler(this)"&gt;currProcId&lt;/span&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;br /&gt;        System.Diagnostics.Process.GetCurrentProcess().Id;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    &lt;span style="color:#008000;"&gt;//&lt;/span&gt;&lt;span style="color:#008000;"&gt; Get a pointer to the running object table.&lt;/span&gt;&lt;span style="color:#008000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;    &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_49" onclick="BLOG_clickHandler(this)"&gt;GetRunningObjectTable&lt;/span&gt;(&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;0&lt;/span&gt;&lt;span style="color:#000000;"&gt;, &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;out&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_50" onclick="BLOG_clickHandler(this)"&gt;runningObjectTable&lt;/span&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    &lt;span style="color:#008000;"&gt;//&lt;/span&gt;&lt;span style="color:#008000;"&gt; Enumerator to loop through the running objects.&lt;/span&gt;&lt;span style="color:#008000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;    &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_51" onclick="BLOG_clickHandler(this)"&gt;runningObjectTable&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_52" onclick="BLOG_clickHandler(this)"&gt;EnumRunning&lt;/span&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;out&lt;/span&gt;&lt;span style="color:#000000;"&gt; iterator);&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    &lt;span style="color:#008000;"&gt;//&lt;/span&gt;&lt;span style="color:#008000;"&gt; Reset the enumeration sequence to the beginning.&lt;/span&gt;&lt;span style="color:#008000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;    iterator.Reset();&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    &lt;span style="color:#000000;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_53" onclick="BLOG_clickHandler(this)"&gt;IntPtr&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_54" onclick="BLOG_clickHandler(this)"&gt;numberFetched&lt;/span&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_55" onclick="BLOG_clickHandler(this)"&gt;IntPtr&lt;/span&gt;.Zero;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;while&lt;/span&gt;&lt;span style="color:#000000;"&gt; (iterator.Next(&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;1&lt;/span&gt;&lt;span style="color:#000000;"&gt;,&lt;br /&gt;                         &lt;/span&gt;&lt;span style="color:#000000;"&gt;monikers,&lt;br /&gt;                         &lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_56" onclick="BLOG_clickHandler(this)"&gt;numberFetched&lt;/span&gt;) &lt;/span&gt;&lt;span style="color:#000000;"&gt;==&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;0&lt;/span&gt;&lt;span style="color:#000000;"&gt;)&lt;br /&gt;    {&lt;br /&gt;      &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_57" onclick="BLOG_clickHandler(this)"&gt;IBindCtx&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_58" onclick="BLOG_clickHandler(this)"&gt;ctx&lt;/span&gt;;&lt;br /&gt;      &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_59" onclick="BLOG_clickHandler(this)"&gt;CreateBindCtx&lt;/span&gt;(&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;0&lt;/span&gt;&lt;span style="color:#000000;"&gt;, &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;out&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_60" onclick="BLOG_clickHandler(this)"&gt;ctx&lt;/span&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;      &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_61" onclick="BLOG_clickHandler(this)"&gt;runningObjectName&lt;/span&gt;;&lt;br /&gt;      monikers[&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;0&lt;/span&gt;&lt;span style="color:#000000;"&gt;].&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_62" onclick="BLOG_clickHandler(this)"&gt;GetDisplayName&lt;/span&gt;(&lt;br /&gt;         &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_63" onclick="BLOG_clickHandler(this)"&gt;ctx&lt;/span&gt;, &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;&lt;span style="color:#000000;"&gt;, &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;out&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_64" onclick="BLOG_clickHandler(this)"&gt;runningObjectName&lt;/span&gt;);&lt;br /&gt;      Marshal.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_65" onclick="BLOG_clickHandler(this)"&gt;ReleaseComObject&lt;/span&gt;(&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_66" onclick="BLOG_clickHandler(this)"&gt;ctx&lt;/span&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;      &lt;span style="color:#0000ff;"&gt;object&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_67" onclick="BLOG_clickHandler(this)"&gt;runningObjectValue&lt;/span&gt;;&lt;br /&gt;      &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_68" onclick="BLOG_clickHandler(this)"&gt;runningObjectTable&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_69" onclick="BLOG_clickHandler(this)"&gt;GetObject&lt;/span&gt;(&lt;br /&gt;         monikers[&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;0&lt;/span&gt;&lt;span style="color:#000000;"&gt;], &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;out&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_70" onclick="BLOG_clickHandler(this)"&gt;runningObjectValue&lt;/span&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;      &lt;span style="color:#008000;"&gt;//&lt;/span&gt;&lt;span style="color:#008000;"&gt; Reference to the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_71" onclick="BLOG_clickHandler(this)"&gt;IDE&lt;/span&gt; if the object &lt;/span&gt;&lt;span style="color:#008000;"&gt;is the&lt;br /&gt;      &lt;/span&gt;&lt;span style="color:#008000;"&gt;// current Visual Studio environment.&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;      &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt;&lt;span style="color:#000000;"&gt; (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_72" onclick="BLOG_clickHandler(this)"&gt;runningObjectName&lt;/span&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;==&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;br /&gt;          String.Format(&lt;/span&gt;&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&lt;span style="color:#008080;"&gt;!VisualStudio.DTE.8.0:{0}&lt;/span&gt;&lt;span style="color:#000000;"&gt;"&lt;/span&gt;&lt;span style="color:#000000;"&gt;,&lt;br /&gt;                         &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_73" onclick="BLOG_clickHandler(this)"&gt;currProcId&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_74" onclick="BLOG_clickHandler(this)"&gt;ToString&lt;/span&gt;()))&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;return&lt;/span&gt;&lt;span style="color:#000000;"&gt; (_&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_75" onclick="BLOG_clickHandler(this)"&gt;DTE&lt;/span&gt;)&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_76" onclick="BLOG_clickHandler(this)"&gt;runningObjectValue&lt;/span&gt;;&lt;br /&gt;    }&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;&lt;span style="color:#000000;"&gt;;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-1887683526209256819?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/1887683526209256819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=1887683526209256819' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/1887683526209256819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/1887683526209256819'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2006/12/reference-to-calling-visual-studio-2005.html' title='Editing a .NET project file from within the WSDL tool'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5274981767425509778.post-6992029765610467238</id><published>2006-12-14T13:27:00.000+01:00</published><updated>2006-12-14T18:15:35.273+01:00</updated><title type='text'>First post !</title><content type='html'>&lt;span style="font-family:trebuchet ms;"&gt;Hi all,&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;Welcome to my blog. Since this is my first blog it can take a while to get something decent on it! Anyway, it is the intention to write down some of my experiences that I gained during my career as a developer. I will mostly focus this blog on .NET and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0" onclick="BLOG_clickHandler(this)"&gt;SQL&lt;/span&gt; Server related topics.&lt;br /&gt;&lt;br /&gt;If you have any questions or comments, feel free to contact me!&lt;br /&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1" onclick="BLOG_clickHandler(this)"&gt;Geert&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5274981767425509778-6992029765610467238?l=geertverhoeven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geertverhoeven.blogspot.com/feeds/6992029765610467238/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5274981767425509778&amp;postID=6992029765610467238' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/6992029765610467238'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5274981767425509778/posts/default/6992029765610467238'/><link rel='alternate' type='text/html' href='http://geertverhoeven.blogspot.com/2006/12/hi-all-welcome-to-my-blog.html' title='First post !'/><author><name>Geert Verhoeven</name><uri>http://www.blogger.com/profile/04897992588367919830</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
