<?xml version="1.0" encoding="UTF-8"?>
<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/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kyle Hebert (part music, part software, part music software)</title>
	<atom:link href="http://blog.kylehebertmusic.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.kylehebertmusic.com</link>
	<description>part music, part software, part music software</description>
	<lastBuildDate>Wed, 20 Jan 2010 16:53:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Exporting a SQL Table To Excel</title>
		<link>http://blog.kylehebertmusic.com/?p=30</link>
		<comments>http://blog.kylehebertmusic.com/?p=30#comments</comments>
		<pubDate>Wed, 20 Jan 2010 16:53:13 +0000</pubDate>
		<dc:creator>kylehebert</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.kylehebertmusic.com/?p=30</guid>
		<description><![CDATA[Thanks to information from sqlteam and kodyaz, I was able to export data from SQL Server to Excel in seconds (70,000 rows of data were exported from a table in 8 seconds)&#8230;Wow!!
The first step requires that you turn on the option &#8216;Show Advanced Options&#8217; via the built in system stored procedure sp_configure.

?View Code T-SQL1
exec sp_configure ]]></description>
			<content:encoded><![CDATA[<p>Thanks to information from <a href="http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926">sqlteam</a> and <a href="http://www.kodyaz.com/articles/enable-web-assistant-procedures-xp_makewebtask.aspx">kodyaz</a>, I was able to export data from SQL Server to Excel in seconds (70,000 rows of data were exported from a table in 8 seconds)&#8230;Wow!!</p>
<p>The first step requires that you turn on the option &#8216;Show Advanced Options&#8217; via the built in system stored procedure sp_configure.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p30code6'); return false;">View Code</a> T-SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p306"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p30code6"><pre class="t-sql" style="font-family:monospace;">exec sp_configure 'show advanced options', 1</pre></td></tr></table></div>

<p>Next, you must run &#8216;Reconfigure&#8217; to &#8220;install&#8221;, as SQL Server calls it, to set the changes:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p30code7'); return false;">View Code</a> T-SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p307"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p30code7"><pre class="t-sql" style="font-family:monospace;">Reconfigure</pre></td></tr></table></div>

<p>Once advanced options are available, you can set the &#8216;Web Assistant Procedures&#8217; option to true (i.e. 1):</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p30code8'); return false;">View Code</a> T-SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p308"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p30code8"><pre class="t-sql" style="font-family:monospace;">exec sp_configure 'Web Assistant Procedures', 1</pre></td></tr></table></div>

<p>Again, you must run &#8216;Reconfigure&#8217; to reset the SQL Server to accept your changes:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p30code9'); return false;">View Code</a> T-SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p309"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p30code9"><pre class="t-sql" style="font-family:monospace;">Reconfigure</pre></td></tr></table></div>

<p>SQL Server has a built-in stored procedure for writing data to files (I&#8217;m assuming this would work just as well to output a CSV or other delimited file type, but I haven&#8217;t tried it yet) called &#8217;sp_makewebtask&#8217;.  Using the following code, I was able to export an excel complete with column headers &#038; a report title (hence the @colheaders &#038; @resultstitle Parameters):</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p30code10'); return false;">View Code</a> T-SQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3010"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p30code10"><pre class="t-sql" style="font-family:monospace;">EXEC sp_makewebtask 
	@outputfile = 'D:\MyDirectory\vwNodeTrackingMatrix.xls', 
	@query = 'SELECT * FROM LoopManagement.dbo.vwNodeTrackingMatrix', 
	@colheaders = 1, 
	@FixedFont=0,@lastupdated=0,@resultstitle='LoopManagement.dbo.vwNodeTrackingMatrix'</pre></td></tr></table></div>

<p>For more thorough information, you can see the links above.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kylehebertmusic.com/?feed=rss2&amp;p=30</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gridview Paging Error</title>
		<link>http://blog.kylehebertmusic.com/?p=13</link>
		<comments>http://blog.kylehebertmusic.com/?p=13#comments</comments>
		<pubDate>Mon, 04 Jan 2010 19:15:41 +0000</pubDate>
		<dc:creator>kylehebert</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.kylehebertmusic.com/?p=13</guid>
		<description><![CDATA[Index was out of range. Must be non-negative and less than the size of the collection.
This error just greeted me while testing a log page that uses an ASP.NET GridView control for displaying tabular data. When navigating to the last page and then trying to navigate back up to a more recent page, my code ]]></description>
			<content:encoded><![CDATA[<blockquote><p>Index was out of range. Must be non-negative and less than the size of the collection.</p></blockquote>
<p>This error just greeted me while testing a log page that uses an ASP.NET GridView control for displaying tabular data. When navigating to the last page and then trying to navigate back up to a more recent page, my code was failing on a line in the RowCommand event, which seemed strange to me. Then, I realized that the pager is in the header, which is a row, itself, and any actions on the header row go through the RowCommand function and the code was failing on a call to set thisRow = gv.rows(e.CommandArgument mod gv.PageSize). When the header row calls the RowCommand function, e.CommandArgument = -1, apparently.</p>
<p>A couple of solutions are:</p>
<ol>
<li>Wrap the entire contents of the RowCommand function with an if-statement to check for e.CommandArgument &gt; -1</li>
<li>Wrap the contents of the RowCommand function with an if-statement to check for e.CommandName = &#8220;Page&#8221;</li>
</ol>
<p>I found solution 2 on a message board. Apparently, when you&#8217;re clicking on one of the pager buttons in the header, the CommandName is set to &#8220;Page&#8221;.</p>
<p>This has taken about 2 hours to troubleshoot, and the solution was simple&#8211;yet another A-S-S (Always Something Simple) solution&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kylehebertmusic.com/?feed=rss2&amp;p=13</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing a SQL Where Clause as a Parameter to a Stored Procedure</title>
		<link>http://blog.kylehebertmusic.com/?p=11</link>
		<comments>http://blog.kylehebertmusic.com/?p=11#comments</comments>
		<pubDate>Mon, 04 Jan 2010 19:14:56 +0000</pubDate>
		<dc:creator>kylehebert</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.kylehebertmusic.com/?p=11</guid>
		<description><![CDATA[In an effort to consolidate reporting on our web apps, we normally create a central report setup page that allows a user to select a report and various combinations of filters based on the data in the database. Internally, our best known approach has been to generate a SQL string in the VB behind our ]]></description>
			<content:encoded><![CDATA[<p>In an effort to consolidate reporting on our web apps, we normally create a central report setup page that allows a user to select a report and various combinations of filters based on the data in the database. Internally, our best known approach has been to generate a SQL string in the VB behind our ASP.NET pages and send the string in as a hard-coded &#8220;Select&#8230;&#8221; statement via the SQL connection. We&#8217;ve always had a feeling, however, that this isn&#8217;t the &#8220;best&#8221; approach, especially when considering how labor intensive it might be to edit code that could be much longer than something like:</p>
<p><code>dim str as new StringBuilder("")</code></p>
<p><code>str.Append("Select col1, col2, col3 From Table1 as t1")</code></p>
<p><code>str.Append("inner join Table2 as t2.col1 = t1.col1")</code></p>
<p><code> </code></p>
<p><code>if WhereClause() &lt;&gt; "" then</code></p>
<p><span style="padding-left: 30px;">str.Append(&#8221;Where 1=1&#8243;)</span></p>
<p><span style="padding-left: 30px;">if checkbox1 = clicked then</span></p>
<p><span style="padding-left: 60px;">str.Append(&#8221; and col1 = checkbox1.text&#8221;)</span></p>
<p><span style="padding-left: 30px;">elseif checkbox2.checked = true then</span></p>
<p><span style="padding-left: 60px;">str.Append(&#8221; and col2 = checkbox2.text&#8221;)</span></p>
<p><span style="padding-left: 30px;">end if</span></p>
<p>end if</p>
<p>Time constraints have prevented us from researching better approaches, but we have always hoped to find a way of using stored procedures, passing in where clauses as parameters when necessary.</p>
<p>Today I stumbled on a better approach while browsing through the questions on <a title="Stack Overflow" href="http://stackoverflow.com/questions/533516/stored-procedure-send-a-list-of-parameters-in-for-use-with-the-in-clause-close" target="_blank">StackOverflow</a>.</p>
<p>Caution should be taken when using either of these approaches, especially if the report setup filters include text box entries&#8211;your database could be opened up to injection attacks.</p>
<p>I&#8217;ll append to this blog as newer methods are discovered.</p>
<p>I&#8217;ve found another link:  <a title="passing arrays to stored procedures" href="http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm" target="_blank">http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm</a></p>
<p>I&#8217;ve also gotten additional responses on Stack Overflow concerning creating a temporary table and performing the filter on the temp table like so:</p>
<p><code>IF OBJECT_ID('tempdb..#tmp') IS NOT NULL<br />
Drop table #tmp;<br />
CREATE TABLE #tmp (col1 varchar(10))<br />
INSERT #tmp (col1)<br />
EXEC spTest<br />
declare @spstr as nvarchar(Max)<br />
declare @whereClause as varchar(300)<br />
set @whereClause = 'Where col1 = ''1'''<br />
set @spStr = 'Select * from #tmp ' + @whereClause<br />
exec(@spStr)</code></p>
<p>One more link:  ﻿<a title="Beginning Dynamic SQL" href="http://sqlservernation.com/blogs/development/archive/2009/12/07/using-stored-procedures-to-query-objects-with-dynamic-sql.aspx" target="_blank">http://sqlservernation.com/blogs/development/archive/2009/12/07/using-stored-procedures-to-query-objects-with-dynamic-sql.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kylehebertmusic.com/?feed=rss2&amp;p=11</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Formatting Date Strings in ASP.NET Gridviews</title>
		<link>http://blog.kylehebertmusic.com/?p=9</link>
		<comments>http://blog.kylehebertmusic.com/?p=9#comments</comments>
		<pubDate>Mon, 04 Jan 2010 19:14:21 +0000</pubDate>
		<dc:creator>kylehebert</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://blog.kylehebertmusic.com/?p=9</guid>
		<description><![CDATA[I&#8217;m blogging about this as it is a constant speedbump I find myself crossing. We&#8217;ve been using TemplateFields in gridviews exclusively for a couple of years now since we&#8217;ve always found ourselves having to convert BoundFields to TemplateFields in order to get extra functionality that we need in most cases. There&#8217;s extra coding to do, ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m blogging about this as it is a constant speedbump I find myself crossing. We&#8217;ve been using TemplateFields in gridviews exclusively for a couple of years now since we&#8217;ve always found ourselves having to convert BoundFields to TemplateFields in order to get extra functionality that we need in most cases. There&#8217;s extra coding to do, but we only use what we need, and, thus, i&#8217;m assuming that it&#8217;s a little more efficient. I&#8217;ll reasearch the topic and include it in another blog.</p>
<p>If, in the item template, a label is used to display text, I&#8217;ve gone around-and-around, via trial and error, trying to display dates with the short date format. Today I stumbled upon a link that provides solutions for both BoundFields &amp; labels inside of TemplateFields: <a href="http://www.codedigest.com/Articles/ASPNET/137_How_to_format_DateTime_in_GridView_BoundColumn_and_TemplateColumn.aspx">http://www.codedigest.com/Articles/ASPNET/137_How_to_format_DateTime_in_GridView_BoundColumn_and_TemplateColumn.aspx</a></p>
<p>The solution for the label inside of the TemplateField, which I&#8217;m most concerned about here, is:</p>
<ol>
<li>Be sure to use Eval rather than Bind (I always use Bind&#8211;this was the &#8216;Gotcha!&#8217;) in the text property of the label</li>
<li>in Eval, include the format string in the second parameter (i.e.  Eval(&#8221;Field_Name&#8221;, &#8220;{0:d}&#8221;) )</li>
</ol>
<p>That was a simple fix that took me 2 hours of trial and error to get nowhere before finally searching for a solution elsewhere!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kylehebertmusic.com/?feed=rss2&amp;p=9</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>String Theory</title>
		<link>http://blog.kylehebertmusic.com/?p=7</link>
		<comments>http://blog.kylehebertmusic.com/?p=7#comments</comments>
		<pubDate>Mon, 04 Jan 2010 19:13:35 +0000</pubDate>
		<dc:creator>kylehebert</dc:creator>
				<category><![CDATA[Music]]></category>

		<guid isPermaLink="false">http://blog.kylehebertmusic.com/?p=7</guid>
		<description><![CDATA[Thanks for viewing my first blog.  Blogging was recommended to me by a coworker who attended a course on resumes in the technical age.  Apparently, blogs are becoming popular as support documents to the standard 1-page resumes that most advisers were recommending when I graduated from college in the fall of 2003.
This first blog will be about ]]></description>
			<content:encoded><![CDATA[<p>Thanks for viewing my first blog.  Blogging was recommended to me by a coworker who attended a course on resumes in the technical age.  Apparently, blogs are becoming popular as support documents to the standard 1-page resumes that most advisers were recommending when I graduated from college in the fall of 2003.</p>
<p>This first blog will be about music, but I will also mix in some software development topics as I add more posts down the road.</p>
<p>About a year and a half ago, I purchased a Lakland Joe Osborn Signature 5-string bass.  When it came time to change my strings, I settled on Ernie Ball slinkies, as I&#8217;ve always used them on my Stingray 5.  One small problem:  The B string tapered off inside of the first fret near the nut&#8211;The string was too short!  I tried several different sets, and none seemed to work&#8211;all were too short.  No one at our local music stores seemed to understand what my problem was.  They all assumed, after I told them about my problem, &#8220;&#8230;Oh!  You need tapered strings&#8230;.try these.&#8221;  I kept trying to figure out what was wrong with my explanation of my problem.  I thought my explanation was very clear:  &#8220;I&#8217;m trying to find strings to fit my bass; for every set I&#8217;ve tried, the B strings have been too short.&#8221;  That seems pretty clear to me! No?</p>
<p>Finally, someone understood my dilemma.  They recommended DR Long Scale strings.  These are the only strings that I&#8217;ve tried that fit the full length of my bass.  So, I hereby recommend those strings to anyone having similar problems.</p>
<p>Please comment below, leaving any similar experiences and any other string type suggestions for the Joe Osborn 5-string.  I&#8217;m also looking for an acoustic 5-string set for a Michael Kelly Dragonfly.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kylehebertmusic.com/?feed=rss2&amp;p=7</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
