<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">Pascal Belaud [MSFT]</title><subtitle type="html">OlyMars: SQL Server Centric .NET Code Generator</subtitle><id>http://blogs.msdn.com/olymars/atom.xml</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/olymars/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/olymars/atom.xml" /><generator uri="http://communityserver.org" version="2.1.61025.2">Community Server</generator><updated>2004-06-08T07:13:00Z</updated><entry><title>You can now write your OlyMars Refresh templates inside Visual Studio 2008!</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/olymars/archive/2008/03/20/you-can-now-write-your-olymars-templates-inside-visual-studio-2008.aspx" /><id>http://blogs.msdn.com/olymars/archive/2008/03/20/you-can-now-write-your-olymars-templates-inside-visual-studio-2008.aspx</id><published>2008-03-20T13:05:00Z</published><updated>2008-03-20T13:05:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;I'm really happy to announce that starting from the build &lt;STRONG&gt;v1.5.8.37058&lt;/STRONG&gt;, you can now &lt;STRONG&gt;write your own templates directly from Visual Studio 2008&lt;/STRONG&gt;. &lt;/FONT&gt;&lt;FONT face=Tahoma size=2&gt;You will then benefit from all the &lt;STRONG&gt;good&lt;/STRONG&gt; Visual Studio features such as &lt;STRONG&gt;Intellisense&lt;/STRONG&gt;, &lt;STRONG&gt;debugging&lt;/STRONG&gt;, &lt;STRONG&gt;syntax coloration&lt;/STRONG&gt; and so forth! &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;I have recorded a &lt;STRONG&gt;webcast&lt;/STRONG&gt; to demonstrate how to install and use this new feature. You can find it in the &lt;STRONG&gt;Resources&lt;/STRONG&gt; section of &lt;A class="" title="OlyMars Refresh Portal" href="http://www.olymars.net/" target=_blank mce_href="http://www.olymars.net"&gt;OlyMars&amp;nbsp;Refresh&amp;nbsp;portal&lt;/A&gt;. You will find below a screen shot of a table based template &lt;STRONG&gt;written inside Visual Studio 2008&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;Enjoy!&lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;A href="http://blogs.msdn.com/blogfiles/olymars/WindowsLiveWriter/YoucannowwriteyourOlyMarstemplatesinside_909E/TemplateInsideVisualStudio2008_2.png" mce_href="http://blogs.msdn.com/blogfiles/olymars/WindowsLiveWriter/YoucannowwriteyourOlyMarstemplatesinside_909E/TemplateInsideVisualStudio2008_2.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=284 alt=TemplateInsideVisualStudio2008 src="http://blogs.msdn.com/blogfiles/olymars/WindowsLiveWriter/YoucannowwriteyourOlyMarstemplatesinside_909E/TemplateInsideVisualStudio2008_thumb.png" width=361 border=0 mce_src="http://blogs.msdn.com/blogfiles/olymars/WindowsLiveWriter/YoucannowwriteyourOlyMarstemplatesinside_909E/TemplateInsideVisualStudio2008_thumb.png"&gt;&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8327193" width="1" height="1"&gt;</content><author><name>olymars</name><uri>http://blogs.msdn.com/members/olymars.aspx</uri></author></entry><entry><title>Release Candidate 1 (v1.5.7.33290) of OlyMars Refresh is now available</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/olymars/archive/2008/03/12/release-candidate-1-v1-5-7-33290-of-olymars-refresh-is-now-available.aspx" /><id>http://blogs.msdn.com/olymars/archive/2008/03/12/release-candidate-1-v1-5-7-33290-of-olymars-refresh-is-now-available.aspx</id><published>2008-03-13T00:58:00Z</published><updated>2008-03-13T00:58:00Z</updated><content type="html">&lt;P&gt;The &lt;STRONG&gt;Release Candidate 1 (RC1)&lt;/STRONG&gt; of &lt;STRONG&gt;OlyMars Refresh&lt;/STRONG&gt; has been &lt;STRONG&gt;released&lt;/STRONG&gt; yesterday. It is now available on &lt;A class="" title="OlyMars Refresh Portal" href="http://www.olymars.net/" target=_blank mce_href="http://www.olymars.net"&gt;http://www.olymars.net&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This build supports both &lt;STRONG&gt;SQL Server 2005&lt;/STRONG&gt; and &lt;STRONG&gt;SQL server 2008 (CTP6)&lt;/STRONG&gt; as long as &lt;STRONG&gt;Visual Studio 2005&lt;/STRONG&gt; and &lt;STRONG&gt;Visual Studio 2008&lt;/STRONG&gt;. If you want to test this version, please do go the &lt;STRONG&gt;OlyMars Refresh portal&lt;/STRONG&gt; (&lt;A class="" title="OlyMars Refresh portal" href="http://www.olymars.net/" target=_blank mce_href="http://www.olymars.net"&gt;http://www.olymars.net&lt;/A&gt;) and ask for an account to get access to the latest build.&lt;/P&gt;
&lt;P&gt;RC1 = v1.5.7.33290&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8174760" width="1" height="1"&gt;</content><author><name>olymars</name><uri>http://blogs.msdn.com/members/olymars.aspx</uri></author></entry><entry><title>Adding the content of a whole directory in your Visual Studio 2005 project as linked source files? It's now possible with the "AddDirectoryContent" AddIn</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/olymars/archive/2006/10/25/ajouter-le-contenu-de-tout-un-r-pertoire-sous-forme-de-fichiers-de-code-source-li-s-dans-visual-studio-2005-c-est-maintenant-possible-avec-l-addin-adddirectorycontent.aspx" /><id>http://blogs.msdn.com/olymars/archive/2006/10/25/ajouter-le-contenu-de-tout-un-r-pertoire-sous-forme-de-fichiers-de-code-source-li-s-dans-visual-studio-2005-c-est-maintenant-possible-avec-l-addin-adddirectorycontent.aspx</id><published>2006-10-25T13:54:00Z</published><updated>2006-10-25T13:54:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;I often need to add the source code&amp;nbsp;&lt;STRONG&gt;content&lt;/STRONG&gt; of a whole &lt;STRONG&gt;directory&lt;/STRONG&gt; to my &lt;STRONG&gt;Visual Studio 2005&lt;/STRONG&gt; projects.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;That's the case when I use OlyMars for my own developement projects. Usually, what I need is to add a &lt;STRONG&gt;link&lt;/STRONG&gt; to the source files that have been generated by OlyMars. I want this as a link because I want to be sure that my custom projects using the generated code are always up to date even if I regenerate the code.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;If you simply drag and drop a folder in Visual Studio 2005, an actual copy of the files is made, not a link to them.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma&gt;This is precisely why I have written a Visual Studio 2005 AddIn named &lt;FONT size=2&gt;&lt;STRONG&gt;Add Directory Content&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;To &lt;STRONG&gt;download&lt;/STRONG&gt; the latest version of this &lt;STRONG&gt;FREE&lt;/STRONG&gt; AddIn : &lt;/FONT&gt;&lt;A href="http://www.msfrancedev.net/AddDirectoryContent/AddDirectoryContentSetup.msi" mce_href="http://www.msfrancedev.net/AddDirectoryContent/AddDirectoryContentSetup.msi"&gt;&lt;FONT face=Tahoma color=#006bad size=2&gt;&lt;STRONG&gt;http://www.msfrancedev.net/AddDirectoryContent/AddDirectoryContentSetup.msi&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;Once installed, its use is very very simple. First, open your Visual Studio project. Then, &lt;STRONG&gt;create a directory&lt;/STRONG&gt; in your project structure which will host the linked files. You can skip this directory creation if you like. In this case, the files will be added to &lt;STRONG&gt;your project root&lt;/STRONG&gt;. To &lt;STRONG&gt;run&lt;/STRONG&gt; this AddIn, all you have to do is to go to&amp;nbsp;your Visual Studio 2005&amp;nbsp;&lt;STRONG&gt;Tools&lt;/STRONG&gt; menu and hit the&amp;nbsp;&lt;STRONG&gt;Add Directory Content&lt;/STRONG&gt; menu.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.msfrancedev.net/AddDirectoryContent/Capture01.jpg" target=_blank mce_href="http://www.msfrancedev.net/AddDirectoryContent/Capture01.jpg"&gt;&lt;FONT face=Tahoma size=2&gt;&lt;IMG src="http://www.msfrancedev.net/AddDirectoryContent/Capture01.jpg" width="50%" mce_src="http://www.msfrancedev.net/AddDirectoryContent/Capture01.jpg"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma size=2&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;Then, locate the directory where your source code is stored. You can include the subdirectories by checking the corresponding CheckBox. This AddIn can also recreate the same folder structure in your Visual Studio 2005 project than&amp;nbsp;in your actual directory. Finally, you can filter the files to be added to your projects.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.msfrancedev.net/AddDirectoryContent/Capture02.jpg" target=_blank mce_href="http://www.msfrancedev.net/AddDirectoryContent/Capture02.jpg"&gt;&lt;FONT face=Tahoma size=2&gt;&lt;IMG src="http://www.msfrancedev.net/AddDirectoryContent/Capture02.jpg" width="50%" mce_src="http://www.msfrancedev.net/AddDirectoryContent/Capture02.jpg"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;At the end of the process, a quick summary is displayed.&lt;/FONT&gt;&lt;/P&gt;&lt;A href="http://www.msfrancedev.net/AddDirectoryContent/Capture03.jpg" target=_blank mce_href="http://www.msfrancedev.net/AddDirectoryContent/Capture03.jpg"&gt;&lt;FONT face=Tahoma size=2&gt;&lt;IMG src="http://www.msfrancedev.net/AddDirectoryContent/Capture03.jpg" width="50%" mce_src="http://www.msfrancedev.net/AddDirectoryContent/Capture03.jpg"&gt;&lt;/FONT&gt;&lt;/A&gt; 
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;You are done&amp;nbsp;! All the files were correctly added to your project and now, each time the original files are changed, your project will pickup the changes right away!&lt;/FONT&gt;&lt;/P&gt;&lt;A href="http://www.msfrancedev.net/AddDirectoryContent/Capture04.jpg" target=_blank mce_href="http://www.msfrancedev.net/AddDirectoryContent/Capture04.jpg"&gt;&lt;FONT face=Tahoma size=2&gt;&lt;IMG src="http://www.msfrancedev.net/AddDirectoryContent/Capture04.jpg" mce_src="http://www.msfrancedev.net/AddDirectoryContent/Capture04.jpg"&gt;&lt;/FONT&gt;&lt;/A&gt; 
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;Note that if you try to add an existing file to your project, an error message will be generated. You can treat this as a simple warning. No harm here.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;If you have any &lt;STRONG&gt;feedback&lt;/STRONG&gt; on this AddIn, you can use the Comment section of this post.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma size=2&gt;Enjoy !&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=872623" width="1" height="1"&gt;</content><author><name>olymars</name><uri>http://blogs.msdn.com/members/olymars.aspx</uri></author></entry><entry><title>OlyMars Refresh will be presented at TechEd Europe 2006 in Barcelona!</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/olymars/archive/2006/10/10/OlyMars-Refresh-will-be-presented-at-TechEd-Europe-2006-in-Barcelona_2100_.aspx" /><id>http://blogs.msdn.com/olymars/archive/2006/10/10/OlyMars-Refresh-will-be-presented-at-TechEd-Europe-2006-in-Barcelona_2100_.aspx</id><published>2006-10-11T00:25:00Z</published><updated>2006-10-11T00:25:00Z</updated><content type="html">&lt;P&gt;&lt;SPAN class=Normal&gt;&lt;FONT face=Tahoma size=2&gt;I will finally be&amp;nbsp;&lt;STRONG&gt;presenting&lt;/STRONG&gt; OlyMars Refresh (v1.5) at &lt;STRONG&gt;&lt;A class="" title="TechEd Europe Developers" href="http://www.microsoft.com/europe/teched-developers" target=_blank mce_href="http://www.microsoft.com/europe/teched-developers"&gt;TechEd&lt;/A&gt; Europe Developers&amp;nbsp;2006 in&amp;nbsp;Barcelona, Spain&lt;/STRONG&gt;&amp;nbsp;in early November!&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=Normal&gt;&lt;FONT face=Tahoma size=2&gt;If you want to discover this .NET 2.0 code generator for SQL Server 2005 and you are in Barcelona for TechEd Europe 2006, feel free to attend this session.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=Normal&gt;&lt;FONT face=Tahoma&gt;Stay &lt;STRONG&gt;tuned&lt;/STRONG&gt; for more details on this session.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=Normal&gt;&lt;FONT face=Tahoma&gt;[&lt;STRONG&gt;UPDATE&lt;/STRONG&gt;] I have now more &lt;STRONG&gt;details&lt;/STRONG&gt; on this session. This session code is &lt;STRONG&gt;DEV366&lt;/STRONG&gt; and I will be presenting OlyMars Refresh on &lt;STRONG&gt;Friday, November 10th, 2006&lt;/STRONG&gt; from &lt;STRONG&gt;15:15 to 16:30&lt;/STRONG&gt;. More details on the TechEd Europe Developers web &lt;A class="" title="TechEd Europe Developers 2006" href="http://www.mseventseurope.com/Teched/06/Pre/static/Developers/SessionSearch.aspx" target=_blank mce_href="http://www.mseventseurope.com/Teched/06/Pre/static/Developers/SessionSearch.aspx"&gt;site&lt;/A&gt;. This session title is: &lt;SPAN class=sessionTitle id=_ctl0_ContentBody_SessionSearch1_DataGrid1__ctl3_Label5&gt;&lt;STRONG&gt;Boost Your Data-Driven Application Development Using SQL Server Centric .NET Code Generator [OlyMars Refresh]&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=814474" width="1" height="1"&gt;</content><author><name>olymars</name><uri>http://blogs.msdn.com/members/olymars.aspx</uri></author></entry><entry><title>First beta of OlyMars Refresh v1.5 is now available to beta participants</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/olymars/archive/2006/04/17/577569.aspx" /><id>http://blogs.msdn.com/olymars/archive/2006/04/17/577569.aspx</id><published>2006-04-17T18:57:00Z</published><updated>2006-04-17T18:57:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana size=2&gt;The first beta (Preview I) of OlyMars Refresh v1.5 is now available to beta participants.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Beta participants, if you are interested in testing this beta , just browse to the new &lt;STRONG&gt;OlyMars Refresh Portal&lt;/STRONG&gt; located at:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.olymars.net"&gt;&lt;FONT face=Verdana size=2&gt;http://www.olymars.net&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;From this portal, you will be able to download the latest builds and information on OlyMars Refresh v1.5&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=577569" width="1" height="1"&gt;</content><author><name>olymars</name><uri>http://blogs.msdn.com/members/olymars.aspx</uri></author></entry><entry><title>Olymars Refresh (v1.5) beta plan is starting</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/olymars/archive/2006/04/07/570931.aspx" /><id>http://blogs.msdn.com/olymars/archive/2006/04/07/570931.aspx</id><published>2006-04-07T19:51:00Z</published><updated>2006-04-07T19:51:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana size=2&gt;It's time to give everyone a little update on where I am on this generator!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;First, the version 2.0, code named "&lt;STRONG&gt;DroitAuBut&lt;/STRONG&gt;" is currently scheduled to be ready around &lt;STRONG&gt;Orcas&lt;/STRONG&gt; timeframe (Visual Studio 2005.vNext). Unfortunately, I don't have currently neither the resources nor the time to release anything serious before at least another 12 months.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;That said, I don't want to let my customers down while &lt;STRONG&gt;SQL Server 2005&lt;/STRONG&gt; is now broadly available. As you might know, the current version of Olymars (v1.0) does not work on SQL Server 2005 because it relies on a deprecated system table.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;The good news is that I'm currently working on a "&lt;STRONG&gt;Olymars Refresh&lt;/STRONG&gt;" version (=&amp;gt; v1.5) which is &lt;STRONG&gt;Olymars v1.0 features only but working on SQL Server 2005&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Not to mention that this version is built using &lt;STRONG&gt;Visual Studio 2005&lt;/STRONG&gt; and is designed to generate &lt;STRONG&gt;.NET 2.0 compliant code&lt;/STRONG&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;I plan to release a beta &lt;STRONG&gt;next week&lt;/STRONG&gt;. If you are interested in participating in this beta plan, please send me an email:&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;To: &lt;/FONT&gt;&lt;A href="mailto:olyfeed@microsoft.com&amp;amp;subject=Olymars%20Refresh%20Beta"&gt;&lt;FONT face=Verdana size=2&gt;olyfeed@microsoft.com&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;Subject: &lt;STRONG&gt;Olymars Refresh Beta&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;I will send you a private beta build when it is available.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Thanks for your continuous support!&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=570931" width="1" height="1"&gt;</content><author><name>olymars</name><uri>http://blogs.msdn.com/members/olymars.aspx</uri></author></entry><entry><title>SOLVED: New build of OlyMars is now available [1.0.1876.37304]</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/olymars/archive/2005/02/21/377565.aspx" /><id>http://blogs.msdn.com/olymars/archive/2005/02/21/377565.aspx</id><published>2005-02-22T05:42:00Z</published><updated>2005-02-22T05:42:00Z</updated><content type="html">&lt;p&gt;&lt;font face="Verdana" size="2"&gt;An issue has prevented users from downloading the latest build of OlyMars. &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Verdana" size="2"&gt;As a matter of fact, until &lt;strong&gt;9:00 PM GTM+1 today&lt;/strong&gt;, the latest.zip was unfortunately redirected to an old version of OlyMars [1.0.1697.21165]. If you have downloaded your build &lt;u&gt;before 9PM GMT+1 today&lt;/u&gt;, please download again the latest build [1.0.1876.37304] by clicking &lt;a href="http://www.olymars.net/latest.zip"&gt;here&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Verdana" size="2"&gt;We are very sorry for any inconvenience.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=377565" width="1" height="1"&gt;</content><author><name>olymars</name><uri>http://blogs.msdn.com/members/olymars.aspx</uri></author></entry><entry><title>New build of OlyMars is now available [1.0.1876.37304]</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/olymars/archive/2005/02/19/376721.aspx" /><id>http://blogs.msdn.com/olymars/archive/2005/02/19/376721.aspx</id><published>2005-02-20T06:37:00Z</published><updated>2005-02-20T06:37:00Z</updated><content type="html">&lt;p&gt;&lt;font face="Verdana" size="2"&gt;I have posted a new build of OlyMars [&lt;strong&gt;1.0.1876.37304&lt;/strong&gt;] that includes the brand new &lt;em&gt;&lt;strong&gt;XML Web Services 2.0&lt;/strong&gt;&lt;/em&gt; AddOn.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Verdana" size="2"&gt;You can download this build &lt;a href="http://www.olymars.net/latest.zip"&gt;here&lt;/a&gt; &lt;/font&gt;&lt;font face="Verdana" size="2"&gt;(once unzipped, you will need to recreate the OlyMars repository).&lt;/font&gt;&lt;/p&gt; &lt;p style="MARGIN-RIGHT: 0px"&gt;&lt;font face="Verdana" size="2"&gt;&lt;strong&gt;&lt;u&gt;XML Web Services AddOn:&lt;/u&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;ul&gt; &lt;li&gt; &lt;div style="MARGIN-RIGHT: 0px"&gt;&lt;font face="Verdana" size="2"&gt;You will find a slide deck describing this new AddOn:&lt;br /&gt;&lt;font face="Courier New" color="#006400"&gt; &amp;lt;OlyMars Directory&amp;gt;\AddOns\XML Web Service\Documentation.ppt&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;&lt;/li&gt; &lt;li&gt; &lt;div style="MARGIN-RIGHT: 0px"&gt;&lt;font face="Verdana" size="2"&gt;You can also download a video that describes how to reuse this new AddOn:&lt;br /&gt;&lt;a href="http://www.olymars.net/XmlWebServicesVideo1.rar"&gt;http://www.olymars.net/XmlWebServicesVideo1.rar&lt;/a&gt;&amp;nbsp;(37’28, WMV format, 55 MB compressed)&lt;/font&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;font face="Verdana" size="2"&gt;There have been also some minor bugs corrected in this release. Finally the "&lt;strong&gt;&lt;em&gt;Check For Upgrade&lt;/em&gt;&lt;/strong&gt;" feature is working again.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Verdana" size="2"&gt;Any feedback can be redirected by email&amp;nbsp;to &lt;a href="mailto:olyfeed@microsoft.com"&gt;olyfeed@microsoft.com&lt;/a&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Verdana" size="2"&gt;Enjoy!&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=376721" width="1" height="1"&gt;</content><author><name>olymars</name><uri>http://blogs.msdn.com/members/olymars.aspx</uri></author></entry><entry><title>Need volunteers to test and help write documentation for a new enhanced implementation of XML Web Services support in OlyMars</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/olymars/archive/2005/01/11/350241.aspx" /><id>http://blogs.msdn.com/olymars/archive/2005/01/11/350241.aspx</id><published>2005-01-11T08:53:00Z</published><updated>2005-01-11T08:53:00Z</updated><content type="html">&lt;p&gt;&lt;font face="Verdana" size="2"&gt;I have enhanced the support of Xml Web Services in OlyMars and I need some volunteers to help me on this before it goes public. Of course, the documentation for this new AddOn is not available yet but this is where it goes fun!&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Verdana" size="2"&gt;Like I said, I need volunteers to test and help write documentation for&amp;nbsp;this stuff. If you are interested in helping me, please send me an email &lt;strong&gt;BY CLICKING&lt;/strong&gt; on this &lt;a href="mailto:olyfeed@microsoft.com?Subject=20050111: I'm volunteer to test the new XML Web Service AddOn&amp;amp;Body=Please send me info on how to test at the following email address:"&gt;link&lt;/a&gt; (so it can be correctly routed in my inbox).&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Verdana" size="2"&gt;Thanks for your continuous support!&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=350241" width="1" height="1"&gt;</content><author><name>olymars</name><uri>http://blogs.msdn.com/members/olymars.aspx</uri></author></entry><entry><title>PRESS RELEASE: version 2.0 is now officially available</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/olymars/archive/2004/07/08/177173.aspx" /><id>http://blogs.msdn.com/olymars/archive/2004/07/08/177173.aspx</id><published>2004-07-08T20:17:00Z</published><updated>2004-07-08T20:17:00Z</updated><content type="html">&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 'Lucida Console'"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;FONT color=#000080&gt;&lt;STRONG&gt;Arpajon Hospital (Essonne, France) - July 8th, 2004&lt;/STRONG&gt; - The Belaud Company announced officially today the availability of the version 2.0 (code named "Fanny") of its famous product line. As of today, no major blocking bug was discovered. This new release will allow Quentin, Christelle and Pascal to realize their full potential.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 'Lucida Console'"&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;FONT color=#000080&gt;&lt;STRONG&gt;Availability and pricing&lt;/STRONG&gt;&lt;BR&gt;The release team has signoff for "RTM" (Release To Manufacturer) at 09:51AM (GMT+1). This &amp;#8220;Standard&amp;#8221; version will start at around 52 centimeters for 3,920 grams.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 'Lucida Console'"&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;FONT color=#000080&gt;&lt;STRONG&gt;Launch event&lt;BR&gt;&lt;/STRONG&gt;You can expect an official launch event very soon. A new press release will be issued to keep you informed.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 'Lucida Console'"&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;FONT color=#000080&gt;&lt;STRONG&gt;About Belaud Company&lt;BR&gt;&lt;/STRONG&gt;Officially founded the June 9th, 2001 (NASDAQ "BLD"), the Belaud Company is the worldwide leader in Belaud technology based products. The previous version (1.0, code named "Quentin") was officially released on May 4th, 2000&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=177173" width="1" height="1"&gt;</content><author><name>olymars</name><uri>http://blogs.msdn.com/members/olymars.aspx</uri></author></entry><entry><title>Bug corrected in "Business Component Layer" AddOn</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/olymars/archive/2004/06/27/167122.aspx" /><id>http://blogs.msdn.com/olymars/archive/2004/06/27/167122.aspx</id><published>2004-06-27T18:22:00Z</published><updated>2004-06-27T18:22:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana size=2&gt;A bug was discovered by one of the OlyMars users (thanks to &lt;STRONG&gt;Benoit Fouletier&lt;/STRONG&gt;). This bug is related to the "Business Component Layer" AddOn.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Let's say that we have a &lt;STRONG&gt;Product&lt;/STRONG&gt; table related to a &lt;STRONG&gt;Category&lt;/STRONG&gt; table; let's say the foreign key &lt;STRONG&gt;CategoryID&lt;/STRONG&gt; in the &lt;STRONG&gt;Product&lt;/STRONG&gt; table is &lt;STRONG&gt;NOT&lt;/STRONG&gt; mandatory. If, for a given record, &lt;STRONG&gt;CategoryID&lt;/STRONG&gt; is Null, incorrect behavior occurs in the &lt;STRONG&gt;Product&lt;/STRONG&gt; class:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;Product myProduct = new Product("...", myProductID)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;if (myProduct.CategoryID.IsNull) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string categoryName = myProduct.Category.Name;&amp;nbsp;&lt;FONT color=#008000&gt;// &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#008000 size=2&gt;returns something (the first record of the table) instead of returning a Null reference&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;This bug was corrected in the latest build (&lt;STRONG&gt;1.0.1638.23471&lt;/STRONG&gt; or later). A &lt;STRONG&gt;NullReferenceException&lt;/STRONG&gt; exception is now thrown if you try to access the myProduct.&lt;STRONG&gt;Category&lt;/STRONG&gt; object whereas myProduct.&lt;STRONG&gt;CategoryID&lt;/STRONG&gt; is &lt;STRONG&gt;System.Data.SqlTypes.SqlInt32.Null&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;You need to re import back the "Business Component Layer" AddOn and rebuild the corresponding AddIn (see &amp;lt;OlyMars Directory&amp;gt;\AddOns\Business Components Layer\Documentation.mht).&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=167122" width="1" height="1"&gt;</content><author><name>olymars</name><uri>http://blogs.msdn.com/members/olymars.aspx</uri></author></entry><entry><title>How to change the default namespaces used by OlyMars during code generation</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/olymars/archive/2004/06/12/154192.aspx" /><id>http://blogs.msdn.com/olymars/archive/2004/06/12/154192.aspx</id><published>2004-06-12T23:20:00Z</published><updated>2004-06-12T23:20:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana size=2&gt;OlyMars uses the SQL Server 2000&amp;nbsp;&lt;STRONG&gt;extended properties&lt;/STRONG&gt; (read &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlpro02/html/sql02a10.asp" target=_blank&gt;&lt;FONT color=#ff0000&gt;this&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp;for more information on Extended Properties) to store various metadata, among them, the &lt;STRONG&gt;namespaces&lt;/STRONG&gt; to use during code generation.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;You can now edit the default values directly from the "BuiltIn Templates" AddIn. As a consequence, those values are not going to be asked &lt;STRONG&gt;anymore&lt;/STRONG&gt; during the first generation as it was the case before.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P align=center&gt;&lt;IMG src="http://www.olymars.net/Blogs/Capture002.jpg"&gt;&lt;/P&gt;
&lt;P align=center&gt;&lt;IMG src="http://www.olymars.net/Blogs/Capture003.jpg"&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=154192" width="1" height="1"&gt;</content><author><name>olymars</name><uri>http://blogs.msdn.com/members/olymars.aspx</uri></author></entry><entry><title>OlyMars object model has been updated</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/olymars/archive/2004/06/11/153870.aspx" /><id>http://blogs.msdn.com/olymars/archive/2004/06/11/153870.aspx</id><published>2004-06-12T06:14:00Z</published><updated>2004-06-12T06:14:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Six&amp;nbsp;new properties have been added to both the &lt;STRONG&gt;Table&lt;/STRONG&gt; and &lt;STRONG&gt;Column&lt;/STRONG&gt; objects.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Column object:&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;IsPrimaryOnlyKey&lt;/STRONG&gt;: Returns True if the column is a primary key and &lt;EM&gt;&lt;STRONG&gt;not also&lt;/STRONG&gt;&lt;/EM&gt; a foreign key&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;IsForeignOnlyKey&lt;/STRONG&gt;: Returns True if the column is a foreign key and &lt;EM&gt;&lt;STRONG&gt;not also&lt;/STRONG&gt;&lt;/EM&gt; a primary key&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Table object:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;HasPrimaryOnlyKey&lt;/STRONG&gt;: Returns True if the table has at least one primary key that is &lt;EM&gt;&lt;STRONG&gt;not also&lt;/STRONG&gt;&lt;/EM&gt; a foreign key&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;PrimaryOnlyKeys&lt;/STRONG&gt;: Returns the primary keys collection that are &lt;EM&gt;&lt;STRONG&gt;not also&lt;/STRONG&gt;&lt;/EM&gt; foreign keys of the current table&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;HasForeignOnlyKey&lt;/STRONG&gt;: Returns True if the table has at least one foreign key that is &lt;EM&gt;&lt;STRONG&gt;not also&lt;/STRONG&gt;&lt;/EM&gt; a primary key&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;ForeignOnlyKeys&lt;/STRONG&gt;: Returns the foreign keys collection that are &lt;EM&gt;&lt;STRONG&gt;not also&lt;/STRONG&gt;&lt;/EM&gt; primary keys of the current table&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;The product documentation has been updated.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=153870" width="1" height="1"&gt;</content><author><name>olymars</name><uri>http://blogs.msdn.com/members/olymars.aspx</uri></author></entry><entry><title>New features in the "TreeNode Factory" AddOn</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/olymars/archive/2004/06/09/151507.aspx" /><id>http://blogs.msdn.com/olymars/archive/2004/06/09/151507.aspx</id><published>2004-06-09T15:51:00Z</published><updated>2004-06-09T15:51:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Verdana size=2&gt;I have posted a &lt;/FONT&gt;&lt;A href="http://www.olymars.net/latest.zip"&gt;&lt;FONT face=Verdana color=#ff0000 size=2&gt;new build&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; with some enhancements and bug fixes. New features have been added to the "TreeNode Factory" AddOn (be sure to reimport the new version of this add-on into your repository).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Note that you should be familiar with this AddOn before reading this. If this is not the case, you can take a look at the documentation:&lt;BR&gt;&amp;lt;OlyMars directory&amp;gt;\AddOns\TreeNodeFactory\Documentation.mht&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=center&gt;&lt;FONT face=Verdana&gt;&lt;IMG src="http://www.olymars.net/Blogs/Capture001.jpg"&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Let's say that we have the following scenario:&lt;BR&gt;- We would like to add a parent node named "Categories"&lt;BR&gt;- We would like to add under this parent node all the categories of the database. Each time the user selects one of these nodes, he should see in the status bar the number of products of that category&lt;BR&gt;- We would like to add under each category node all the related products. We would to see the name of the product, the price of that product and the current stock number. Furthermore, each time the product current stock is less than 50, we would like the node to be red; for stock between 50 and 300, we would like it to be orange. For stock above 300, the node should be green. Each time the user selects a product, he should see in the status bar the name of the main supplier of this product. Finally, we do not want to add all the products which price is between 1000 and 1100&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;To be able to handle this scenario, we will use the new features provided in the "TreeNode Factory" AddOn:&lt;BR&gt;- A new StaticCustomTreeNode class&lt;BR&gt;- Two new events : BeforeInsert and AfterInsert&lt;BR&gt;- The ability to build dynamically both the Id and/or the Display to be used for each node by using the FormatIdDisplay event&lt;BR&gt;- The ContextOfUse has been expanded from the string type to the more general&amp;nbsp;object type allowing you to provide an enumeration instead of a string for example&lt;BR&gt;- A Columns array is now available for each StoredProcedureTreeNode. You can retrieve back all the columns for each row returned by the stored procedure call&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Here is an example on how to reuse those new features (you can download this &lt;A href="http://www.olymars.net/Blogs/TestTNF.zip"&gt;&lt;FONT color=#ff0000&gt;code&lt;/FONT&gt;&lt;/A&gt;):&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000000 size=2&gt;&lt;STRONG&gt;[Database]-----------------------------------------------------------------------------------------&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;CREATE TABLE [Category] (&lt;BR&gt;&amp;nbsp;[CategoryID] uniqueidentifier,&lt;BR&gt;&amp;nbsp;[CategoryName] [varchar] (255),&lt;BR&gt;&amp;nbsp;CONSTRAINT [PK_Category] PRIMARY KEY ([CategoryID])&lt;BR&gt;)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;CREATE TABLE [Supplier] (&lt;BR&gt;&amp;nbsp;[SupplierID] uniqueidentifier,&lt;BR&gt;&amp;nbsp;[SupplierName] [varchar] (255),&lt;BR&gt;&amp;nbsp;CONSTRAINT [PK_Supplier] PRIMARY KEY ([SupplierID])&lt;BR&gt;)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;CREATE TABLE [Product] (&lt;BR&gt;&amp;nbsp;[ProductID] uniqueidentifier,&lt;BR&gt;&amp;nbsp;[ProductName] [varchar] (255),&lt;BR&gt;&amp;nbsp;[ProductCategoryID] [uniqueidentifier],&lt;BR&gt;&amp;nbsp;[ProductPrice] [money],&lt;BR&gt;&amp;nbsp;[ProductCurrentStock] [int],&lt;BR&gt;&amp;nbsp;[ProductMainSupplierID] [uniqueidentifier],&lt;BR&gt;&amp;nbsp;CONSTRAINT [PK_Product] PRIMARY KEY ([ProductID]),&lt;BR&gt;&amp;nbsp;CONSTRAINT [FK_Product_Category] FOREIGN KEY ([ProductCategoryID]) REFERENCES [Category] ([CategoryID]),&lt;BR&gt;&amp;nbsp;CONSTRAINT [FK_Product_Supplier] FOREIGN KEY ([ProductMainSupplierID]) REFERENCES [Supplier] ([SupplierID])&lt;BR&gt;)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;CREATE Procedure [spS_xTNF_Categories] As&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;Select&lt;BR&gt;&amp;nbsp; CategoryID&lt;BR&gt;, CategoryName&lt;BR&gt;, (Select IsNull(Count(*), 0) From Product Where ProductCategoryID = CategoryID) As ProductsCount&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;From Category Order By CategoryName Asc&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;Return(@@RowCount)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;CREATE Procedure [spS_xTNF_Products] (@CategoryID uniqueidentifier) As&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;Select&lt;BR&gt;&amp;nbsp; ProductID&lt;BR&gt;, ProductName&lt;BR&gt;, ProductPrice&lt;BR&gt;, ProductCurrentStock&lt;BR&gt;, SupplierName&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;From Product Left Outer Join Supplier On ProductMainSupplierID = SupplierID&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;Where ProductCategoryID = @CategoryID Order By ProductName Asc&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000000 size=2&gt;&lt;STRONG&gt;[C#.NET]-----------------------------------------------------------------------------------------&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;using System.Data.SqlTypes;&lt;BR&gt;using SPs = DemoTNF.DataClasses.StoredProcedures;&lt;BR&gt;using DemoTNF.Windows.TreeNodeFactory;&lt;BR&gt;using SP_TNF = DemoTNF.Windows.TreeNodeFactory.StoredProcedureTreeNodeFactory;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;public FormStart() {&lt;BR&gt;&lt;FONT color=#008000&gt;&amp;nbsp;//&lt;BR&gt;&amp;nbsp;// Required for Windows Form Designer support&lt;BR&gt;&amp;nbsp;//&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;InitializeComponent();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;//&lt;BR&gt;&amp;nbsp;// TODO: Add any constructor code after InitializeComponent call&lt;BR&gt;&amp;nbsp;//&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;Init();&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;private void Init() {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;// Let's decide once for good how to connect to the back end database&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;SP_TNF.SetUpConnection(string.Empty);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;// We want to handle the following three events:&lt;BR&gt;&amp;nbsp;// FormatIdDisplay, BeforeInsert and AfterInsert&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;SP_TNF.FormatIdDisplay += new FormatIdDisplayHandler(SP_TNF_FormatIdDisplay);&lt;BR&gt;&amp;nbsp;SP_TNF.BeforeInsert += new BeforeInsertHandler(SP_TNF_BeforeInsert);&lt;BR&gt;&amp;nbsp;SP_TNF.AfterInsert += new AfterInsertHandler(SP_TNF_AfterInsert);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;// Let's create a Parent TreeNode to hold all the categories&lt;BR&gt;&amp;nbsp;// Let's use a StaticCustomTreeNode for this&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;StaticCustomTreeNode categories = new StaticCustomTreeNode(&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyContextOfUse.Categories&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, null&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, "Categories"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, true);&lt;BR&gt;&amp;nbsp;treeView1.Nodes.Add(categories);&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;private enum MyContextOfUse {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;Categories, Category, Product&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;private void treeView1_BeforeExpand(object sender, System.Windows.Forms.TreeViewCancelEventArgs e) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;// Let's get the node being expanded&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;ITreeNodeFactoryCustomTreeNode currentNode = &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;e.Node as ITreeNodeFactoryCustomTreeNode;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;// If this node is not a node coming from the TreeNodeFactory&lt;BR&gt;&amp;nbsp;// or if this node is already UpToDate, do nothing&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;if (currentNode == null || currentNode.IsUpToDate) return;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;// Depending on the context of use of the current node,&lt;BR&gt;&amp;nbsp;// let's do the right thing&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;switch ((MyContextOfUse)currentNode.ContextOfUse) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;// If we are expanding the categories node, let's&lt;BR&gt;&amp;nbsp;&amp;nbsp;// fill this node with all the categories. We are going&lt;BR&gt;&amp;nbsp;&amp;nbsp;// to call spS_xTNF_Categories stored procedure for this&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;case MyContextOfUse.Categories:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;SP_TNF.Fill_spS_xTNF_Categories(&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;currentNode.Nodes &lt;FONT color=#008000&gt;// this is the Nodes collection to fill&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, MyContextOfUse.Category &lt;FONT color=#008000&gt;// this is the context of use of the nodes being added&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, true &lt;FONT color=#008000&gt;// yes I want to purge the Nodes collection&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, true &lt;FONT color=#008000&gt;// yes I want to add a sub node to all the added nodes&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, SPs.spS_xTNF_Categories.Resultset1.Fields.Column_CategoryID.ColumnIndex &lt;FONT color=#008000&gt;// this is the column index of the primary key&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, SPs.spS_xTNF_Categories.Resultset1.Fields.Column_CategoryName.ColumnIndex &lt;FONT color=#008000&gt;// this is the index of the column to be use for display&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, true &lt;FONT color=#008000&gt;// I want to get track of all columns for each row&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;// If we are expanding a category node, let's&lt;BR&gt;&amp;nbsp;&amp;nbsp;// fill this node with all the related products. We are going&lt;BR&gt;&amp;nbsp;&amp;nbsp;// to call spS_xTNF_Products stored procedure for this&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;case MyContextOfUse.Category:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;SP_TNF.Fill_spS_xTNF_Products(&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;currentNode.Nodes &lt;FONT color=#008000&gt;// this is the Nodes collection to fill&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, MyContextOfUse.Product &lt;FONT color=#008000&gt;// this is the context of use of the nodes being added&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, true &lt;FONT color=#008000&gt;// yes I want to purge the Nodes collection&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, false &lt;FONT color=#008000&gt;// no I do not want to add a sub node to the added nodes&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, (Guid)currentNode.Id &lt;FONT color=#008000&gt;// This is the value to use for the @CategoryID stored procedure parameter&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, SPs.spS_xTNF_Products.Resultset1.Fields.Column_ProductID.ColumnIndex &lt;FONT color=#008000&gt;// this is the column index of the primary key&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, -1 &lt;FONT color=#008000&gt;// We do not want to use one specific column for the display but rather be called in the FormatdDisplay event to format this display&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, true &lt;FONT color=#008000&gt;// I want to get track of all columns for each row&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;BR&gt;&amp;nbsp;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;// Let's specify that this node is UpToDate now&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;currentNode.IsUpToDate = true;&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;private void SP_TNF_FormatIdDisplay(object sender, StoredProcedureFactoryFormatIdDisplayEventArgs e) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;switch ((MyContextOfUse)e.Node.ContextOfUse) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;// Let's decide how to format the display for our products&lt;BR&gt;&amp;nbsp;&amp;nbsp;// All the row columns are available via e.Node.Columns[]&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;case MyContextOfUse.Product:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;SqlString productName = (SqlString)e.Node.Columns[SPs.spS_xTNF_Products.Resultset1.Fields.Column_ProductName.ColumnIndex];&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;SqlMoney productPrice = (SqlMoney)e.Node.Columns[SPs.spS_xTNF_Products.Resultset1.Fields.Column_ProductPrice.ColumnIndex];&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;SqlInt32 productCurrentStock = (SqlInt32)e.Node.Columns[SPs.spS_xTNF_Products.Resultset1.Fields.Column_ProductCurrentStock.ColumnIndex];&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;e.Display = string.Format("{0} ({1:c}, {2:### ##0} in stock)", productName.Value, productPrice.Value, productCurrentStock.Value);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;private void SP_TNF_BeforeInsert(object sender, StoredProcedureFactoryBeforeInsertEventArgs e) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;switch ((MyContextOfUse)e.Node.ContextOfUse) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;// We don't want to see all products which prices are greater&lt;BR&gt;&amp;nbsp;&amp;nbsp;// than 1 000 and less than 1 100&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;case MyContextOfUse.Product:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;SqlMoney productPrice = (SqlMoney)e.Node.Columns[SPs.spS_xTNF_Products.Resultset1.Fields.Column_ProductPrice.ColumnIndex];&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;e.Cancel = (productPrice.Value &amp;gt;= 1000m &amp;amp;&amp;amp; productPrice.Value &amp;lt; 1100m);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;private void SP_TNF_AfterInsert(object sender, StoredProcedureFactoryAfterInsertEventArgs e) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;switch ((MyContextOfUse)e.Node.ContextOfUse) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;// We would like to set some color to the products nodes&lt;BR&gt;&amp;nbsp;&amp;nbsp;// Red for the products which current stock is less than 50&lt;BR&gt;&amp;nbsp;&amp;nbsp;// Orange for the products which current stock is greater than 50 and less than 300&lt;BR&gt;&amp;nbsp;&amp;nbsp;// Green for the products which current stock is greater than 300&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;case MyContextOfUse.Product:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;SqlInt32 productCurrentStock = (SqlInt32)e.Node.Columns[SPs.spS_xTNF_Products.Resultset1.Fields.Column_ProductCurrentStock.ColumnIndex];&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (productCurrentStock.Value &amp;lt; 50) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;e.Node.ForeColor = Color.Red;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;else if (&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;productCurrentStock.Value &amp;gt;= 50&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;amp;&amp;amp; productCurrentStock.Value &amp;lt; 300&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;e.Node.ForeColor = Color.Orange;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;else {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;e.Node.ForeColor = Color.Green;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;private void treeView1_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;StoredProcedureCustomTreeNode currentNode = e.Node as StoredProcedureCustomTreeNode;&lt;BR&gt;&amp;nbsp;if (currentNode == null) return;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;switch ((MyContextOfUse)currentNode.ContextOfUse) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;case MyContextOfUse.Category:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;SqlInt32 productsCount = (SqlInt32)currentNode.Columns[SPs.spS_xTNF_Categories.Resultset1.Fields.Column_ProductsCount.ColumnIndex];&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;statusBar1.Text = string.Format("This category has {0} products", productsCount.Value);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;case MyContextOfUse.Product:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;SqlString supplierName = (SqlString)currentNode.Columns[SPs.spS_xTNF_Products.Resultset1.Fields.Column_SupplierName.ColumnIndex];&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;statusBar1.Text = supplierName.IsNull ? "No supplier" : string.Format("Main supplier for this product is: {0}", supplierName.Value);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;&lt;FONT face="Courier New" color=#000000 size=2&gt;&lt;STRONG&gt;[VB.NET]-----------------------------------------------------------------------------------------&lt;BR&gt;&lt;/STRONG&gt;&lt;FONT color=#0000ff&gt;Imports System.Data.SqlTypes&lt;BR&gt;Imports SPs = DemoTNF.DataClasses.StoredProcedures&lt;BR&gt;Imports DemoTNF.Windows.TreeNodeFactory&lt;BR&gt;Imports SP_TNF = DemoTNF.Windows.TreeNodeFactory.StoredProcedureTreeNodeFactory&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;&lt;FONT face="Courier New" color=#000000 size=2&gt;&lt;FONT color=#0000ff&gt;Public Sub New()&lt;BR&gt;&amp;nbsp;MyBase.New()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;'This call is required by the Windows Form Designer.&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;InitializeComponent()&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;'Add any initialization after the InitializeComponent() call&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;Init()&lt;BR&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;Private Enum MyContextOfUse&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;Categories&lt;BR&gt;&amp;nbsp;Category&lt;BR&gt;&amp;nbsp;Product&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;End Enum&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;Private Sub Init()&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;' Let's decide once for good how to connect to the back end database&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;SP_TNF.SetUpConnection(String.Empty)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;' We want to handle the following three events:&lt;BR&gt;&amp;nbsp;' FormatIdDisplay, BeforeInsert and AfterInsert&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;AddHandler SP_TNF.FormatIdDisplay, New FormatIdDisplayHandler(AddressOf SP_TNF_FormatIdDisplay)&lt;BR&gt;&amp;nbsp;AddHandler SP_TNF.BeforeInsert, New BeforeInsertHandler(AddressOf SP_TNF_BeforeInsert)&lt;BR&gt;&amp;nbsp;AddHandler SP_TNF.AfterInsert, New AfterInsertHandler(AddressOf SP_TNF_AfterInsert)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;' Let's create a Parent TreeNode to hold all the categories&lt;BR&gt;&amp;nbsp;' Let's use a StaticCustomTreeNode for this&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;Dim categories As New StaticCustomTreeNode( _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyContextOfUse.Categories _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, Nothing _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, "Categories" _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, True)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;TreeView1.Nodes.Add(categories)&lt;BR&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;Private Sub SP_TNF_FormatIdDisplay(ByVal sender As Object, ByVal e As StoredProcedureFactoryFormatIdDisplayEventArgs)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;' Let's decide how to format the display for our products&lt;BR&gt;&amp;nbsp;' All the row columns are available via e.Node.Columns[]&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;Select Case CType(e.Node.ContextOfUse, MyContextOfUse)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;Case MyContextOfUse.Product&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim productName As SqlString = CType(e.Node.Columns(SPs.spS_xTNF_Products.Resultset1.Fields.Column_ProductName.ColumnIndex), SqlString)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim productPrice As SqlMoney = CType(e.Node.Columns(SPs.spS_xTNF_Products.Resultset1.Fields.Column_ProductPrice.ColumnIndex), SqlMoney)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim productCurrentStock As SqlInt32 = CType(e.Node.Columns(SPs.spS_xTNF_Products.Resultset1.Fields.Column_ProductCurrentStock.ColumnIndex), SqlInt32)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;e.Display = String.Format("{0} ({1:c}, {2:### ##0} in stock)", productName.Value, productPrice.Value, productCurrentStock.Value)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;End Select&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;Private Sub SP_TNF_BeforeInsert(ByVal sender As Object, ByVal e As StoredProcedureFactoryBeforeInsertEventArgs)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;' We don't want to see all products which prices are greater&lt;BR&gt;&amp;nbsp;' than 1 000 and less than 1 100&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;Select Case CType(e.Node.ContextOfUse, MyContextOfUse)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;Case MyContextOfUse.Product&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim productPrice As SqlMoney = CType(e.Node.Columns(SPs.spS_xTNF_Products.Resultset1.Fields.Column_ProductPrice.ColumnIndex), SqlMoney)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;e.Cancel = productPrice.Value &amp;gt;= 1000 And productPrice.Value &amp;lt; 1100&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;End Select&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;Private Sub SP_TNF_AfterInsert(ByVal sender As Object, ByVal e As StoredProcedureFactoryAfterInsertEventArgs)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;' We would like to set some color to the products nodes&lt;BR&gt;&amp;nbsp;' Red for the products which current stock is less than 50&lt;BR&gt;&amp;nbsp;' Orange for the products which current stock is greater than 50 and less than 300&lt;BR&gt;&amp;nbsp;' Green for the products which current stock is greater than 300&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;Select Case CType(e.Node.ContextOfUse, MyContextOfUse)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;Case MyContextOfUse.Product&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim productCurrentStock As SqlInt32 = CType(e.Node.Columns(SPs.spS_xTNF_Products.Resultset1.Fields.Column_ProductCurrentStock.ColumnIndex), SqlInt32)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;If productCurrentStock.Value &amp;lt; 50 Then&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;e.Node.ForeColor = Color.Red&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;ElseIf productCurrentStock.Value &amp;gt;= 50 And productCurrentStock.Value &amp;lt; 300 Then&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;e.Node.ForeColor = Color.Orange&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Else&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;e.Node.ForeColor = Color.Green&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;End If&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;End Select&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;Private Sub TreeView1_BeforeExpand(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewCancelEventArgs) Handles TreeView1.BeforeExpand&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;' Let's get the node being expanded&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;Dim currentNode As ITreeNodeFactoryCustomTreeNode = _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CType(e.Node, ITreeNodeFactoryCustomTreeNode)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;' If this node is not a node coming from the TreeNodeFactory&lt;BR&gt;&amp;nbsp;' or if this node is already UpToDate, do nothing&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;If currentNode Is Nothing Or currentNode.IsUpToDate Then Return&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;' Depending on the context of use of the current node,&lt;BR&gt;&amp;nbsp;' let's do the right thing&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;Select Case CType(currentNode.ContextOfUse, MyContextOfUse)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;' If we are expanding the categories node, let's&lt;BR&gt;&amp;nbsp;&amp;nbsp;' fill this node with all the categories. We are going&lt;BR&gt;&amp;nbsp;&amp;nbsp;' to call spS_xTNF_Categories stored procedure for this&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;Case MyContextOfUse.Categories&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;SP_TNF.Fill_spS_xTNF_Categories( _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentNode.Nodes _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, MyContextOfUse.Category _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, True _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, True _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, SPs.spS_xTNF_Categories.Resultset1.Fields.Column_CategoryID.ColumnIndex _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, SPs.spS_xTNF_Categories.Resultset1.Fields.Column_CategoryName.ColumnIndex _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, True _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;)&lt;BR&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' currentNode.Nodes: this is the Nodes collection to fill&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' MyContextOfUse.Category: this is the context of use of the nodes being added&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' true: yes I want to purge the Nodes collection&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' true: yes I want to add a sub node to all the added nodes&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' SPs.spS_xTNF_Categories.Resultset1.Fields.Column_CategoryID.ColumnIndex: this is the column index of the primary key&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' SPs.spS_xTNF_Categories.Resultset1.Fields.Column_CategoryName.ColumnIndex: this is the index of the column to be use for display&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' true: I want to get track of all columns for each row&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' If we are expanding a category node, let's&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' fill this node with all the related products. We are going&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' to call spS_xTNF_Products stored procedure for this&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;Case MyContextOfUse.Category&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;SP_TNF.Fill_spS_xTNF_Products( _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentNode.Nodes _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, MyContextOfUse.Product _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, True _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, False _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, New SqlGuid(CType(currentNode.Id, Guid)) _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, SPs.spS_xTNF_Products.Resultset1.Fields.Column_ProductID.ColumnIndex _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, -1 _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, True _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;)&lt;BR&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' currentNode.Nodes: this is the Nodes collection to fill&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' MyContextOfUse.Product: this is the context of use of the nodes being added&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' true: yes I want to purge the Nodes collection&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' false: no I do not want to add a sub node to the added nodes&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' (Guid)currentNode.Id: This is the value to use for the @CategoryID stored procedure parameter&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' SPs.spS_xTNF_Products.Resultset1.Fields.Column_ProductID.ColumnIndex: this is the column index of the primary key&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' -1: We do not want to use one specific column for the display but rather be called in the FormatdDisplay event to format this display&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' true: I want to get track of all columns for each row&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;End Select&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;' Let's specify that this node is UpToDate now&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;currentNode.IsUpToDate = True&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;Private Sub TreeView1_AfterSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;Dim currentNode As StoredProcedureCustomTreeNode&lt;BR&gt;&amp;nbsp;Try&lt;BR&gt;&amp;nbsp;&amp;nbsp;currentNode = CType(e.Node, StoredProcedureCustomTreeNode)&lt;BR&gt;&amp;nbsp;Catch&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;End Try&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;If currentNode Is Nothing Then Return&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;Select Case CType(currentNode.ContextOfUse, MyContextOfUse)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;Case MyContextOfUse.Category&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim productsCount As SqlInt32 = CType(currentNode.Columns(SPs.spS_xTNF_Categories.Resultset1.Fields.Column_ProductsCount.ColumnIndex), SqlInt32)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;StatusBar1.Text = String.Format("This category has {0} products", productsCount.Value)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;Case MyContextOfUse.Product&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim supplierName As SqlString = CType(currentNode.Columns(SPs.spS_xTNF_Products.Resultset1.Fields.Column_SupplierName.ColumnIndex), SqlString)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;StatusBar1.Text = IIf(supplierName.IsNull, "No supplier", String.Format("Main supplier for this product is: {0}", supplierName.Value))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;End Select&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=151507" width="1" height="1"&gt;</content><author><name>olymars</name><uri>http://blogs.msdn.com/members/olymars.aspx</uri></author></entry><entry><title>Transaction support in the "Business Component Layer" AddOn</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/olymars/archive/2004/06/08/150611.aspx" /><id>http://blogs.msdn.com/olymars/archive/2004/06/08/150611.aspx</id><published>2004-06-08T14:13:00Z</published><updated>2004-06-08T14:13:00Z</updated><content type="html">&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;I have posted a &lt;/FONT&gt;&lt;FONT face=Verdana&gt;&lt;A href="http://www.olymars.net/latest.zip"&gt;&lt;FONT color=#ff0000&gt;new build&lt;/FONT&gt;&lt;/A&gt; with some enhancements and bug fixes. A new enhancement is the transaction support that was added to the "&lt;STRONG&gt;Business Component Layer&lt;/STRONG&gt;" Add-On (be sure to reimport the new version of this Add-On into your repository). Here is an example of code:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;&lt;/FONT&gt;&lt;FONT face=Tahoma&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;[Database]--------------------------------------------------------------------&lt;BR&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;CREATE DATABASE DemoBC (&lt;BR&gt;&amp;nbsp;CREATE TABLE [Category] (&lt;BR&gt;&amp;nbsp;&amp;nbsp;[CategoryID]&amp;nbsp; uniqueidentifier -&amp;gt; ID&lt;BR&gt;&amp;nbsp;&amp;nbsp;[CategoryName] [varchar] (255), -&amp;gt; Name&lt;BR&gt;&amp;nbsp;)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;CREATE TABLE [Product] (&lt;BR&gt;&amp;nbsp;&amp;nbsp;[ProductID]&amp;nbsp; uniqueidentifier, -&amp;gt; ID&lt;BR&gt;&amp;nbsp;&amp;nbsp;[ProductName] [varchar] (255), -&amp;gt; Name&lt;BR&gt;&amp;nbsp;&amp;nbsp;[ProductCategoryID] [uniqueidentifier], -&amp;gt; CategoryID&lt;BR&gt;&amp;nbsp;&amp;nbsp;CONSTRAINT [FK_Product_Category] FOREIGN KEY&lt;BR&gt;&amp;nbsp;&amp;nbsp;([ProductCategoryID]) REFERENCES [Category] ([CategoryID])&lt;BR&gt;&amp;nbsp;)&lt;BR&gt;)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;STRONG&gt;&lt;FONT size=2&gt;[C#.NET]--------------------------------------------------------------------&lt;BR&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color=#000080 size=2&gt;using System.Data.SqlTypes;&lt;BR&gt;using System.Data.SqlClient;&lt;BR&gt;using DemoBC.BusinessComponents;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#008000&gt;// This method is going to be called from different contexts:&lt;BR&gt;// ConnectionString, SqlConnection and SqlTransaction&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;private void DoSomeStuff(Categories categories) {&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;foreach (Category myCategory in categories) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;&amp;nbsp;for (int index = 0; index &amp;lt; 10; index++) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Product newProduct = new Product();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;newProduct.Name = string.Format("Product {0}",&amp;nbsp; index);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// You do not need to do this anymore: newProduct.CategoryID = myCategory.ID&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// It is done automatically from the category products collection&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;newProduct = (Product)myCategory.Products.Add(newProduct);&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;&amp;nbsp;foreach (Product myProduct in myCategory.Products.AddedRecords) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Here is how&amp;nbsp;we can browse the newly added records&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;myProduct.Name = new SqlString(string.Format("{0} - Name was updated", myProduct.Name.Value));&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;myProduct.Update();&lt;BR&gt;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#008000&gt;// We use a connection string&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;private void button1_Click(object sender, System.EventArgs e) {&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;string connectionString = "...";&lt;BR&gt;&amp;nbsp;Categories myCategories = new Categories(connectionString);&lt;BR&gt;&amp;nbsp;DoSomeStuff(myCategories);&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#008000&gt;// We use a SqlConnection&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;private void button2_Click(object sender, System.EventArgs e) {&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;string connectionString = "...";&lt;BR&gt;&amp;nbsp;SqlConnection sqlConnection = new SqlConnection(connectionString);&lt;BR&gt;&amp;nbsp;sqlConnection.Open();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;Categories myCategories = new Categories(sqlConnection);&lt;BR&gt;&amp;nbsp;DoSomeStuff(myCategories);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008000 size=2&gt;&amp;nbsp;// Warning, if you need to keep using the objects loaded by this&lt;BR&gt;&amp;nbsp;// sqlConnection, you should NOT close the connection&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000080 size=2&gt;&amp;nbsp;sqlConnection.Close();&lt;BR&gt;}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#008000&gt;// We use a SqlTransaction&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;private void button3_Click(object sender, System.EventArgs e) {&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;string connectionString = "...";&lt;BR&gt;&amp;nbsp;SqlConnection sqlConnection = new SqlConnection(connectionString);&lt;BR&gt;&amp;nbsp;sqlConnection.Open();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;SqlTransaction sqlTransaction =&lt;BR&gt;&amp;nbsp;sqlConnection.BeginTransaction("TransactionName");&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;Categories myCategories = new Categories(sqlTransaction);&lt;BR&gt;&amp;nbsp;DoSomeStuff(myCategories);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#000080&gt;&amp;nbsp;sqlTransaction.Commit(); &lt;/FONT&gt;&lt;FONT color=#008000&gt;// or sqlTransaction.Rollback();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008000 size=2&gt;&amp;nbsp;// Warning, if you need to keep using the objects loaded by this&lt;BR&gt;&amp;nbsp;// sqlConnection, you should NOT close the connection&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000080 size=2&gt;&amp;nbsp;sqlConnection.Close();&lt;BR&gt;}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;&lt;FONT color=#000000&gt;[VB.NET]--------------------------------------------------------------------&lt;BR&gt;&lt;/FONT&gt;&lt;/STRONG&gt;Imports System.Data.SqlTypes&lt;BR&gt;Imports System.Data.SqlClient&lt;BR&gt;Imports DemoBC.BusinessComponents&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#008000&gt;' This method is going to be called from different contexts:&lt;BR&gt;' ConnectionString, SqlConnection and SqlTransaction&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;Private Sub DoSomeStuff(ByVal categories As Categories)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;For Each myCategory As Category In categories&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;&amp;nbsp;For index As Integer = 0 To 9&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim newProduct As New Product()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;newProduct.Name = String.Format("Product {0}",&amp;nbsp; index)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' You do not need to do this anymore: newProduct.CategoryID = myCategory.ID&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' It is done automatically from the category products collection&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;newProduct = CType(myCategory.Products.Add(newProduct), Product)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;&amp;nbsp;Next&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;&amp;nbsp;For Each myProduct As Product In myCategory.Products.AddedRecords&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' Here is how&amp;nbsp;we can browse the newly added records&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000080 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;myProduct.Name = New SqlString(String.Format("{0} - Name was updated", myProduct.Name.Value))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;myProduct.Update()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;&amp;nbsp;Next&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;Next&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#008000&gt;' We use a connetion string&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;Private Sub button1_Click(ByVal sender As Object , ByVal e As System.EventArgs) Handles Button1.Click&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;Dim connectionString As String = "..."&lt;BR&gt;&amp;nbsp;Dim myCategories As New Categories(connectionString)&lt;BR&gt;&amp;nbsp;DoSomeStuff(myCategories)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#008000&gt;' We use SqlConnection&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;Private Sub button2_Click(ByVal sender As Object , ByVal e As System.EventArgs) Handles Button2.Click&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;Dim connectionString As String = "..."&lt;BR&gt;&amp;nbsp;Dim sqlConnection As New SqlConnection(connectionString)&lt;BR&gt;&amp;nbsp;sqlConnection.Open()&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;Dim myCategories As New Categories(sqlConnection)&lt;BR&gt;&amp;nbsp;DoSomeStuff(myCategories)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080&gt;&lt;FONT size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;' Warning, if you need to keep using the objects loaded by this&lt;BR&gt;&amp;nbsp;' sqlConnection, you should NOT close the connection&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;sqlConnection.Close()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080&gt;&lt;FONT size=2&gt;&lt;FONT color=#008000&gt;' We use SqlTransaction&lt;BR&gt;&lt;/FONT&gt;Private Sub button3_Click(ByVal sender As Object , ByVal e As System.EventArgs) Handles Button3.Click&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;Dim connectionString As String = "..."&lt;BR&gt;&amp;nbsp;Dim sqlConnection As New SqlConnection(connectionString)&lt;BR&gt;&amp;nbsp;sqlConnection.Open()&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;Dim sqlTransaction As SqlTransaction =&lt;BR&gt;&amp;nbsp;sqlConnection.BeginTransaction("TransactionName")&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;&amp;nbsp;Dim myCategories = New Categories(sqlTransaction)&lt;BR&gt;&amp;nbsp;DoSomeStuff(myCategories)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080&gt;&lt;FONT size=2&gt;&amp;nbsp;sqlTransaction.Commit() &lt;FONT color=#008000&gt;' or sqlTransaction.Rollback()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080&gt;&lt;FONT size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;' Warning, if you need to keep using the objects loaded by this&lt;BR&gt;&amp;nbsp;' sqlConnection, you should NOT close the connection&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;sqlConnection.Close()&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000080 size=2&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=150611" width="1" height="1"&gt;</content><author><name>olymars</name><uri>http://blogs.msdn.com/members/olymars.aspx</uri></author></entry></feed>