<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Grady&#039;s Programming Notes</title>
	<atom:link href="http://gradyli.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://gradyli.wordpress.com</link>
	<description></description>
	<lastBuildDate>Tue, 13 Dec 2011 03:45:33 +0000</lastBuildDate>
	<language>zh-tw</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='gradyli.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Grady&#039;s Programming Notes</title>
		<link>http://gradyli.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://gradyli.wordpress.com/osd.xml" title="Grady&#039;s Programming Notes" />
	<atom:link rel='hub' href='http://gradyli.wordpress.com/?pushpress=hub'/>
		<item>
		<title>C# Excel 寫入多工作表</title>
		<link>http://gradyli.wordpress.com/2011/12/12/c-excel-%e5%af%ab%e5%85%a5%e5%a4%9a%e5%b7%a5%e4%bd%9c%e8%a1%a8/</link>
		<comments>http://gradyli.wordpress.com/2011/12/12/c-excel-%e5%af%ab%e5%85%a5%e5%a4%9a%e5%b7%a5%e4%bd%9c%e8%a1%a8/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 01:47:06 +0000</pubDate>
		<dc:creator>gradyli</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Excel]]></category>

		<guid isPermaLink="false">http://gradyli.wordpress.com/?p=448</guid>
		<description><![CDATA[有網友留言詢問如何在Excel將資料寫入多個工作表， 我們可以使用foreach的方式取得每個工作表， 或是利用Worksheets[index]的方式指定要存取那一張工作表。 Workbook在新增，預設會有三張工作表。 如果要新增工作表，使用Worksheets.Add方法新增。 底下是範例程式。 以上，提供參考。<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gradyli.wordpress.com&amp;blog=1154678&amp;post=448&amp;subd=gradyli&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
		<wfw:commentRss>http://gradyli.wordpress.com/2011/12/12/c-excel-%e5%af%ab%e5%85%a5%e5%a4%9a%e5%b7%a5%e4%bd%9c%e8%a1%a8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/99b5c776d5a790a7179c3a605e7fe70c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gradyli</media:title>
		</media:content>
	</item>
		<item>
		<title>Report Viewer 預覽模式</title>
		<link>http://gradyli.wordpress.com/2011/11/09/report-viewer-%e9%a0%90%e8%a6%bd%e6%a8%a1%e5%bc%8f/</link>
		<comments>http://gradyli.wordpress.com/2011/11/09/report-viewer-%e9%a0%90%e8%a6%bd%e6%a8%a1%e5%bc%8f/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 05:58:30 +0000</pubDate>
		<dc:creator>gradyli</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Reporting Service]]></category>

		<guid isPermaLink="false">http://gradyli.wordpress.com/?p=443</guid>
		<description><![CDATA[使用Report Viewer呈現報表時， 會發現螢幕上顯示的結果和列印成品不相同。 例如螢幕顯示報表沒有分頁，看起來只有一頁， 但印出來的報表卻有兩頁。 主要的原因是Report Viewer預設的報表呈現方式並不是「預覽列印」的樣式。 這裡記錄設定預覽的方式，如下程式碼。 參考資料 1. http://msdn.microsoft.com/en-us/library/microsoft.reporting.winforms.displaymode(v=VS.90).aspx 2. http://msdn.microsoft.com/en-US/library/microsoft.reporting.winforms.reportviewer_members(v=VS.90).aspx<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gradyli.wordpress.com&amp;blog=1154678&amp;post=443&amp;subd=gradyli&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
		<wfw:commentRss>http://gradyli.wordpress.com/2011/11/09/report-viewer-%e9%a0%90%e8%a6%bd%e6%a8%a1%e5%bc%8f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/99b5c776d5a790a7179c3a605e7fe70c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gradyli</media:title>
		</media:content>
	</item>
		<item>
		<title>T-SQL 日期格式</title>
		<link>http://gradyli.wordpress.com/2011/11/01/t-sql-%e6%97%a5%e6%9c%9f%e6%a0%bc%e5%bc%8f/</link>
		<comments>http://gradyli.wordpress.com/2011/11/01/t-sql-%e6%97%a5%e6%9c%9f%e6%a0%bc%e5%bc%8f/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 09:10:14 +0000</pubDate>
		<dc:creator>gradyli</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://gradyli.wordpress.com/?p=441</guid>
		<description><![CDATA[如果是需要由資料庫取得特定日期， 同時要求特定格式，可以使用CONVERT搭配GETDATE。[1] 轉換的格式請直接看範例程式。 原則上是以CONVERT(資料型態, 字串, 轉換樣式)將日期做格式化。 以上，做為筆記。 參考資料 1. http://msdn.microsoft.com/en-us/library/ms187928.aspx<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gradyli.wordpress.com&amp;blog=1154678&amp;post=441&amp;subd=gradyli&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
		<wfw:commentRss>http://gradyli.wordpress.com/2011/11/01/t-sql-%e6%97%a5%e6%9c%9f%e6%a0%bc%e5%bc%8f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/99b5c776d5a790a7179c3a605e7fe70c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gradyli</media:title>
		</media:content>
	</item>
		<item>
		<title>C# 將資料寫入Excel</title>
		<link>http://gradyli.wordpress.com/2011/10/23/c-%e5%b0%87%e8%b3%87%e6%96%99%e5%af%ab%e5%85%a5excel/</link>
		<comments>http://gradyli.wordpress.com/2011/10/23/c-%e5%b0%87%e8%b3%87%e6%96%99%e5%af%ab%e5%85%a5excel/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 13:43:08 +0000</pubDate>
		<dc:creator>gradyli</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Excel]]></category>

		<guid isPermaLink="false">http://gradyli.wordpress.com/?p=342</guid>
		<description><![CDATA[利用程式將資料寫入Excel已經不是第一次了， 如果有時間，應該把這個功能寫成可重復使用的類別。 底下是記錄使用Microsoft.Office.Interop.Excel的過程。 在寫程式之前，要將Microsoft.Office.Interop.Excel加入參考。 要注意依照自己的需求，載入不同版本的DLL。 Microsoft.Office.Interop.Excel的架構是要先有Application， 然後開啟Workbook，再使用Workbook產生Worksheet。 Worksheet則包含Range，可以存取Cell。 這個架構在下列的網址有更詳細的描述， http://msdn.microsoft.com/en-us/library/wss56bz7%28v=VS.80%29.aspx 底下是範例程式， 底下是參考文件， 1. http://support.microsoft.com/kb/302084 2. http://msdn.microsoft.com/en-us/library/y1xatbkd%28v=VS.80%29.aspx 編輯記錄， 第一版:2010.07.13 第二版:2011.10.23<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gradyli.wordpress.com&amp;blog=1154678&amp;post=342&amp;subd=gradyli&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
		<wfw:commentRss>http://gradyli.wordpress.com/2011/10/23/c-%e5%b0%87%e8%b3%87%e6%96%99%e5%af%ab%e5%85%a5excel/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/99b5c776d5a790a7179c3a605e7fe70c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gradyli</media:title>
		</media:content>

		<media:content url="http://gradyli.files.wordpress.com/2010/03/addref.png" medium="image">
			<media:title type="html">addRef</media:title>
		</media:content>
	</item>
		<item>
		<title>T-SQL LTRIM RTRIM對NULL的處理</title>
		<link>http://gradyli.wordpress.com/2011/10/11/t-sql-ltrim-rtrim%e5%b0%8dnull%e7%9a%84%e8%99%95%e7%90%86/</link>
		<comments>http://gradyli.wordpress.com/2011/10/11/t-sql-ltrim-rtrim%e5%b0%8dnull%e7%9a%84%e8%99%95%e7%90%86/#comments</comments>
		<pubDate>Tue, 11 Oct 2011 03:10:18 +0000</pubDate>
		<dc:creator>gradyli</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://gradyli.wordpress.com/?p=431</guid>
		<description><![CDATA[LTRIM和RTRIM分別可以去掉資料左邊和右邊的空白字元， 如下述的範例，因為已知firstName和lastName可能右邊有空白字元， 所以使用RTRIM把空白字元去掉。 可是如果資料的內容有可能是NULL時，LTRIM和RTRIM執行的結果， 就不是我們所預期的。 例如使用者誤把所有資料填入firstName，而lastName則是資料庫預設的NULL。 其實往深一層探討，會出現這樣的情況， 是在於字串相加的規則中，對於NULL的處理所產生的問題。 字串使用「+」串聯時，如果其中有一個值是NULL，則結果為NULL。[1] 要解決這個問題的方法有兩種。 方法一， 針對當下的SESSION改變NULL處理的預設值，如下範例。 這是利用CONCAT_NULL_YIELDS_NULL讓NULL結果不會輸出。 但是官方文件已經備註，此功能未來將鎖定為ON，使用者無法變更。 也就是不建議使用此解決方式。[2] 方法二， 使用COALESCE將NULL取代為空字串(不是空白字串)。 其實COALESCE並不是取代NULL; 而是它會回傳參數中，第一個非NULL的參數。[3] 範例如下， 也就是COALESCE會去判斷我們傳進去的參數， 如果第一個參數不是NULL，就回傳。 如果第一個參數是NULL，就判斷第二個參數，以此類推。 以上，做為記錄。 參考文章 1. http://msdn.microsoft.com/en-us/library/ms177561.aspx 2. http://msdn.microsoft.com/en-us/library/ms176056(v=SQL.105).aspx 3. http://msdn.microsoft.com/en-us/library/ms190349.aspx<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gradyli.wordpress.com&amp;blog=1154678&amp;post=431&amp;subd=gradyli&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
		<wfw:commentRss>http://gradyli.wordpress.com/2011/10/11/t-sql-ltrim-rtrim%e5%b0%8dnull%e7%9a%84%e8%99%95%e7%90%86/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/99b5c776d5a790a7179c3a605e7fe70c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gradyli</media:title>
		</media:content>
	</item>
		<item>
		<title>C# 日期格式</title>
		<link>http://gradyli.wordpress.com/2011/10/02/c-%e6%97%a5%e6%9c%9f%e6%a0%bc%e5%bc%8f/</link>
		<comments>http://gradyli.wordpress.com/2011/10/02/c-%e6%97%a5%e6%9c%9f%e6%a0%bc%e5%bc%8f/#comments</comments>
		<pubDate>Sun, 02 Oct 2011 14:19:20 +0000</pubDate>
		<dc:creator>gradyli</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[DateTime Format]]></category>

		<guid isPermaLink="false">http://gradyli.wordpress.com/?p=333</guid>
		<description><![CDATA[需要把DateTime.Now輸出特定格式， 將用到的東西記錄一下。 日期輸出的格式文件，非常詳細。 http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx 可以針對年月日和時間的輸出格式做設定。 簡單說明帶入的參數設定， yyyy = 四位數的西元年， M (大寫) = 一或兩位數的月份， MM (大寫) = 兩位數的月份，1 ~ 9月的數字自動補零， MMM (大寫) = 月份的英文簡稱 (例 Jan)，這邊是以CultureInfo為en-US為預設值， MMMM (大寫) = 月份的英文全名 (例 October)，這邊是以CultureInfo為en-US為預設值， d = 一或兩位數的日， dd = 兩位數的日，1~9的天數自動補零， ddd = 星期幾的英文簡稱(例 Mon)，這邊是以CultureInfo為en-US為預設值， dddd = 星期幾的英文全名，這邊是以CultureInfo為en-US為預設值。 參數字串可以使用自訂的分隔字元， 例如「/」、「-」。 以下是使用的範例， 在中文的環境中，如果沒有指定CultureInfo(『en-US』)， 則會抓取系統語系值。 編輯記錄: 第一版:2010.03.16 第二版:2011.10.02<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gradyli.wordpress.com&amp;blog=1154678&amp;post=333&amp;subd=gradyli&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
		<wfw:commentRss>http://gradyli.wordpress.com/2011/10/02/c-%e6%97%a5%e6%9c%9f%e6%a0%bc%e5%bc%8f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/99b5c776d5a790a7179c3a605e7fe70c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gradyli</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL LEN DATALENGTH</title>
		<link>http://gradyli.wordpress.com/2011/09/15/sql-len-datalength/</link>
		<comments>http://gradyli.wordpress.com/2011/09/15/sql-len-datalength/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 13:31:31 +0000</pubDate>
		<dc:creator>gradyli</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://gradyli.wordpress.com/?p=426</guid>
		<description><![CDATA[在使用t-sql的LEN function時，發現了一個有趣的現象。 如下所示， 找了文件(http://msdn.microsoft.com/en-us/library/ms190329.aspx) 之後發現，LEN在計算字元數目時，會將尾端的空白去掉。 但我需要知道是整個字串包含空白的字元數， 於是找到了一個名為DATALENGTH的函式。 http://msdn.microsoft.com/en-us/library/ms173486(v=SQL.90).aspx 在使用的時候需要注意，因為它是回傳BYTES的數目， 所以如果字元是UNICODE，需要把結果除以2。 以上，做為參考。<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gradyli.wordpress.com&amp;blog=1154678&amp;post=426&amp;subd=gradyli&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
		<wfw:commentRss>http://gradyli.wordpress.com/2011/09/15/sql-len-datalength/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/99b5c776d5a790a7179c3a605e7fe70c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gradyli</media:title>
		</media:content>
	</item>
		<item>
		<title>C# 下載檔案</title>
		<link>http://gradyli.wordpress.com/2010/09/09/c-%e4%b8%8b%e8%bc%89%e6%aa%94%e6%a1%88/</link>
		<comments>http://gradyli.wordpress.com/2010/09/09/c-%e4%b8%8b%e8%bc%89%e6%aa%94%e6%a1%88/#comments</comments>
		<pubDate>Thu, 09 Sep 2010 14:07:24 +0000</pubDate>
		<dc:creator>gradyli</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://gradyli.wordpress.com/?p=422</guid>
		<description><![CDATA[在寫Windows Form的時候，需要一個背景程式從特定網址(HTTP)下載某些檔案。 透過同事了解到可以使用WebClient類別，有點出乎意料之外的簡潔。 以下測試程式做為記錄。<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gradyli.wordpress.com&amp;blog=1154678&amp;post=422&amp;subd=gradyli&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
		<wfw:commentRss>http://gradyli.wordpress.com/2010/09/09/c-%e4%b8%8b%e8%bc%89%e6%aa%94%e6%a1%88/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/99b5c776d5a790a7179c3a605e7fe70c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gradyli</media:title>
		</media:content>
	</item>
		<item>
		<title>.NET Math.Round 四捨五入</title>
		<link>http://gradyli.wordpress.com/2010/09/07/net-math-round-%e5%9b%9b%e6%8d%a8%e4%ba%94%e5%85%a5/</link>
		<comments>http://gradyli.wordpress.com/2010/09/07/net-math-round-%e5%9b%9b%e6%8d%a8%e4%ba%94%e5%85%a5/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 11:17:35 +0000</pubDate>
		<dc:creator>gradyli</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://gradyli.wordpress.com/?p=415</guid>
		<description><![CDATA[遇到需要使用到四摠五入的情況， 在MSDN的說明中找到適用的方法。 主要是使用Math.Round和MidpointRounding參數， 用法是Math.Round(要處理的數字, 傳回數字的小數點位數, 四捨五入的方式) 程式碼如下， MidpointRounding.AwayFromZero是我們一般熟知的四捨五入方式， 如果需要符合 IEEE Standard 754 ，可以使用MidpointRounding.ToEven。 以上，做為記錄。<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gradyli.wordpress.com&amp;blog=1154678&amp;post=415&amp;subd=gradyli&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
		<wfw:commentRss>http://gradyli.wordpress.com/2010/09/07/net-math-round-%e5%9b%9b%e6%8d%a8%e4%ba%94%e5%85%a5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/99b5c776d5a790a7179c3a605e7fe70c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gradyli</media:title>
		</media:content>
	</item>
		<item>
		<title>.NET Dictionary foreach的存取問題</title>
		<link>http://gradyli.wordpress.com/2010/09/01/net-dictionary%e7%9a%84%e5%ad%98%e5%8f%96%e5%95%8f%e9%a1%8c/</link>
		<comments>http://gradyli.wordpress.com/2010/09/01/net-dictionary%e7%9a%84%e5%ad%98%e5%8f%96%e5%95%8f%e9%a1%8c/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 13:08:53 +0000</pubDate>
		<dc:creator>gradyli</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://gradyli.wordpress.com/?p=410</guid>
		<description><![CDATA[在.NET 3.5使用Dictionary時，遇到了一個問題。 程式碼如下， 上面這套程式會出現以下的錯誤訊息， InvalidOperationException 集合已修改; 列舉作業可能尚未執行。 查看MSDN的說明後後發現，使用foreach走訪Dictionary時，只能讀取，不能改變內容。 The foreach statement is a wrapper around the enumerator, which allows only reading from the collection, not writing to it. 於是把程式碼改寫如下， 先將Dictionary的key全部取出，再用for loop修改Dictionary的內容。 以上，做為記錄。<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gradyli.wordpress.com&amp;blog=1154678&amp;post=410&amp;subd=gradyli&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
		<wfw:commentRss>http://gradyli.wordpress.com/2010/09/01/net-dictionary%e7%9a%84%e5%ad%98%e5%8f%96%e5%95%8f%e9%a1%8c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/99b5c776d5a790a7179c3a605e7fe70c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">gradyli</media:title>
		</media:content>
	</item>
	</channel>
</rss>
