<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>TheCodeMonk</title>
	<link>http://thecodemonk.com</link>
	<description>Random Thoughts of a Software Development Professional</description>
	<pubDate>Mon, 23 Jun 2008 14:50:37 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3</generator>
	<language>en</language>
			<item>
		<title>Make it easy for the IT department.</title>
		<link>http://thecodemonk.com/2008/06/23/make-it-easy-for-the-it-department/</link>
		<comments>http://thecodemonk.com/2008/06/23/make-it-easy-for-the-it-department/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 14:50:37 +0000</pubDate>
		<dc:creator>TheCodeMonk</dc:creator>
		
		<category><![CDATA[Windows Deployment]]></category>

		<guid isPermaLink="false">http://thecodemonk.com/2008/06/23/make-it-easy-for-the-it-department/</guid>
		<description><![CDATA[For quite a while I have noticed that there seems to be this huge divide between IT departments and the software developers. I say IT meaning the hardware/software support department and the programmers that write software. In my organization, we are only software developers. Any hardware support is done by me because I have had [...]]]></description>
			<content:encoded><![CDATA[<p>For quite a while I have noticed that there seems to be this huge divide between IT departments and the software developers. I say IT meaning the hardware/software support department and the programmers that write software. In my organization, we are only software developers. Any hardware support is done by me because I have had the most experience with it. Everyone else handles their own software issues. If they have an issue with Word or with their virus scanner of choice, they have to fix it themselves or ask questions to find out who knows what to do. Whenever I have had to call someone in IT at our customer&#8217;s location, we constantly are met with resistance and multitudes of questions that point to a certain mistrust of software developers. They almost treat us like we are Microsoft and are out to install a patch that will bring their entire system down for two days.</p>
<p>I start to gain a little insight on why it&#8217;s like this the other day. When we install our server components, which is solely SQL Server 2005 Express with a database including stored procedures and triggers, we have an <a href="http://thecodemonk.com/2007/10/25/windows-installer-sql-server-installation-issues-and-a-solution/">installation package</a> where you just have to click on setup.exe and let it do its thing. When I called the main contact at the IT department, I heard the hesitancy in his voice. I assured him he could do the installation if he preferred not giving me remote access to the server, but he insisted that I do it for him. No problem. Since we are customer focused, we always try to do the client and server installs of our software, anyway. I downloaded the files I needed and clicked on the setup program and just sat there while it went through the entire process. We chit-chatted about servers and Microsoft and had a few laughs over the new security requirements. He then described multiple instances where servers were down for a day or two because of patches that didn&#8217;t apply right and how he has had to call Microsoft dozens of times to get hotfixes or special patches because the combination of hardware and software they use is not normal. I usually do not get concerned when I hear this because we don&#8217;t usually care what they use, as long as Exchange Server is not on the same server as SQL Server.</p>
<p>After 15 minutes and clicking next a few times, our install was done. He said, &#8220;Ok, so what do we do now?&#8221; My response was simple, &#8220;Nothing. It&#8217;s all ready.&#8221; He was disbelieving and ran the client software and tried a few things to check. The next 10 minutes was eye opening. He described how this was the best install he has had to watch in a long time and was very pleased that we were so IT friendly. He described a situation that made me, as a software developer, cringe. They had purchased a brand new accounting system that cost their organization almost a hundred thousand dollars (US funds) and the installation took about 3 days. It took 3 days because they gave him the CDs and said to install it, but never gave him any instructions on how. Being used to installing software, he put in the CD marked #1 and ran the setup. It half way installed and then gave a half dozen error messages that consisted of things like &#8220;Error Occurs&#8221; and &#8220;Cannot Continue.&#8221; He tried called technical support and all he got was voice mails. He left messages but never received any phone calls in return.</p>
<p>He spent the next 3 days trying to solve the all problems himself, but with no documentation on requirements or procedures. When technical support finally called him back, the solution was to install the third CD first and then try the first CD. Why would you install a CD marked #3 before the CD marked #1? He told me that now he is highly concerned that they made the right choice because it&#8217;s their accounting system and how can they trust the vendor&#8217;s technical support department if he can&#8217;t get an answer in less than 3 days? What if they need to do payroll and &#8220;error occurs&#8221; and technical support doesn&#8217;t return phone calls?</p>
<p>This is why there is animosity between IT and software developers. Make it easy for them. Give descriptive error messages and most certainly answer your phone if it rings! Even if you know it&#8217;s a stupid problem they should be able to solve just by reading the screen, at least that phone call will keep their confidence that you will be there where there is a problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecodemonk.com/2008/06/23/make-it-easy-for-the-it-department/feed/</wfw:commentRss>
		</item>
		<item>
		<title>I </title>
		<link>http://thecodemonk.com/2008/06/03/i/</link>
		<comments>http://thecodemonk.com/2008/06/03/i/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 18:17:20 +0000</pubDate>
		<dc:creator>TheCodeMonk</dc:creator>
		
		<category><![CDATA[linq]]></category>

		<guid isPermaLink="false">http://thecodemonk.com/2008/06/03/i/</guid>
		<description><![CDATA[One of the latest technologies to hit .Net recently is Linq. Language Integrated Query allows you to perform a more SQL like syntax on object collections in code. It has been out for quite some time, but I just recently was able to use it in a project. It&#8217;s pretty cool stuff and has already [...]]]></description>
			<content:encoded><![CDATA[<p>One of the latest technologies to hit .Net recently is <a href="http://msdn.microsoft.com/en-us/netframework/aa904594.aspx">Linq</a>. Language Integrated Query allows you to perform a more SQL like syntax on object collections in code. It has been out for quite some time, but I just recently was able to use it in a project. It&#8217;s pretty cool stuff and has already saved me a few lines of code. Places where loops would have been neccessary have easily been replaced with a simple where.</p>
<p>One of the concerns most developers had, especially when working with Linq to SQL data classes, was the relative speed at retrieving data from the SQL server. They were pretty right about that. It&#8217;s slow. Much slower than even using datasets with table adapters. However, using <a href="http://www.jdconley.com/blog/archive/2007/11/28/linq-to-sql-surprise-performance-hit.aspx">compiled queries</a> can help.</p>
<p>One thing some people never took into consideration was the relative ease that Developer&#8217;s Express users can now use server mode without having to use the proprietary XPO classes. Their XtraGrid&#8217;s now support ServerMode which will page SQL queries in windows forms applications. One issue we had were slow VPN clients trying to use a windows form application installed locally and connecting to a remote SQL Server. Until recently we have had to tell users to use terminal services instead. Some forms have to show a relatively large amount of data in a single grid (finding customers, paging through certain data, etc). Over a VPN connection it was just painfully slow. Now combining <a href="http://www.devexpress.com/Products/NET/LinqEnabledGrids.xml">XtraGrid&#8217;s and the Linq Server Mode</a>, everything works as expected over a slow (1.5 MB DSL even) VPN connection.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecodemonk.com/2008/06/03/i/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Forums Launched</title>
		<link>http://thecodemonk.com/2008/02/19/forums-launched/</link>
		<comments>http://thecodemonk.com/2008/02/19/forums-launched/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 03:39:44 +0000</pubDate>
		<dc:creator>TheCodeMonk</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thecodemonk.com/2008/02/19/forums-launched/</guid>
		<description><![CDATA[I added forums to this site just in case there are some discussions on any of the articles or if there are other topics that anyone would want to discuss. It&#8217;s easier to ask questions and discuss solutions in a forum format instead of on a blog site.
Check it out. The link is at the [...]]]></description>
			<content:encoded><![CDATA[<p>I added forums to this site just in case there are some discussions on any of the articles or if there are other topics that anyone would want to discuss. It&#8217;s easier to ask questions and discuss solutions in a forum format instead of on a blog site.</p>
<p>Check it out. The link is at the top. It&#8217;s quite empty right now&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://thecodemonk.com/2008/02/19/forums-launched/feed/</wfw:commentRss>
		</item>
		<item>
		<title>TableAdapter Connection Strings</title>
		<link>http://thecodemonk.com/2008/02/18/tableadapter-connection-strings/</link>
		<comments>http://thecodemonk.com/2008/02/18/tableadapter-connection-strings/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 14:52:07 +0000</pubDate>
		<dc:creator>TheCodeMonk</dc:creator>
		
		<category><![CDATA[.Net Code]]></category>

		<category><![CDATA[CSharp]]></category>

		<category><![CDATA[VB.Net]]></category>

		<category><![CDATA[app.config]]></category>

		<category><![CDATA[connection strings]]></category>

		<category><![CDATA[dataset]]></category>

		<category><![CDATA[sql server]]></category>

		<category><![CDATA[TableAdapter]]></category>

		<guid isPermaLink="false">http://thecodemonk.com/2008/02/18/tableadapter-connection-strings/</guid>
		<description><![CDATA[I don&#8217;t know how a lot of people handle it, but one thing that always bugged me about table adapters and datasets is the way it handles it&#8217;s connection strings. It starts out innocent enough. A new dataset is created with it&#8217;s associated table adapter. The connection string is saved to the application settings file [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know how a lot of people handle it, but one thing that always bugged me about table adapters and datasets is the way it handles it&#8217;s connection strings. It starts out innocent enough. A new dataset is created with it&#8217;s associated table adapter. The connection string is saved to the application settings file and that property is saved in the dataset. Running it on the development machine (or on the same network) is no big deal and just works. But what if you send that application to someone else that has their own SQL Server? </p>
<p>Did anyone at Microsoft actually use this scenario in a production environment? What were they thinking?</p>
<p>In order to run that in a production environment you have to set the connection string in the app.config file. While this may be fine for some people, what about the people like me that do not want my users to access that database? I don&#8217;t want them to have that username and password&#8230; While the chances of a normal user loading SQL Server Management Studio and logging in are slim, it&#8217;s still possible and it&#8217;s definitely possible if a user purposely wants to get out of having to do work that day.</p>
<p>What are the options? Well, one option is to use the encryption to encrypt the settings in app.config. For me, this option is not ideal. Reports of those settings getting corrupted are quite high, plus you have to deal with the loading and saving of those settings, which isn&#8217;t all that easy to do.</p>
<p>The other option is to take the route I was taking for a while&#8230; I had a function that would build me a connection string. Then I could: TableAdapter.Connection.ConnectionString = myLibrary.ConnectionStringFunction()</p>
<p>This was great, until that day came where I was in a hurry and added a few more tables to a form but forgot to set the ConnectionStrings. Whoops.</p>
<p>So I needed a solution that would stop me from having to set those ConnectionString properties, keep my connection string out of the app.config, and be easy to use (i.e. Just Works).</p>
<p>I started out by just giving all my datasets the same connection string. Then on application startup, I tried to change that one application setting. Hmm.. It seems those ConnectionString properties are set to friend and are read only.</p>
<p>Upon further investigation, it seems that there are some events that fire, such as SettingsLoaded. This event fires when the app.config is read and all the settings are loaded. When this event fires, it fires inside the MySettings class. This should allow that property to be changed.</p>
<pre name="code" class="vb.net:nogutter">
    Private Sub MySettings_SettingsLoaded(ByVal sender As Object, ByVal e As System.Configuration.SettingsLoadedEventArgs) Handles Me.SettingsLoaded
      Me.Item("MyAppConnectionString") = MyLibrary.BuildConnectionString()
    End Sub
</pre>
<p>This will set the MyAppConnectionString setting to the proper connection string. Now, all table adapters will have an up to date connection string.</p>
<p>So what happens if you want to change the connection string later while the application is still running? Well, there is no way to do that. So it&#8217;s time to come up with a way to trick it into updating that property.</p>
<p>In looking at the MySettings class, there is another event called PropertyChanged. We can use this event if we create another setting that can be updated anywhere in the application. First, we create a new string setting that has a User scope (I called mine ConnectionString). This will allow the application to update the setting at any time.</p>
<p>Next, we need to create a function that will update that property with our connection string.</p>
<pre name="code" class="vb.net:nogutter">
  Public Shared Sub ChangeConnectionString()
    My.Settings.ConnectionString = BuildConnectionString()
  End Sub
</pre>
<p>Now we can change the events in the MySettings class to look like this.</p>
<pre name="code" class="vb.net:nogutter">
    Private Sub MySettings_PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Handles Me.PropertyChanged
      If e.PropertyName = "ConnectionString" Then
        Me.Item("MyAppConnectionString") = My.Settings.ConnectionString
      End If
    End Sub

    Private Sub MySettings_SettingsLoaded(ByVal sender As Object, ByVal e As System.Configuration.SettingsLoadedEventArgs) Handles Me.SettingsLoaded
      MyLibrary.ChangeConnectionString()
    End Sub
  End Class
</pre>
<p>Now, every time that ChangeConnectionString() is called, the MyAppConnectionString will be updated. The ChangeConnectionString procedure can be changed so that it can accept a string parameter that is the actual connection string. Then you can build a Connection String anywhere and just pass it to that procedure. </p>
]]></content:encoded>
			<wfw:commentRss>http://thecodemonk.com/2008/02/18/tableadapter-connection-strings/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New look.</title>
		<link>http://thecodemonk.com/2008/02/18/new-look/</link>
		<comments>http://thecodemonk.com/2008/02/18/new-look/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 05:43:55 +0000</pubDate>
		<dc:creator>TheCodeMonk</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thecodemonk.com/2008/02/18/new-look/</guid>
		<description><![CDATA[I haven&#8217;t been posting much, mainly due to a busy schedule, but also because I really didn&#8217;t like the look of the site&#8230; I have changed to a new theme. Hopefully, this will motivate me to post more.
One thing I was looking for in a new template, was a fluid layout. It seems the wordpress [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t been posting much, mainly due to a busy schedule, but also because I really didn&#8217;t like the look of the site&#8230; I have changed to a new theme. Hopefully, this will motivate me to post more.</p>
<p>One thing I was looking for in a new template, was a fluid layout. It seems the wordpress themes for fluid layouts are pretty scarce. Especially ones that look good. I will stick with this one for the time being and see how it works. I think my code highlighter will fix the reason I wanted a fluid layout anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecodemonk.com/2008/02/18/new-look/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Disposing of memory leaks.</title>
		<link>http://thecodemonk.com/2008/01/03/disposing-of-memory-leaks/</link>
		<comments>http://thecodemonk.com/2008/01/03/disposing-of-memory-leaks/#comments</comments>
		<pubDate>Thu, 03 Jan 2008 19:06:12 +0000</pubDate>
		<dc:creator>TheCodeMonk</dc:creator>
		
		<category><![CDATA[.Net Code]]></category>

		<category><![CDATA[VB.Net]]></category>

		<guid isPermaLink="false">http://thecodemonk.com/2008/01/03/disposing-of-memory-leaks/</guid>
		<description><![CDATA[One of the biggest causes of memory leaks that I find from time to time is from forgetting to dispose of some SQLConnection object. Even if the connection is closed, the SQLConnection object seems to stay alive forever, which keeps any form objects alive as well.
This happens in VB a lot if you forget to [...]]]></description>
			<content:encoded><![CDATA[<p>One of the biggest causes of memory leaks that I find from time to time is from forgetting to dispose of some SQLConnection object. Even if the connection is closed, the SQLConnection object seems to stay alive forever, which keeps any form objects alive as well.</p>
<p>This happens in VB a lot if you forget to call the Dispose method of the SQLConnection object or if you don&#8217;t use the Using keyword. While cleaning up code, the best way to get in the habit of doing it, seems to be changing everything into a Using statement so I get in the habit of using it&#8230;<br />
Instead of:</p>
<pre name="code" class="vb.net:nogutter">
    Dim myCommand As New SqlClient.SqlCommand("Select Count(*) from MyTable")
    Dim myConnection As New SqlClient.SqlConnection(ConnectionString)
    myCommand.Connection = myConnection
    myConnection.Open()
    Dim iCount As Integer = CInt(myCommand.ExecuteScalar())
    myConnection.Close()
    myConnection.Dispose()
    myCommand.Dispose()
</pre>
<p>Do this:</p>
<pre name="code" class="vb.net:nogutter">
    Using myCommand As New SqlClient.SqlCommand("Select Count(*) from MyTable")
      Using myConnection As New SqlClient.SqlConnection(ConnectionString)
        myCommand.Connection = myConnection
        myConnection.Open()
        Dim iCount As Integer = CInt(myCommand.ExecuteScalar())
      End Using
    End Using
</pre>
<p>Since the IDisposable interface on the SQLConnection object will automatically close open connections, there is no need to close it&#8230; However, if you decide to do this:</p>
<pre name="code" class="vb.net:nogutter">
    Using myCommand As New SqlClient.SqlCommand("Select Count(*) from MyTable" _
    , New SqlClient.SqlConnection(ConnectionString))
      myCommand.Connection.Open()
      Dim iCount As Integer = CInt(myCommand.ExecuteScalar())
      myCommand.Connection.Close()
    End Using
</pre>
<p>Make sure you close the connection first&#8230; Although, I don&#8217;t recommend doing it that way, because the IDisposable interface of the SQLCommand object does not call the IDisposable interface of the SqlConnection object that it holds. I&#8217;ve read that all the SqlConnection object&#8217;s IDisposable interface does is close an open connection, I wouldn&#8217;t trust that completely and dispose of it properly.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecodemonk.com/2008/01/03/disposing-of-memory-leaks/feed/</wfw:commentRss>
		</item>
		<item>
		<title>WPF - More *Cooler* Information</title>
		<link>http://thecodemonk.com/2007/12/02/wpf-more-cooler-information/</link>
		<comments>http://thecodemonk.com/2007/12/02/wpf-more-cooler-information/#comments</comments>
		<pubDate>Sun, 02 Dec 2007 16:07:26 +0000</pubDate>
		<dc:creator>TheCodeMonk</dc:creator>
		
		<category><![CDATA[WPF]]></category>

		<category><![CDATA[Windows Development]]></category>

		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://thecodemonk.com/2007/12/02/wpf-more-cooler-information/</guid>
		<description><![CDATA[I&#8217;m reading a pretty well written book by Adam Nathan called Windows Presentation Foundation Unleashed. I am on the hunt for more in depth knowledge of WPF and how it is going to affect me, if at all.
In my search of an answer of the question &#8216;Why?&#8217; I already found 2 answers.
1. WPF uses DirectX [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m reading a pretty well written book by Adam Nathan called Windows Presentation Foundation Unleashed. I am on the hunt for more in depth knowledge of WPF and how it is going to affect me, if at all.</p>
<p>In my search of an answer of the question <a href="http://thecodemonk.com/2007/11/29/wpf-first-thought/">&#8216;Why?&#8217;</a> I already found 2 answers.<br />
1. WPF uses DirectX to render the controls on screen. This pushes most of the UI processing onto the GPU (Video Card) instead of the CPU. This should speed up Windows applications a bit and also allow UI elements to be processing while business logic elements are running (think progress bars).<br />
2. Using a WPF application in Remote Desktop will allow all visual elements to be processed using DirectX on the CLIENT PC. This means that if I connect to my machine at work from home, all WPF applications will be rendered using my video card instead of my work PC&#8217;s video card. How cool is that?! That will make using remote desktop faster as well. I have already experienced the Remote Desktop application slowdown because of screen redraws and control hang ups because of nasty UI elements. This would fix those problems. </p>
<p>I will continue to post new things as I find them. Little things like being able to write an XAML document and open it in IE without having to compile is a cool feature, but one I&#8217;m not interested in. So plan on only seeing REALLY cool features here.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecodemonk.com/2007/12/02/wpf-more-cooler-information/feed/</wfw:commentRss>
		</item>
		<item>
		<title>WPF - First Thought</title>
		<link>http://thecodemonk.com/2007/11/29/wpf-first-thought/</link>
		<comments>http://thecodemonk.com/2007/11/29/wpf-first-thought/#comments</comments>
		<pubDate>Thu, 29 Nov 2007 18:35:25 +0000</pubDate>
		<dc:creator>TheCodeMonk</dc:creator>
		
		<category><![CDATA[WPF]]></category>

		<category><![CDATA[Windows Development]]></category>

		<guid isPermaLink="false">http://thecodemonk.com/2007/11/29/wpf-first-thought/</guid>
		<description><![CDATA[Pretty cool&#8230; Although my REAL first thought after using it was, &#8220;Why?&#8221;
The reason I ask why is because as I am looking at the available controls and what it looks like on screen once I run the test application, I am really presented with the same looking form as if I just used a regular [...]]]></description>
			<content:encoded><![CDATA[<p>Pretty cool&#8230; Although my REAL first thought after using it was, &#8220;Why?&#8221;</p>
<p>The reason I ask why is because as I am looking at the available controls and what it looks like on screen once I run the test application, I am really presented with the same looking form as if I just used a regular Windows Forms control. This doesn&#8217;t mean that I think it&#8217;s useless already. Heck, I only spent about 20 minutes with it. I haven&#8217;t even read up on it as much as I should have before even posting this. </p>
<p>So, let it be known that my research into WPF has started with a resounding, &#8220;What is this supposed to accomplish?&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://thecodemonk.com/2007/11/29/wpf-first-thought/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Windows Installer - SQL Server Installation Issues and a Solution.</title>
		<link>http://thecodemonk.com/2007/10/25/windows-installer-sql-server-installation-issues-and-a-solution/</link>
		<comments>http://thecodemonk.com/2007/10/25/windows-installer-sql-server-installation-issues-and-a-solution/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 22:20:23 +0000</pubDate>
		<dc:creator>TheCodeMonk</dc:creator>
		
		<category><![CDATA[.Net Code]]></category>

		<category><![CDATA[VB.Net]]></category>

		<category><![CDATA[Windows Deployment]]></category>

		<category><![CDATA[Windows Development]]></category>

		<category><![CDATA[Installer Class]]></category>

		<category><![CDATA[Setup and Deployment]]></category>

		<category><![CDATA[SQL Server Express]]></category>

		<category><![CDATA[Windows Installer]]></category>

		<guid isPermaLink="false">http://thecodemonk.com/2007/10/25/windows-installer-sql-server-installation-issues-and-a-solution/</guid>
		<description><![CDATA[Here is the problem in a nutshell: You have a custom client application that uses SQL Server 2005 Express. The server installation is a little bit to be desired. First, you have to install SQL Server Express, then you have to configure the options (unless you did command line options), then you have to execute [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the problem in a nutshell: You have a custom client application that uses SQL Server 2005 Express. The server installation is a little bit to be desired. First, you have to install SQL Server Express, then you have to configure the options (unless you did command line options), then you have to execute the scripts to create your database, tables, and possibly populate it with some data. Or conversely, execute scripts or install and use the management console to attach a database. Messy, at best.</p>
<p>So what if you want to have a single installation program that will install all the prerequisites (.Net), then install SQL Server 2005 with your custom options (instance name for example), and then have it execute scripts and fill it with data? After working at it for hours, I came to the conclusion that you could be out of luck. Until I did some reconfiguring.</p>
<p>First things first, you need to get SQL Server Express to install properly. I struggled with this for a while, until I had the bright idea of using a bootstrapper&#8230; But can&#8217;t we use the one that comes with the Visual Studio Package and Deployment Wizard? Yes you can! </p>
<p>Go into your Visual Studio 8 folder and find the SDK/v2.0/Bootstrapper/Packages folder. Make a copy of the SqlExpress folder and name it something like, MyAppSqlExpress. Inside that folder, there is a product XML file. Edit that product.xml file and change the product code. Mine was Microsoft.Sql.Server.Express.1.0 and I changed it to MyAppName.Microsoft.Sql.Server.Express.1.0 … Just change the MyAppName to the app name of the product it goes with. You will also see a En folder for the English installation. The package.xml file is the one you want to edit in that folder. The first item to edit, is the arguments line. This passes arguments to the SqlExpr32.exe file (the setup for Sql Express). The arguments are the same as any other SQL Express install&#8230; So change it to be something like this:</p>
<pre name="code" class="xml:nogutter">
Arguments='-q /norebootchk /qb reboot=ReallySuppress addlocal=all
  INSTANCENAME=MyApp SECURITYMODE=SQL SAPWD=MyStrongPassword
  DISABLENETWORKPROTOCOLS=0 SQLAUTOSTART=1'
</pre>
<p>This will do a silent installation of SQL Server Express using all protocols, a custom instance name (MyApp), turn on the SQL security mode and specify a strong SA password. </p>
<p>Next, there is the strings block at the bottom. Edit the StringName &#8220;DisplayName&#8221; to look like this:</p>
<pre name="code" class="xml:nogutter">
<String Name="DisplayName">MyApp SQL Server 2005 Express Edition</String>
</pre>
<p>Save it, and go into your setup and deployment project you created, go to the project properties, then to the prerequisites, and in the list you should now see your custom install of SQL Server Express!</p>
<p>This does work, I just tested it out today.</p>
<p>So that solves problem #1. What about the problem of executing scripts? That seems to be the easy part&#8230; From my earlier <a href="http://thecodemonk.com/2007/10/23/microsoftsqlserversmo-where-have-you-been-all-my-life/">post</a> you can incorporate that code into a custom action.</p>
<p>Create a new project, and select Installer Class from the templates. This creates a new installer class for you to augment.</p>
<pre name="code" class="vb.net:nogutter">
  Private Sub ExecuteSQL(ByVal SQL As String, _
    ByVal ConnectionString As String)

    Dim srv As New Server(New ServerConnection( _
    New SqlClient.SqlConnection(ConnectionString)))

    srv.ConnectionContext.ExecuteNonQuery(SQL)
    srv.ConnectionContext.Disconnect()
  End Sub

  Private Sub BulkLoad(ByVal ConnectionString As String, _
    ByVal TableName As String)

    Dim bulk As New SqlClient.SqlBulkCopy(ConnectionString, _
    SqlClient.SqlBulkCopyOptions.KeepIdentity)

    Dim ds As New DataSet
    Dim path As String = My.Application.Info.DirectoryPath
    ds.ReadXmlSchema(path &#038; "\" &#038; TableName &#038; ".xsd")
    ds.ReadXml(path &#038; "\" &#038; TableName &#038; ".xml")
    bulk.BulkCopyTimeout = 0
    bulk.DestinationTableName = TableName
    bulk.WriteToServer(ds.Tables(TableName))
    bulk.Close()
  End Sub

  Public Overrides Sub Install(ByVal stateSaver As _
    System.Collections.IDictionary)

    MyBase.Install(stateSaver)
    Dim ConnBuilder As New SqlClient.SqlConnectionStringBuilder()
    ConnBuilder.UserID = "sa"
    ConnBuilder.Password = "MyStrongPassword"
    ConnBuilder.DataSource = "localhost\MyApp"
    ConnBuilder.InitialCatalog = "master"
    ExecuteSQL(My.Resources.CreateDatabaseSQL, _
    ConnBuilder.ConnectionString())

    ConnBuilder.InitialCatalog = "MyDatabase"
    BulkLoad(ConnBuilder.ConnectionString(), "MyTable")
  End Sub
</pre>
<p>In this example, I just stored the data files (an XML data file and an XSD schema file) in the setup project, which gets installed along with the custom installer DLL. The create database SQL stuff was all saved as a store resource in the installer class project. I did this so that some of the structure was hidden, which may or may not be an issue for others.</p>
<p>Now, add the custom action to a setup project and you are finished!</p>
]]></content:encoded>
			<wfw:commentRss>http://thecodemonk.com/2007/10/25/windows-installer-sql-server-installation-issues-and-a-solution/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What is the future of COM?</title>
		<link>http://thecodemonk.com/2007/10/24/what-is-the-future-of-com/</link>
		<comments>http://thecodemonk.com/2007/10/24/what-is-the-future-of-com/#comments</comments>
		<pubDate>Wed, 24 Oct 2007 14:16:26 +0000</pubDate>
		<dc:creator>TheCodeMonk</dc:creator>
		
		<category><![CDATA[Windows Development]]></category>

		<category><![CDATA[.Net]]></category>

		<category><![CDATA[COM]]></category>

		<category><![CDATA[Legacy]]></category>

		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://thecodemonk.com/2007/10/24/what-is-the-future-of-com/</guid>
		<description><![CDATA[The discussion came up the other day about COM (Component Object Model) and it&#8217;s future in Windows development. 
COM is not dead, by any means. In fact, Microsoft said it themselves in the Windows Vista FAQ. It&#8217;s not dead, just done. By done, they mean that it will no longer be extended, or fixed if [...]]]></description>
			<content:encoded><![CDATA[<p>The discussion came up the other day about <a href="http://msdn2.microsoft.com/en-us/library/ms680573.aspx">COM</a> (Component Object Model) and it&#8217;s future in Windows development. </p>
<p>COM is not dead, by any means. In fact, Microsoft said it themselves in the <a href="http://msdn2.microsoft.com/en-us/windowsvista/aa905017.aspx#General%20Topics:%20Windows%20Vista%20and%20Existing%20Technologies">Windows Vista FAQ</a>. It&#8217;s not dead, just done. By done, they mean that it will no longer be extended, or fixed if a problem is found. I am 100% sure that if a security flaw is found, they will fix it. However, I am also 100% sure that if an obscure bug is found, and it doesn&#8217;t affect any Microsoft Products, it will not be fixed. </p>
<p>So what does that mean for the Windows Developer? Not much. COM is still a major component in Windows, and probably will have to be for quite some time. Microsoft Office and Internet Explorer are still COM applications. Do you think they will be rewriting them in .Net any time soon? Probably not.</p>
<p>I don&#8217;t think the sky is falling, but I do think it&#8217;s time for existing developers to start migrating away from COM, though.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecodemonk.com/2007/10/24/what-is-the-future-of-com/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
