<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Jon Sayce</title><link>http://sqlblogcasts.com/blogs/jonsayce/default.aspx</link><description>Thoughts on development - SQL Server, .NET, Visual Studio and beyond</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/JonSayce" type="application/rss+xml" /><item><title>Restart regularly to avoid Last Known Good Configuration problems</title><link>http://feedproxy.google.com/~r/JonSayce/~3/uQyHh_loclo/restart-regularly-to-avoid-last-known-good-configuration-problems.aspx</link><pubDate>Mon, 03 Nov 2008 21:04:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:10971</guid><dc:creator>jonsayce</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/jonsayce/rsscomments.aspx?PostID=10971</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/11/03/restart-regularly-to-avoid-last-known-good-configuration-problems.aspx#comments</comments><description>&lt;p&gt;Until last week I didn&amp;#39;t really know what &lt;a href="http://support.microsoft.com/kb/307852" title="MSDN" target="_blank"&gt;last known good configuration&lt;/a&gt; actually meant. It turns out that what it means is &amp;quot;I&amp;#39;m going to throw away all the settings you&amp;#39;ve changed since the previous start-up of this PC&amp;quot;, which can be a bit problematic, to say the least.&lt;br /&gt;&lt;br /&gt;We had a problem with a production server which ended up requiring a reboot. Unfortunately the server failed to restart properly and the only option left was to choose last known good configuration.&lt;br /&gt;&lt;br /&gt;The event log shows that the uptime was over 18 million seconds - the last reboot was at the end of March, 7 months ago. In this time various services had been installed, which all vanished as the system rolled back the registry changes.&lt;br /&gt;&lt;br /&gt;My advice would be to reboot as regularly as possible, so that if you do ever have to choose last known good configuration then you don&amp;#39;t wipe out too many changes.&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10971" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/JonSayce/~4/uQyHh_loclo" height="1" width="1"/&gt;</description><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/SysAdmin/default.aspx">SysAdmin</category><feedburner:origLink>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/11/03/restart-regularly-to-avoid-last-known-good-configuration-problems.aspx</feedburner:origLink></item><item><title>Missing (Hidden) ODBC Data Sources</title><link>http://feedproxy.google.com/~r/JonSayce/~3/mhZMgxB2gm8/missing-hidden-odbc-data-sources.aspx</link><pubDate>Thu, 30 Oct 2008 21:02:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:10960</guid><dc:creator>jonsayce</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/jonsayce/rsscomments.aspx?PostID=10960</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/10/30/missing-hidden-odbc-data-sources.aspx#comments</comments><description>&lt;p&gt;Have you ever created an ODBC System DSN, only to watch as it doesn&amp;#39;t appear in the list in the ODBC Data Source Administrator control panel? I recently used a PC (Windows XP SP2) where the registry showed that new DSNs were being successfully created, but the dialog refused to display them.&lt;br /&gt;&lt;br /&gt;The real problem was that I was creating the DSNs for use in a Crystal report, and they weren&amp;#39;t showing up in the list of available DSNs in the Crystal designer either.&lt;br /&gt;&lt;br /&gt;This doesn&amp;#39;t seem to be a very common problem, but I did eventually find &lt;a href="http://blogs.msdn.com/farukcelik/archive/2008/05/30/what-if-your-odbc-dsns-want-to-play-hide-and-seek-with-you.aspx" target="_blank"&gt;evidence&lt;/a&gt; that &lt;a href="http://www.tech-archive.net/Archive/Data/microsoft.public.data.odbc/2007-06/msg00038.html" target="_blank"&gt;other people&lt;/a&gt; had suffered from and fixed the same issue. &lt;br /&gt;&lt;br /&gt;Under the HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources key there&amp;#39;s a string value called (Default), which should be be empty: it will display as (value not set) in the list view:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://www.sedgely.com/blogimages/missing-hidden-odbc-data-sources/DefaultInList.png" alt="Default shown in a list" align="" border="" width="348" height="118" hspace="" /&gt;&lt;/p&gt;&lt;p&gt;or as a blank string if you open up the dialog to modify the data:&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.sedgely.com/blogimages/missing-hidden-odbc-data-sources/DefaultInDialog.png" alt="Default shown in a dialog" align="" border="" width="407" height="192" hspace="" /&gt;&lt;/p&gt;&lt;p&gt;The key point here is that the data is not a blank string, and is not the text &amp;quot;(value no set)&amp;quot; which one blogger found! It must be set to the registry equivalent of NULL.&lt;br /&gt;&lt;br /&gt;The problem can easily be recreated by clicking OK on the above dialog, rather than cancel. If you do this you&amp;#39;ll notice that (value not set) disappears from the list view, as the empty value is replaced by a blank string:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.sedgely.com/blogimages/missing-hidden-odbc-data-sources/DefaultString.png" alt="" align="" border="" width="348" height="118" hspace="" /&gt;&lt;br /&gt;Any new ODBC System DSNs will now fail to appear in the Administrator dialog, even though they are stored in the registry.&lt;br /&gt;&lt;br /&gt;To fix the problem, simply delete the (Default) value. It will be instantly recreated as (value not set), and if you re-open the Administrator dialog then all of your DSNs will now be visible. They will also show up in other applications like the Crystal designer.&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10960" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/JonSayce/~4/mhZMgxB2gm8" height="1" width="1"/&gt;</description><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/odbc/default.aspx">odbc</category><feedburner:origLink>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/10/30/missing-hidden-odbc-data-sources.aspx</feedburner:origLink></item><item><title>MobileMe and Outlook contacts: Invalid ENTRYID</title><link>http://feedproxy.google.com/~r/JonSayce/~3/baJvD37JwF4/mobileme-and-outlook-contacts-invalid-entryid.aspx</link><pubDate>Sun, 05 Oct 2008 22:20:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:10870</guid><dc:creator>jonsayce</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/jonsayce/rsscomments.aspx?PostID=10870</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/10/05/mobileme-and-outlook-contacts-invalid-entryid.aspx#comments</comments><description>&lt;p&gt;Apple&amp;#39;s &lt;a href="http://www.apple.com/mobileme/" title="MobileMe" target="_blank"&gt;MobileMe&lt;/a&gt; service has been through some troubled times since its launch in July, but they seem to have finally fixed a nasty problem which corrupted the Outlook address book.&lt;/p&gt;&lt;p&gt;Following the very first sync, Outlook contacts became unusable in emails. Hitting ctrl-k didn&amp;#39;t autocomplete the names as you&amp;#39;d expect, and clicking on the To button brought up a list of names but no email addresses. Worst of all, right-clicking and requesting the properties of a contact from this list gave the following message:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;img src="http://www.sedgely.com/blogimages/mobileme-and-outlook-contacts-invalid-entryid/InvalidEntryID.png" alt="An invalid ENTRYID was passed in" align="" border="" width="496" height="149" hspace="" /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;Recently a new version of the MobileMe control panel has been released, and the online support chat advice was as follows:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Install iTunes 8.0.1&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Install new MobileMe control panel (this happened automatically on one of my PCs) &lt;/li&gt;&lt;li&gt;Reboot&lt;/li&gt;&lt;li&gt;Sign out of MobileMe&lt;/li&gt;&lt;li&gt;Sign back in&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;At this point all sync settings had been reset and the control panel showed that syncing wasn&amp;#39;t enabled, so I would add a few extra steps:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Enable automatic syncing&lt;/li&gt;&lt;li&gt;Enable contacts&lt;/li&gt;&lt;/ul&gt;&lt;img src="http://www.sedgely.com/blogimages/mobileme-and-outlook-contacts-invalid-entryid/ControlPanel.png" alt="Control panel settings" align="" border="" width="418" height="148" hspace="" /&gt;&lt;p&gt;There seemed to be some confusion about whether the computer could really have the same name as one already in use with this account:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;img src="http://www.sedgely.com/blogimages/mobileme-and-outlook-contacts-invalid-entryid/Confusion.png" alt="Computer Name Already Registered" align="" border="" width="416" height="252" hspace="" /&gt;&lt;/p&gt;&lt;p&gt;I chose Use same name. Once this was dealt with and I hit Apply, there was a further question about how the sync should work. I selected replacing the data on the PC to get rid of all the broken ENTRYIDs (this choice only affects the first sync, not the regular merging which works in both directions):&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;img src="http://www.sedgely.com/blogimages/mobileme-and-outlook-contacts-invalid-entryid/FirstSyncAlert.png" alt="First Sync Alert" align="" border="" width="496" height="226" hspace="" /&gt;&lt;/p&gt;&lt;p&gt;The Outlook contacts were then all wiped out, and the new ones now work perfectly in emails, in the To dialog, etc.&lt;/p&gt;&lt;p&gt;Despite all the criticism of MobileMe, the contacts sync now seems to work perfectly and, to me, will be well worth £59 a year when the perpetually-extending trial period finally ends in a few month&amp;#39;s time.&lt;/p&gt;&lt;p&gt;I&amp;#39;ve never tried the calendar sync on MobileMe as I prefer the sharing functionality of Google Calendar - to sync this I use the completely awesome &lt;a href="http://www.nuevasync.com/" title="NuevaSync" target="_blank"&gt;NuevaSync&lt;/a&gt;, which is totally free and highly recommended. &lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10870" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/JonSayce/~4/baJvD37JwF4" height="1" width="1"/&gt;</description><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/MobileMe/default.aspx">MobileMe</category><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/iPhone/default.aspx">iPhone</category><feedburner:origLink>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/10/05/mobileme-and-outlook-contacts-invalid-entryid.aspx</feedburner:origLink></item><item><title>Free SQL Server 2008 E-Learning from Microsoft</title><link>http://feedproxy.google.com/~r/JonSayce/~3/73BOr5MKSlc/free-sql-server-2008-e-learning-from-microsoft.aspx</link><pubDate>Fri, 18 Apr 2008 08:12:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:10333</guid><dc:creator>jonsayce</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/jonsayce/rsscomments.aspx?PostID=10333</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/04/18/free-sql-server-2008-e-learning-from-microsoft.aspx#comments</comments><description>&lt;p&gt;Microsoft are offering three free SQL Server 2008 E-Learning courses:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;What&amp;#39;s New in Microsoft SQL Server 2008 for Database Development&lt;/li&gt;&lt;li&gt;What&amp;#39;s New in Microsoft SQL Server 2008 for Enterprise Data Platform&lt;/li&gt;&lt;li&gt;What&amp;#39;s New in Microsoft SQL Server 2008 for Business Intelligence&lt;/li&gt;&lt;/ul&gt;The courses are available at &lt;a href="http://go.microsoft.com/?linkid=8731212" target="_blank"&gt;http://go.microsoft.com/?linkid=8731212&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10333" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/JonSayce/~4/73BOr5MKSlc" height="1" width="1"/&gt;</description><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/Training/default.aspx">Training</category><feedburner:origLink>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/04/18/free-sql-server-2008-e-learning-from-microsoft.aspx</feedburner:origLink></item><item><title>New MSDN SQL Server Wiki</title><link>http://feedproxy.google.com/~r/JonSayce/~3/q3TBdULcqIk/new-msdn-sql-server-wiki.aspx</link><pubDate>Thu, 17 Apr 2008 10:35:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:10327</guid><dc:creator>jonsayce</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/jonsayce/rsscomments.aspx?PostID=10327</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/04/17/new-msdn-sql-server-wiki.aspx#comments</comments><description>&lt;p&gt;The Volunteer Moderators and Answerers who support the Microsoft MSDN SQL Server Forums have created a new wiki to present Solutions to Common T-SQL Problems at &lt;a href="http://code.msdn.microsoft.com/SQLExamples" target="_blank"&gt;http://code.msdn.microsoft.com/SQLExamples&lt;/a&gt;. At the moment mere mortals can&amp;#39;t update the solutions but you can leave comments. &lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10327" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/JonSayce/~4/q3TBdULcqIk" height="1" width="1"/&gt;</description><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/SQL/default.aspx">SQL</category><feedburner:origLink>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/04/17/new-msdn-sql-server-wiki.aspx</feedburner:origLink></item><item><title>This type of page is not served</title><link>http://feedproxy.google.com/~r/JonSayce/~3/e0AwC25wC34/this-type-of-page-is-not-served.aspx</link><pubDate>Sun, 13 Apr 2008 21:38:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:10315</guid><dc:creator>jonsayce</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/jonsayce/rsscomments.aspx?PostID=10315</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/04/13/this-type-of-page-is-not-served.aspx#comments</comments><description>&lt;p&gt;One of my experiments with ASP.NET MVC involves integration with a shopping cart product built in classic ASP. Up till now I&amp;#39;ve been happily relying on Cassini (the web server built into Visual Studio) but today I began testing the integration and ran into a problem. As soon as I requested an ASP page, my server reported that &amp;quot;This type of page is not served.&amp;quot;&lt;/p&gt;&lt;p&gt;Initially I wondered whether the default MVC web.config had somehow prevented ASP pages working, but it turns out that it&amp;#39;s nothing to do with MVC or the web.config - &lt;a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=122856" target="_blank"&gt;Cassini only works with HTML and ASPX pages&lt;/a&gt; - ASP pages must be served up from IIS. &lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10315" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/JonSayce/~4/e0AwC25wC34" height="1" width="1"/&gt;</description><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/asp/default.aspx">asp</category><feedburner:origLink>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/04/13/this-type-of-page-is-not-served.aspx</feedburner:origLink></item><item><title>MVC: Intercepting Controller and HandleUnknownException</title><link>http://feedproxy.google.com/~r/JonSayce/~3/YUSiV4QXHVo/mvc-intercepting-controller-and-handleunknownexception.aspx</link><pubDate>Tue, 25 Mar 2008 22:57:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:10230</guid><dc:creator>jonsayce</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/jonsayce/rsscomments.aspx?PostID=10230</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/03/25/mvc-intercepting-controller-and-handleunknownexception.aspx#comments</comments><description>&lt;p&gt;One of the &lt;a href="http://www.asp.net/mvc/" target="_blank" title="MVC Preview 2 Videos"&gt;recent videos&lt;/a&gt; on ASP.NET MVC covers the &lt;a href="http://www.asp.net/learn/3.5-extensions-videos/video-270.aspx" title="MVC Video 3" target="_blank"&gt;Hands On Labs&lt;/a&gt; from Mix. &lt;a href="http://www.hanselman.com/blog/" title="Scott&amp;#39;s blog" target="_blank"&gt;Scott Hanselman&lt;/a&gt; runs through a lab called the CustomControllerFactory, demonstrating how to build an intercepting controller.&lt;/p&gt;&lt;p&gt;Having followed the lab and tried the code I was left dazed and confused, and &lt;a href="http://forums.asp.net/p/1229582/2220763.aspx" title="ASP.NET forum" target="_blank"&gt;I wasn&amp;#39;t the only one&lt;/a&gt;. Life would have been easier if the code from the labs were available, but I couldn&amp;#39;t find it anywhere.&lt;/p&gt;&lt;p&gt;There seem to be two sources of confusion:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;The video doesn&amp;#39;t mention a vital addition to the Global.asax.cs file to change the controller factory&lt;/li&gt;&lt;li&gt;HandleUnknownAction ends up handling all actions&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;&lt;b&gt;&lt;u&gt;Getting the Lab Code Working&lt;/u&gt;&lt;/b&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Add a line to Application_Start (in Global.asax.cs) to set the framework to use the InterceptingControllerFactory instead of the DefaultControllerFactory: &lt;/p&gt;&lt;p&gt;&lt;img src="http://www.sedgely.com/blogimages/mvc-intercepting-controller-and-handleunknownaction/global.asax.cs.png" alt="Global.asax.cs changes" align="" border="" height="137" hspace="" width="558" /&gt;&lt;/p&gt;&lt;p&gt;With this line set, any controllers instanciated will be InterceptionControllers. Without it, the default controller factory is used and the interception classes will be completely ignored.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;u&gt;&lt;b&gt;Catching Unknown Actions&lt;/b&gt;&lt;/u&gt;&lt;/p&gt;&lt;p&gt;Once the lab code is working, you&amp;#39;ll soon notice that HandleUnknownAction is catching every single action.&lt;/p&gt;&lt;p&gt;This happens because the InterceptionController never has any actions. It&amp;#39;s a wrapper around a controller of the type specified in the URL (the controller with actions), but the InterceptionController itself doesn&amp;#39;t have any actions, so every action will trigger the HandleUnknownAction method.&lt;/p&gt;&lt;p&gt;The best way to get your head round this is to download the &lt;a href="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=11833" title="MVC Code" target="_blank"&gt;MVC code&lt;/a&gt; from CodePlex, add the project to your solution and reference it directly. It&amp;#39;s a great way to learn more about how the MVC framework does its stuff: in our example, the ProcessRequest method of the MVCHandler object creates a controller using our custom controller factory, so ProcessRequest is working with an InterceptionController.&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.sedgely.com/blogimages/mvc-intercepting-controller-and-handleunknownaction/processrequest.png" alt="ProcessRequest in the MVCHandler class" align="" border="" height="279" hspace="" width="609" /&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;When the Execute method of the InterceptionController is called, it calls InvokeAction, which checks the actions defined on the controller. InterceptionController has none, so Execute calls HandleUnknownAction and our override fires. In the video Scott uses the override to check the actionName value and decide whether or not the controller should continue.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;u&gt;Base Class&lt;/u&gt;&lt;/b&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;If you&amp;#39;re trying to catch only unknown actions then an alternative way is to define a base controller class, inheriting from controller, which overrides HandleUnknownAction:&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.sedgely.com/blogimages/mvc-intercepting-controller-and-handleunknownaction/BaseController.png" alt="" align="" border="" height="194" hspace="" width="567" /&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Now all of your controllers can inherit from this base controller:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.sedgely.com/blogimages/mvc-intercepting-controller-and-handleunknownaction/HomeController.png" alt="" align="" border="" height="244" hspace="" width="422" /&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;The controller created in ProcessRequest will now be of the type specified in the URL and will have actions defined, so HandleUnknownAction will only fire when there really is an unknown action - there is no need to filter on the actionName anymore.&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10230" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/JonSayce/~4/YUSiV4QXHVo" height="1" width="1"/&gt;</description><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/aspnetmvc/default.aspx">aspnetmvc</category><feedburner:origLink>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/03/25/mvc-intercepting-controller-and-handleunknownexception.aspx</feedburner:origLink></item><item><title>Msg 7391 - OLE DB provider SQLOLEDB was unable to begin a distributed transaction</title><link>http://feedproxy.google.com/~r/JonSayce/~3/v9sEiZJ6e5M/msg-7391-ole-db-provider-sqloledb-was-unable-to-begin-a-distributed-transaction.aspx</link><pubDate>Sat, 01 Mar 2008 11:58:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:8302</guid><dc:creator>jonsayce</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/jonsayce/rsscomments.aspx?PostID=8302</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/03/01/msg-7391-ole-db-provider-sqloledb-was-unable-to-begin-a-distributed-transaction.aspx#comments</comments><description>&lt;p&gt;This error occurred when running queries joining to a linked server, when the linked server was upgraded from Windows 2000 Windows Server 2003 SP2.&lt;br&gt;&lt;br&gt;Server: Msg 7391, Level 16, State 1, Line 1&lt;br&gt;The operation could not be performed because OLE DB provider "%ls" for linked server "%ls" was unable to begin a distributed transaction.&lt;br&gt;&lt;/p&gt;&lt;p&gt;Some common causes of the error are described &lt;a href="http://support.microsoft.com/kb/306212" target="_blank"&gt;on MSDN&lt;/a&gt; although this &lt;a href="http://support.microsoft.com/kb/816701" target="_blank"&gt;second article&lt;/a&gt; actually provided the solution we needed.&lt;br&gt;&lt;br&gt;In our case the problem turned out to be that Windows Server 2003 has DTC network access disabled by default. Turning it on is &lt;a href="http://support.microsoft.com/kb/817064" target="_blank"&gt;pretty straightforward&lt;/a&gt; but stops the SQL Server service and can require the installation media.&lt;/p&gt;&lt;p&gt;The Microsoft SQL Server Support Blog has &lt;a href="http://blogs.msdn.com/sqlblog/archive/2006/11/15/we-upgraded-our-servers-to-windows-2003-sp1-and-now-our-data-driven-application-fails-with-strange-errors.aspx" target="_blank"&gt;a post&lt;/a&gt; describing DTC settings in more detail, but we found that the default setup worked once network access had been enabled.&lt;br&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=8302" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/JonSayce/~4/v9sEiZJ6e5M" height="1" width="1"/&gt;</description><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/DTC/default.aspx">DTC</category><feedburner:origLink>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/03/01/msg-7391-ole-db-provider-sqloledb-was-unable-to-begin-a-distributed-transaction.aspx</feedburner:origLink></item><item><title>What motivates geeks?</title><link>http://feedproxy.google.com/~r/JonSayce/~3/gSmybqRhqSk/what-motivates-geeks.aspx</link><pubDate>Thu, 14 Feb 2008 13:45:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:7338</guid><dc:creator>jonsayce</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/jonsayce/rsscomments.aspx?PostID=7338</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/02/14/what-motivates-geeks.aspx#comments</comments><description>I recently moved a project from .NET 2.0 to .NET 3.5 and discovered that a method I had used to deserialize some JSON had become obsolete. This prompted much debate with my colleagues about why the .NET framework continues to change.&lt;br&gt;&lt;br&gt;The guys I was talking to both reckon that a large part of the motivation for Microsoft to keep changing the .NET Framework is just to make money. I guess in their view of the situation, the desire for change is being driven from the top, and Scott Guthrie and co. are coming up with changes to please their financially-minded masters.&lt;br&gt;&lt;br&gt;I don't buy this. I can't imagine the .NET architects sitting round a table in Redmond saying "We have been told to change things for .NET 4.0 so our users have to upgrade - can anyone think of anything we can change?"&lt;br&gt;&lt;br&gt;My view of the situation is that change is being driven from the bottom: the guys who actually design and build the Framework, who are passionate about creating the best development platform they can, are constantly hoping to improve things for the millions of developers out there using .NET.&lt;br&gt;&lt;br&gt;The fact that I'm struggling to adapt to a change in JSON deserialization is very frustrating, but I have no doubt that the person who took the decision to deprecate the old method and create the DataContractJsonSerializer class did so because they thought it would be better than the JavaScriptSerializer.&lt;br&gt;&lt;br&gt;Obviously the money men in Microsoft would have been pleased that the JSON guru decided to improve things, as it's one microscopic part of the reason that people will upgrade to 3.5, but I firmly believe that the changes are driven by people who are engrossed in the technical side of their job, and are desperate to make .NET as good as possible.&lt;br&gt;&lt;br&gt;They are, after all, just another bunch of geeks. They may be more talented and more influential than your average bunch of geeks, but they are fundamentally just another team of geeks doing their jobs. In my experience, whilst geeks want to get paid just like anyone else, what they really want is to make things work better.&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=7338" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/JonSayce/~4/gSmybqRhqSk" height="1" width="1"/&gt;</description><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/.NET/default.aspx">.NET</category><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/Rant/default.aspx">Rant</category><feedburner:origLink>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/02/14/what-motivates-geeks.aspx</feedburner:origLink></item><item><title>Programmatically Listing SQL Servers</title><link>http://feedproxy.google.com/~r/JonSayce/~3/_U5Kn_HasDI/programatically-listing-sql-servers.aspx</link><pubDate>Sun, 10 Feb 2008 22:37:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:6853</guid><dc:creator>jonsayce</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/jonsayce/rsscomments.aspx?PostID=6853</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/02/10/programatically-listing-sql-servers.aspx#comments</comments><description>&lt;p&gt;Using the .NET Framework there are a variety of ways you can search for available SQL Servers, but no single technique does the whole job. The best approach is to use a combination of methods to ensure you get the most complete list possible.&lt;br&gt;&lt;br&gt;Most methods rely on a UDP broadcast to locate servers - this is good for finding unknown servers which haven't been registered but doesn't guarantee to return the definitive list. Timeouts and firewalls blocking the relevant ports can lead to servers missing from the list and, if you're not on a network then even local servers will disappear from the list, as the UDP broadcast fails completely. In addition the list of servers is not guaranteed to be the same if you run the search twice.&lt;br&gt;&lt;br&gt;The main alternative is to search the registry for registered SQL Servers. Whilst this is fine for servers you know about (and works when the network is unavailable) it doesn't allow you to discover new SQL Servers.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;b&gt;&lt;u&gt;Method 1: UDP Broadcast&lt;/u&gt;&lt;/b&gt;&lt;br&gt;&lt;br&gt;&lt;b&gt;Used by:&lt;/b&gt;&lt;br&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Microsoft.SqlServer.Management.Smo.SmoApplication.&lt;a href="http://msdn2.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.smoapplication.enumavailablesqlservers.aspx" title="MSDN - EnumAvailableSqlServers" target="_blank"&gt;EnumAvailableSqlServers&lt;/a&gt;&lt;br&gt;&lt;/li&gt;&lt;li&gt;System.Data.Sql.&lt;a href="http://msdn2.microsoft.com/en-us/library/system.data.sql.sqldatasourceenumerator.aspx" title="MSDN - SQLDataSourceEnumerator" target="_blank"&gt;SqlDataSourceEnumerator&lt;/a&gt;&lt;br&gt;&lt;/li&gt;&lt;li&gt;SQL DMO &lt;a href="http://msdn2.microsoft.com/en-us/library/aa238042%28SQL.80%29.aspx" title="MSDN - ListAvailableSQLServers" target="_blank"&gt;ListAvailableSQLServers&lt;/a&gt;&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;The first two actually are actually the same under the covers: &lt;a href="http://devpinoy.org/blogs/keithrull/archive/2006/06/08/Programmatically-List-All-SQL-Servers-And-Their-Databases-Using-SMO-.aspx" title="Blog post about EnumAvailableSqlServers" target="_blank"&gt;EnumAvailableSqlServers&lt;/a&gt; is simply an abstraction of the SqlDataSourceEnumerator class.&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.sedgely.com/blogimages/programatically-listing-sql-servers/EnumAvailableSqlServers.png" title="EnumAvailableSqlServers example" alt="EnumAvailableSqlServers example" align="middle" height="190" width="550"&gt;&lt;br&gt;&lt;br&gt;&lt;b&gt;Pros:&lt;/b&gt;&lt;br&gt;+ Includes SQL Servers which are not registered&lt;br&gt;&lt;br&gt;&lt;b&gt;Cons:&lt;/b&gt;&lt;br&gt;- Doesn't work when there's no network connection&lt;br&gt;- Subject to firewall rules (Blocked TCP 1433 and UDP 1434)&lt;br&gt;- Doesn't find SQL Servers if SQL Browser is off&lt;br&gt;- Doesn't find SQL Servers if they are hidden&lt;br&gt;- List contents not guaranteed to be repeatable&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;b&gt;&lt;u&gt;Method 2: Reading Registered Servers from the Registry&lt;/u&gt;&lt;/b&gt;&lt;br&gt;&lt;br&gt;&lt;b&gt;Used by:&lt;/b&gt;&lt;br&gt;Microsoft.SqlServer.Management.Smo.SmoApplication.SqlServerRegistrations.&lt;a href="http://msdn2.microsoft.com/en-us/library/ms135085.aspx" title="MSDN" target="_blank"&gt;RegisteredServers&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.sedgely.com/blogimages/programatically-listing-sql-servers/RegisteredServers.png" title="RegisteredServers example" alt="RegisteredServers example" align="middle" height="201" width="571"&gt;&lt;br&gt;&lt;br&gt;&lt;b&gt;Pros:&lt;/b&gt;&lt;br&gt;+ Works with no network connection&lt;br&gt;+ Works regardless of firewalls&lt;br&gt;+ Shows all registered servers, regardless of SQL Browser/hidden status&lt;br&gt;&lt;br&gt;&lt;b&gt;Cons:&lt;/b&gt;&lt;br&gt;- Only shows SQL Servers which have been registered&lt;br&gt;- Will be removed in a future version of SQL Server according to &lt;a href="http://msdn2.microsoft.com/en-us/library/ms135085.aspx" title="MSDN" target="_blank"&gt;MSDN&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;u&gt;&lt;b&gt;Method 3: SMO WMI&lt;/b&gt;&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.wmi.serverinstance.aspx" title="MSDN" target="_blank"&gt;Windows Management Instrumentation&lt;/a&gt; provides a third way to locate SQL Servers.&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.sedgely.com/blogimages/programatically-listing-sql-servers/WMI.png" title="WMI example" alt="WMI example" align="middle" height="173" width="542"&gt;&lt;br&gt;&lt;br&gt;&lt;b&gt;Pros:&lt;/b&gt;&lt;br&gt;+ Works with no network connection&lt;br&gt;&lt;br&gt;&lt;b&gt;Cons:&lt;/b&gt;&lt;br&gt;- Only lists SQL Server 2005 and later&lt;br&gt;- Only finds registered servers&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;u&gt;&lt;b&gt;Putting the methods together&lt;/b&gt;&lt;/u&gt;&lt;br&gt;&lt;br&gt;If you're after a list which matches that shown in SSMS (or Enterprise Manager) then looking for registered servers will probably be an acceptable solution. If, on the other hand, you want to show all available SQL Servers (as in the SSMS "Browse for Servers" dialog), then your best bet is probably to combine one of the UDP methods with a list of registered servers. This will give you a reliable list of registered servers even when the network is down, and will include unregistered servers where possible.&lt;br&gt;&lt;/p&gt;&lt;p&gt;One of the most user-friendly ways of doing this is to initially populate your control with the registered servers (which can be done very quickly) but allow the user to initiate a search for further network servers (which can take several seconds) in case they're looking for an unregistered server. You should always allow the user to type in a server name too, as the server may be available even though it's not returned by the UDP methods described above.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;br&gt;&lt;u&gt;&lt;b&gt;And another thing...&lt;br&gt;&lt;/b&gt;&lt;/u&gt;&lt;/p&gt;&lt;p&gt;Depending on your requirements, you may need to include the instance names in the list. The methods I've mentioned all return instance names of the non-default instances (e.g. MyPC\SQLEXPRESS) but they handle them in different ways - the MSDN documentation gives full details.&lt;br&gt;&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=6853" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/JonSayce/~4/_U5Kn_HasDI" height="1" width="1"/&gt;</description><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/SMO/default.aspx">SMO</category><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/.NET/default.aspx">.NET</category><feedburner:origLink>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/02/10/programatically-listing-sql-servers.aspx</feedburner:origLink></item><item><title>Extending SMO Classes with Extension Methods and IEnumerable(T)</title><link>http://feedproxy.google.com/~r/JonSayce/~3/UsqW3SlKBnM/extending-smo-classes-with-extension-methods-and-ienumerable.aspx</link><pubDate>Sat, 09 Feb 2008 14:50:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:6962</guid><dc:creator>jonsayce</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/jonsayce/rsscomments.aspx?PostID=6962</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/02/09/extending-smo-classes-with-extension-methods-and-ienumerable.aspx#comments</comments><description>&lt;p&gt;One of the simplest ways to audit changes to a table is to have a trigger that stores a copy of any row that's inserted/updated/deleted, together with some meta data such as who made the change and when they made it. There are limitations (such as several types which can't be used in the inserted and deleted tables) but often this method of auditing will be sufficient.&lt;/p&gt;&lt;p&gt;Because of the limitations, you will normally need to specify a column list in your trigger, and this list needs to be kept up to date if the table being audited is ever changed.&lt;/p&gt;&lt;p&gt;While building a tool to keep audit triggers and audit tables in synch with the tables being audited, I recently found myself trying to inherit from various sealed &lt;a href="http://msdn2.microsoft.com/en-us/library/ms162169.aspx" title="MSDN - SMO" target="_blank"&gt;SMO&lt;/a&gt; classes. Having discovered that this was impossible, I tried a different tack: extending the SMO classes with .NET 3.5 &lt;a href="http://msdn2.microsoft.com/en-us/library/bb308966.aspx#csharp3.0overview_topic3" title="MSDN - C# Extension Methods" target="_blank"&gt;extension methods&lt;/a&gt;.&lt;br&gt;&lt;/p&gt;&lt;p&gt;As &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/03/13/new-orcas-language-feature-extension-methods.aspx" title="ScottGu's Extension Methods Post" target="_blank"&gt;ScottGu's&lt;/a&gt; examples show, extension methods can be extremely simple. &lt;br&gt;&lt;br&gt;I added a simple method to the Column class to expose whether the column's type was available in the inserted and deleted tables (i.e. whether the audit trigger could use it), then extended the Table class to expose a collection of these auditable columns.&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.sedgely.com/blogimages/extending-smo-classes-with-extension-methods-and-ienumerable/AuditableColumns.png" title="IEnumerable Extension Method" alt="IEnumerable Extension Method" align="middle" height="237" width="573"&gt;&lt;/p&gt;&lt;p&gt;The solution is actually extremely simple, but I found very little written about using &lt;a href="http://msdn2.microsoft.com/en-us/library/system.collections.ienumerable.aspx" title="MSDN - IEnumerable" target="_blank"&gt;IEnumerable&lt;/a&gt; or &lt;a href="http://msdn2.microsoft.com/en-us/library/9eekhta0.aspx" title="MSDN - IEnumerable(T)" target="_blank"&gt;IEnumerable(T)&lt;/a&gt; within an extension method. That may be because it's so straightforward that no-one has written about it, but hopefully someone will find this useful...&lt;br&gt;&lt;br&gt;One thing which would be nice in a future .NET release is extension properties - both the methods mentioned above would be more satisfactory if they were properties.&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=6962" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/JonSayce/~4/UsqW3SlKBnM" height="1" width="1"/&gt;</description><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/SMO/default.aspx">SMO</category><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/.NET/default.aspx">.NET</category><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/Extension+Methods/default.aspx">Extension Methods</category><feedburner:origLink>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/02/09/extending-smo-classes-with-extension-methods-and-ienumerable.aspx</feedburner:origLink></item><item><title>How to fix slow SMO performance</title><link>http://feedproxy.google.com/~r/JonSayce/~3/YpchgjUgiUc/how-to-fix-slow-smo-performance.aspx</link><pubDate>Sat, 09 Feb 2008 12:16:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:7001</guid><dc:creator>jonsayce</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/jonsayce/rsscomments.aspx?PostID=7001</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/02/09/how-to-fix-slow-smo-performance.aspx#comments</comments><description>&lt;p&gt;By default, when &lt;a href="http://msdn2.microsoft.com/en-us/library/ms162169.aspx" title="MSDN - SMO" target="_blank"&gt;SMO&lt;/a&gt; queries the database for the properties of an object, it only loads the basic properties. This reduces the number of tables it needs to join in the query, so dramatically improves performance, as long as you don't need the other properties.&lt;br&gt;&lt;br&gt;As an example, lets look at building a simple front end to display the tables in a database and the columns of the selected table. &lt;br&gt;&lt;br&gt;&lt;img src="http://www.sedgely.com/blogimages/how-to-fix-slow-smo-performance/AuditManager.png" title="SQL Server application" alt="SQL Server application" height="167" width="555"&gt;&lt;br&gt;&lt;br&gt;Using SMO to request the &lt;a href="http://msdn2.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.tablecollection.aspx" title="MSDN - TableCollection" target="_blank"&gt;TableCollection&lt;/a&gt;, the query requests just the schema name and table name from sys.tables. This is perfect for our requirements: we can populate our list of tables using the names and we don't care about the other details. We've saved time because we didn't join to the other system tables we would have needed if we were interested in properties such as indexing, keys, partitioning etc.&lt;br&gt;&lt;br&gt;Now we come to populate the column details. If we use SMO in its default mode then populating the &lt;a href="http://msdn2.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.columncollection.aspx" title="MSDN - ColumnCollection" target="_blank"&gt;ColumnsCollection&lt;/a&gt; of our table will use a simple query getting the column's ID and name, joining sys.tables with sys.all_columns:&lt;br&gt;&lt;br&gt;&lt;img src="http://www.sedgely.com/blogimages/how-to-fix-slow-smo-performance/smosql.png" title="SMO SQL" alt="SMO SQL" align="middle" height="188" width="397"&gt;&lt;br&gt;&lt;br&gt;If we were only displaying the column name that that would be fine. However, our listview is going to show more than just the name, and we create our listviewitem objects using some other interesting properties of the column:&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://www.sedgely.com/blogimages/how-to-fix-slow-smo-performance/listitemloop.png" title="Creating ListItems" alt="Creating ListItems" align="middle" height="411" width="497"&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Running SQL Server Profiler you'll notice that SMO has lost its way a bit. We'd expect it to fire another query to get the extended properties, but it does the extended query once for each column! Given that the full query now joins 13 tables, it's no surprise that people complain about SMO being slower than DMO.&lt;br&gt;&lt;br&gt;&lt;u&gt;&lt;b&gt;SetDefaultInitFields&lt;/b&gt;&lt;/u&gt;&lt;br&gt;The &lt;a href="http://blogs.msdn.com/mwories/archive/2005/04/22/smoperf1.aspx" title="Michiel Wories" target="_blank"&gt;solution&lt;/a&gt; to this problem is to &lt;a href="http://davidhayden.com/blog/dave/archive/2006/03/29/2894.aspx" title="David Hayden" target="_blank"&gt;tell SMO what you're going to need&lt;/a&gt; in advance. Using &lt;a href="http://msdn2.microsoft.com/en-us/library/ms210363.aspx" title="MSDN - SetDefaultInitFields" target="_blank"&gt;SetDefaultInitFields&lt;/a&gt; you can tell SMO to load all extra properties or you can even specify a list of exactly which properties you're going to need.&lt;br&gt;&lt;br&gt;SetDefaultInitFields is set at the server level. The simplest way to set it is just to tell it that all column properties should be loaded at once.&lt;br&gt;&lt;br&gt;&lt;img src="http://www.sedgely.com/blogimages/how-to-fix-slow-smo-performance/SetDefaultInitFields.png" title="Using SetDefaultInitFields" alt="Using SetDefaultInitFields" align="middle" height="133" width="553"&gt;&lt;br&gt;&lt;br&gt;Checking the SQL Profiler again reveals that the initial query is now the 13-table version, so is a little bit slower, but there are no further queries. If we were to specify the exact list of properties we were interested in then we could cut down the number of tables joined and make it even faster.&lt;br&gt;&lt;br&gt;&lt;u&gt;&lt;b&gt;Bonus improvements: AddRange and BeginUpdate&lt;/b&gt;&lt;/u&gt;&lt;br&gt;If you do write an application which sticks the column details into a listview, there are two other ways to improve performance: the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.windows.forms.listview.listviewitemcollection.addrange.aspx" title="MSDN - AddRange" target="_blank"&gt;AddRange&lt;/a&gt; method of the listview adds a collection or array of listviewitems to the listview in one operation, so avoids the nasty flickering as the control is repainted between add operations. If you prefer to use add, then the other way to stop the flickering is to use &lt;a href="http://msdn2.microsoft.com/en-us/library/system.windows.forms.listview.beginupdate.aspx" title="MSDN - BeginUpdate" target="_blank"&gt;BeginUpdate&lt;/a&gt; and &lt;a href="http://msdn2.microsoft.com/en-us/library/system.windows.forms.listview.endupdate.aspx" title="MSDN - EndUpdate" target="_blank"&gt;EndUpdate&lt;/a&gt;.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=7001" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/JonSayce/~4/YpchgjUgiUc" height="1" width="1"/&gt;</description><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/SMO/default.aspx">SMO</category><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/Performance/default.aspx">Performance</category><feedburner:origLink>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/02/09/how-to-fix-slow-smo-performance.aspx</feedburner:origLink></item><item><title>Customising the SSMS Table Designer</title><link>http://feedproxy.google.com/~r/JonSayce/~3/5YgbbFVIfhA/customising-the-ssms-table-designer.aspx</link><pubDate>Mon, 28 Jan 2008 09:50:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:6443</guid><dc:creator>jonsayce</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/jonsayce/rsscomments.aspx?PostID=6443</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/01/28/customising-the-ssms-table-designer.aspx#comments</comments><description>&lt;p&gt;Rick Strahl has a &lt;a href="http://west-wind.com/weblog/posts/237339.aspx" target="_blank"&gt;great post&lt;/a&gt; on making the SSMS Table Designer more keyboard-friendly by removing the need to have two panes:&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.west-wind.com/WebLog/images/200701/WindowsLiveWriter/AneasierViewforRecordDesigninSqlServerSt_103BE/SqlTableViewDesigner_thumb.png" title="Customised Table Designer" alt="Customised Table Designer" align="top" height="500" width="795"&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=6443" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/JonSayce/~4/5YgbbFVIfhA" height="1" width="1"/&gt;</description><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/SSMS/default.aspx">SSMS</category><feedburner:origLink>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/01/28/customising-the-ssms-table-designer.aspx</feedburner:origLink></item><item><title>Uninstalling an SSMS Add-in</title><link>http://feedproxy.google.com/~r/JonSayce/~3/TxKfX9g4aTE/uninstalling-an-ssms-add-in.aspx</link><pubDate>Fri, 25 Jan 2008 22:49:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:6396</guid><dc:creator>jonsayce</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/jonsayce/rsscomments.aspx?PostID=6396</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/01/25/uninstalling-an-ssms-add-in.aspx#comments</comments><description>&lt;p&gt;One thing I forgot to mention in my &lt;a href="http://sqlblogcasts.com/blogs/jonsayce/archive/2008/01/15/building-a-sql-server-management-studio-addin.aspx" target="_blank"&gt;recent posts&lt;/a&gt; on &lt;a href="http://sqlblogcasts.com/blogs/jonsayce/archive/2008/01/14/Total-SQL-Recall.aspx" target="_blank"&gt;SSMS add-ins&lt;/a&gt; was how to uninstall them. Normally this can be done using the standard Windows uninstall methods (Add/Remove Programs, uninstall the MSI, etc) but sometimes during development you may find you're stuck with an unwanted add-in.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;The simplest thing to do in this case is what SSMS does itself when an add-in fails to initialise properly: simply remove the registry setting that causes the add-in to be loaded. Delete the key for the add-in, which will be something like this:&lt;br&gt;&lt;/p&gt;

&lt;blockquote class="codesnippet"&gt;
&lt;p&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\Shell\AddIns\Namespace.Class&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This will guarantee that the add-in is never loaded again, though obviously it doesn't remove the other registry settings or the add-in files themselves. &lt;/p&gt;
&lt;p&gt;The other problem it can leave you with is unwanted menu and toolbar items in SSMS. These can be located and removed using a similar technique to that described in section 4 of my post on &lt;a href="http://sqlblogcasts.com/blogs/jonsayce/archive/2008/01/15/building-a-sql-server-management-studio-addin.aspx" target="_blank"&gt;building an add-in&lt;/a&gt;. Deleting a command should remove any menu items connected to the command.&lt;br&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=6396" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/JonSayce/~4/TxKfX9g4aTE" height="1" width="1"/&gt;</description><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/SSMS/default.aspx">SSMS</category><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/SSMS+Add-ins/default.aspx">SSMS Add-ins</category><feedburner:origLink>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/01/25/uninstalling-an-ssms-add-in.aspx</feedburner:origLink></item><item><title>Third-party IFrames in HTA Applications</title><link>http://feedproxy.google.com/~r/JonSayce/~3/AMBCtePCyFo/Third-party-IFrames-in-HTA-Applications.aspx</link><pubDate>Tue, 22 Jan 2008 13:43:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:6321</guid><dc:creator>jonsayce</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://sqlblogcasts.com/blogs/jonsayce/rsscomments.aspx?PostID=6321</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/01/22/Third-party-IFrames-in-HTA-Applications.aspx#comments</comments><description>&lt;p&gt;I've &lt;a href="http://sqlblogcasts.com/blogs/jonsayce/archive/2007/10/08/converting-to-hta.aspx" target="_blank"&gt;posted before&lt;/a&gt; about setting &lt;a href="http://msdn2.microsoft.com/en-us/library/ms536474%28VS.85%29.aspx" title="MSDN" target="_blank"&gt;Application = "Yes"&lt;/a&gt; on iframes in HTA applications, but if the iframe is rendered by a third-party component then this may not be straightforward. If the iframe runs JavaScript accessing it's parent window then somehow the iframe must be modified to pass the security rules enforced by the HTA model.&lt;br&gt;&lt;br&gt;Using the onload event of the &amp;lt;BODY&amp;gt; element it's possible to set the Application attribute of an iframe, but this is not enough to make the iframe HTA-friendly.&lt;br&gt;&lt;br&gt;Refreshing the contents of the iframe (using iframe.src = iframe.src) doesn't work either. I'm guessing that the security aspects of an iframe are baked into the element when the browser first renders it.&lt;br&gt;&lt;br&gt;The solution is to use the onload event of the body to rebuild the entire iframe element:&lt;/p&gt;
&lt;div class="codesnippet"&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (document.getElementById(&lt;span class="str"&gt;'spIFrame'&lt;/span&gt;)) {&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;span class="rem"&gt;// get reference to the iFrame&lt;/span&gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;span class="kwrd"&gt;var&lt;/span&gt; iFr = document.getElementById(&lt;span class="str"&gt;'spIFrame'&lt;/span&gt;);&lt;br&gt;   
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;span class="rem"&gt;// set the application attribute of the iFrame (so it works in HTA)&lt;/span&gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;iFr.application = &lt;span class="str"&gt;'Yes'&lt;/span&gt;;&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;span class="rem"&gt;// rebuild the iFrame to make sure Application="Yes" is active&lt;/span&gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;iFr.outerHTML = iFr.outerHTML;&lt;br&gt;
}&lt;/div&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=6321" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/JonSayce/~4/AMBCtePCyFo" height="1" width="1"/&gt;</description><category domain="http://sqlblogcasts.com/blogs/jonsayce/archive/tags/HTA/default.aspx">HTA</category><feedburner:origLink>http://sqlblogcasts.com/blogs/jonsayce/archive/2008/01/22/Third-party-IFrames-in-HTA-Applications.aspx</feedburner:origLink></item></channel></rss>
