<?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>李保存 &#187; ACT</title>
	<atom:link href="http://libaocun.com/tag/act/feed" rel="self" type="application/rss+xml" />
	<link>http://libaocun.com</link>
	<description>Think globally, act locally.</description>
	<lastBuildDate>Fri, 02 Jul 2010 07:27:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Free SEO Tool from Microsoft</title>
		<link>http://libaocun.com/free-seo-tool-from-microsoft</link>
		<comments>http://libaocun.com/free-seo-tool-from-microsoft#comments</comments>
		<pubDate>Wed, 19 May 2010 15:59:41 +0000</pubDate>
		<dc:creator>Bali</dc:creator>
				<category><![CDATA[Chinese - 中文]]></category>
		<category><![CDATA[ACT]]></category>
		<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://libaocun.com/?p=437</guid>
		<description><![CDATA[SEO的站内优化部分，基本目的就是让搜索引擎上的爽。长久以来，到底搜索引擎喜欢什么样子的网站，大多来自于“SEO专家”newletter中的只言片语。其实是有迹可寻的，搜索引擎说白了，就是一堆机器，是人告诉它如何去运转的。
曾经想过要开发一个网站SEO水平的静态分析工具的。现在好了，MS已经推出免费供分析工具了。
http://www.microsoft.com/web/spotlight/seo.aspx
大概试了一下，基本的功能还都有了。

]]></description>
			<content:encoded><![CDATA[<p>SEO的站内优化部分，基本目的就是让搜索引擎上的爽。长久以来，到底搜索引擎喜欢什么样子的网站，大多来自于“SEO专家”newletter中的只言片语。其实是有迹可寻的，搜索引擎说白了，就是一堆机器，是人告诉它如何去运转的。</p>
<p>曾经想过要开发一个网站SEO水平的静态分析工具的。现在好了，MS已经推出免费供分析工具了。</p>
<p><a href="http://www.microsoft.com/web/spotlight/seo.aspx">http://www.microsoft.com/web/spotlight/seo.aspx</a></p>
<p>大概试了一下，基本的功能还都有了。</p>
<p><a href="http://libaocun.com/wp-content/uploads/2010/05/ms-seo-tool-screenshot-2.png"><img class="alignleft size-full wp-image-444" title="ms-seo-tool-screenshot-2" src="http://libaocun.com/wp-content/uploads/2010/05/ms-seo-tool-screenshot-2.png" alt="ms seo tool screenshot 2" width="809" height="663" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://libaocun.com/free-seo-tool-from-microsoft/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Polymorphism/inheritance pop quiz about Java</title>
		<link>http://libaocun.com/polymorphism-inheritance-pop-quiz-about-java</link>
		<comments>http://libaocun.com/polymorphism-inheritance-pop-quiz-about-java#comments</comments>
		<pubDate>Wed, 14 Oct 2009 15:46:06 +0000</pubDate>
		<dc:creator>Bali</dc:creator>
				<category><![CDATA[Chinese - 中文]]></category>
		<category><![CDATA[ACT]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.balionweb.com/?p=237</guid>
		<description><![CDATA[前面几篇都是关于THINK的。Well，动动嘴皮子总是很容易的，虽然在某些情况下吹牛也是一项必备的技能。其实，我一直很hands-on，而且enjoy hands-on, 每天都写code。也许我哪天做了CEO还是会写的，就因为喜欢。听说Intel SSG的前老大叫（什么什么来着），一人之下的位子，兴致来了，还会连上debugger，帮你调程序，呵呵。
好，上code，开始ACT。有两个class A, B，B is inherited from A. 问在下列几种情况下，会出现什么结果，并解释为什么。
public class B extends A {
      public int foo(int t) {
            return 0;
      }
}
(1)
public class A {
      public void foo(int t) {
            return;
      }
}
(2)
public class A {
      public int foo(int t) {
            return 1;
      }
}
(3)
public class A {
      private int foo(int t) {
            return 1;
      [...]]]></description>
			<content:encoded><![CDATA[<p>前面几篇都是关于THINK的。Well，动动嘴皮子总是很容易的，虽然在某些情况下吹牛也是一项必备的技能。其实，我一直很hands-on，而且enjoy hands-on, 每天都写code。也许我哪天做了CEO还是会写的，就因为喜欢。听说Intel SSG的前老大叫（什么什么来着），一人之下的位子，兴致来了，还会连上debugger，帮你调程序，呵呵。</p>
<p>好，上code，开始ACT。有两个class A, B，B is inherited from A. 问在下列几种情况下，会出现什么结果，并解释为什么。</p>
<blockquote><p><strong>public</strong> <strong>class</strong> B <strong>extends</strong> A {</p>
<p>      <strong>public</strong> <strong><span style="text-decoration: underline;">int</span></strong> foo(<strong>int</strong> t) {</p>
<p>            <strong>return</strong> 0;</p>
<p>      }</p>
<p>}</p></blockquote>
<p>(1)</p>
<blockquote><p><strong>public</strong> <strong>class</strong> A {</p>
<p>      <strong>public</strong> <strong>void</strong> foo(<strong>int</strong> t) {</p>
<p>            <strong>return</strong>;</p>
<p>      }</p>
<p>}</p></blockquote>
<p>(2)</p>
<blockquote><p><strong>public</strong> <strong>class</strong> A {</p>
<p>      <strong>public</strong> <strong>int</strong> foo(<strong>int</strong> t) {</p>
<p>            <strong>return</strong> 1;</p>
<p>      }</p>
<p>}</p></blockquote>
<p>(3)</p>
<blockquote><p><strong>public</strong> <strong>class</strong> A {</p>
<p>      <strong>private</strong> <strong>int</strong> <span style="text-decoration: underline;">foo(</span><strong><span style="text-decoration: underline;">int</span></strong><span style="text-decoration: underline;"> t)</span> {</p>
<p>            <strong>return</strong> 1;</p>
<p>      }</p>
<p>}</p></blockquote>
<p>(4)</p>
<blockquote><p><strong>public</strong> <strong>class</strong> A {</p>
<p>      <strong>public</strong> <strong>int</strong> foo(<strong>int</strong> t, <strong>int</strong> s) {</p>
<p>            <strong>return</strong> 1;</p>
<p>      }</p>
<p>}</p></blockquote>
<p>尤其是将要面试的同学，如果这个东西还没搞清楚，那么&#8230;除非你算法很强。另外，哪位同学知道，如何贴code吗？格式要保持Eclipse那样，非图片。</p>
]]></content:encoded>
			<wfw:commentRss>http://libaocun.com/polymorphism-inheritance-pop-quiz-about-java/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在线拍卖系统</title>
		<link>http://libaocun.com/online-auction-design</link>
		<comments>http://libaocun.com/online-auction-design#comments</comments>
		<pubDate>Wed, 30 Sep 2009 01:54:25 +0000</pubDate>
		<dc:creator>Bali</dc:creator>
				<category><![CDATA[Chinese - 中文]]></category>
		<category><![CDATA[ACT]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[e-commerce]]></category>
		<category><![CDATA[Online-Service]]></category>

		<guid isPermaLink="false">http://www.balionweb.com/?p=218</guid>
		<description><![CDATA[早上，习惯性地打开新浪，小心地在广告链接中穿行，点新闻看。一则关于淘宝一元秒杀的新闻，很有意思。故事大概是：9/25日晚8时，淘宝将价值数千元的商品，以一元标价在淘宝上拍卖，庆祝成立6周年。结果搞砸了。很多用户还未看到开始页面就结束了，还有人用作弊器同时拍到了多个商品。
此事从商务角度来说，淘宝是毫无疑问的赢家。此次拍卖的目的并非真的拍卖，而是赚人气，赚眼球。尚不清楚，淘宝是否真的故意造成争议话题，让大家去议论，正如电影拍摄中常常传出男女主角的桃色新闻一样。从技术角度来说，如果要较完善设计此系统的话，至少有几点值得商榷。
（1）Use server push instead of client pull. 有淘宝用户留言，
我从19:50开始，不断刷新页面，都是显示“即将开始”，再刷新，活动已经结束！MLGB…
在线拍卖讲究的就是时效性，大家都想以最低的价格得到某样商品，所以非常想知道最新的价格，这时候就疯狂刷页面，造成服务器压力很大。另外一种做法是Server Push, “你们都不要刷了，有消息会告诉你们的，回家等着吧。” 这种东东就叫做Server Push。也不是什么新的概念，用Java applet等插件N年前都能实现，但让每个人都装这么个插件显然代价太大。现在的SilverLight, Flex也能实现类似功能，但需要安装插件。Dojo的Comet很好地解决了这个问题。code在这里。不用装插件，可以穿越防火墙，而且scalability很好，也可以做cluster。淘宝的兄弟们真应该考虑一下这个东西。对Java天然支持。很可能将是Servlet 3.0的一部分，HTML5中也有类似的概念了。Server Push的应用范围主要在Server需要主动传递信息给client的情况，如在线拍卖，聊天，股票报价等。下面是一个介绍的slide，有兴趣的朋友，仔细看看。5分钟就可以用maven弄一个玩玩。
Time for Comet?
（2）用一点anti-spamming技术吧，在这里就是验证码(CAPTCHA)。只有人能拍，程序不能拍。
（3）防一下DoS攻击，把疯狂刷页面的同学的IP暂时放入黑名单，或者弹出一个验证码页面。
]]></description>
			<content:encoded><![CDATA[<p>早上，习惯性地打开新浪，小心地在广告链接中穿行，点新闻看。一则关于<a href="http://tech.sina.com.cn/i/2009-09-30/05283480615.shtml">淘宝一元秒杀</a>的新闻，很有意思。故事大概是：9/25日晚8时，淘宝将价值数千元的商品，以一元标价在淘宝上拍卖，庆祝成立6周年。结果搞砸了。很多用户还未看到开始页面就结束了，还有人用作弊器同时拍到了多个商品。</p>
<p>此事从商务角度来说，淘宝是毫无疑问的赢家。此次拍卖的目的并非真的拍卖，而是赚人气，赚眼球。尚不清楚，淘宝是否真的故意造成争议话题，让大家去议论，正如电影拍摄中常常传出男女主角的桃色新闻一样。从技术角度来说，如果要较完善设计此系统的话，至少有几点值得商榷。</p>
<p>（1）Use server push instead of client pull. 有淘宝用户留言，</p>
<blockquote><p>我从19:50开始，不断刷新页面，都是显示“即将开始”，再刷新，活动已经结束！MLGB…</p></blockquote>
<p>在线拍卖讲究的就是时效性，大家都想以最低的价格得到某样商品，所以非常想知道最新的价格，这时候就疯狂刷页面，造成服务器压力很大。另外一种做法是Server Push, <span style="color: #ff0000;"><strong>“你们都不要刷了，有消息会告诉你们的，回家等着吧。”</strong></span> 这种东东就叫做Server Push。也不是什么新的概念，用Java applet等插件N年前都能实现，但让每个人都装这么个插件显然代价太大。现在的SilverLight, Flex也能实现类似功能，但需要安装插件。<a href="http://cometdproject.dojotoolkit.org/">Dojo的Comet</a>很好地解决了这个问题。code在<a href="http://svn.cometd.com/trunk/">这里</a>。不用装插件，可以穿越防火墙，而且scalability很好，也可以做cluster。淘宝的兄弟们真应该考虑一下这个东西。对Java天然支持。很可能将是Servlet 3.0的一部分，HTML5中也有类似的概念了。Server Push的应用范围主要在Server需要主动传递信息给client的情况，如在线拍卖，聊天，股票报价等。下面是一个介绍的slide，有兴趣的朋友，仔细看看。5分钟就可以用maven弄一个玩玩。</p>
<div id="__ss_192886" style="width: 425px; text-align: left;"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" title="Time for Comet?" href="http://www.slideshare.net/simon/time-for-comet">Time for Comet?</a><object style="margin:0px" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=time-for-comet-1196863649369632-2&amp;rel=0&amp;stripped_title=time-for-comet" /><param name="allowfullscreen" value="true" /><embed style="margin:0px" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=time-for-comet-1196863649369632-2&amp;rel=0&amp;stripped_title=time-for-comet" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
<p>（2）用一点anti-spamming技术吧，在这里就是验证码(CAPTCHA)。只有人能拍，程序不能拍。</p>
<p>（3）防一下DoS攻击，把疯狂刷页面的同学的IP暂时放入黑名单，或者弹出一个验证码页面。</p>
]]></content:encoded>
			<wfw:commentRss>http://libaocun.com/online-auction-design/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Open source my Facebook app</title>
		<link>http://libaocun.com/open-source-my-facebook-app</link>
		<comments>http://libaocun.com/open-source-my-facebook-app#comments</comments>
		<pubDate>Sat, 05 Sep 2009 03:07:06 +0000</pubDate>
		<dc:creator>Bali</dc:creator>
				<category><![CDATA[Chinese - 中文]]></category>
		<category><![CDATA[ACT]]></category>
		<category><![CDATA[SNS]]></category>

		<guid isPermaLink="false">http://www.balionweb.com/?p=166</guid>
		<description><![CDATA[http://balionweb.googlecode.com/svn/trunk/TellYouTruth/
Code如上。php写的。
Facebook.com在国内被GFW了，但毫无疑问它引领了Open API的潮流，与至于国内的很多公司直接抄CSS, JS，实在山寨得可以。这些code写于一年多前，是受42friends团队中的David同学的感召，写来玩玩的。它的功能也非常简单，模仿在blog一度非常流行的游戏：A回答B的问卷，然后A再加上一个问题，将这个新问卷发给他的5个好友。如此循环。大家约定要如实回答问题。问题不加限制，常常是很囧那种，如你被外星人带走怎么办只类的。故此命名为TellYouTruth.
写好后，我还给该App加过广告链接，推广给好友。3个月大约赚到1美元，然后就不玩了。
体会下来，SNS的App有几个特点：
1）非常简单。如果15秒内用户搞不清楚这东西是干嘛的，他就不想玩了。
2）偏重娱乐性。大家上SNS最主要的目的就是“扎堆，聊天，Kill time”（貌似是mayi的麦田说的？）。一本正经地弄出Business App一般很少有人问津。有人说LinkedIn就很严肃啊，Well，他那个人气和盈利模式你也知道。
3）SNS的价值。很多人说，SNS要变成这个，要变成那个。但我个人觉得，没那么复杂。很大程度上是投资人背后的吹打手写的貌似中立的文章罢了。人们互相认识可以在酒吧，但谈生意还是更喜欢去咖啡厅或高尔夫球场。SNS光靠广告盈利貌似前途渺茫，和搜索不同。甚至我认为SNS作为单个实体去盈利就是很难的，可以和其他的东西结合起来。很多硬件公司（如Intel）做的软件都是亏钱的，号称无私地去贡献code给开源社区，还听说Oracle用Intel的compiler的话，Intel甚至要付钱给Oracle。为什么这样做？左手亏钱，右手补。用Intel软件的优化出来的软件，在Intel的硬件平台上会有比竞争对手更好（如AMD）更好的表现，那最终用户就喜欢Intel的平台咯。
所以，天下没有免费的午餐的，但有共赢。
他们把这种事情不叫development, 也不叫marketing，叫做&#8221;enabling&#8221;。中文应该译作叫“推动”？
一句话，SNS有价值，但还没有被充分发掘。
]]></description>
			<content:encoded><![CDATA[<p><a href="http://balionweb.googlecode.com/svn/trunk/TellYouTruth/">http://balionweb.googlecode.com/svn/trunk/TellYouTruth/</a></p>
<p>Code如上。php写的。</p>
<div id="attachment_183" class="wp-caption alignnone" style="width: 698px"><a href="http://www.balionweb.com/wp-content/uploads/2009/09/tell-you-truth.jpg"><img class="size-full wp-image-183" title="tell-you-truth" src="http://www.balionweb.com/wp-content/uploads/2009/09/tell-you-truth.jpg" alt="tell-you-truth" width="688" height="479" /></a><p class="wp-caption-text">tell-you-truth</p></div>
<p>Facebook.com在国内被GFW了，但毫无疑问它引领了Open API的潮流，与至于国内的很多公司直接抄CSS, JS，实在山寨得可以。这些code写于一年多前，是受42friends团队中的David同学的感召，写来玩玩的。它的功能也非常简单，模仿在blog一度非常流行的游戏：A回答B的问卷，然后A再加上一个问题，将这个新问卷发给他的5个好友。如此循环。大家约定要如实回答问题。问题不加限制，常常是很囧那种，如你被外星人带走怎么办只类的。故此命名为TellYouTruth.</p>
<p>写好后，我还给该App加过广告链接，推广给好友。3个月大约赚到1美元，然后就不玩了。</p>
<p>体会下来，SNS的App有几个特点：</p>
<p>1）非常简单。如果15秒内用户搞不清楚这东西是干嘛的，他就不想玩了。</p>
<p>2）偏重娱乐性。大家上SNS最主要的目的就是“扎堆，聊天，Kill time”（貌似是mayi的麦田说的？）。一本正经地弄出Business App一般很少有人问津。有人说LinkedIn就很严肃啊，Well，他那个人气和盈利模式你也知道。</p>
<p>3）SNS的价值。很多人说，SNS要变成这个，要变成那个。但我个人觉得，没那么复杂。很大程度上是投资人背后的吹打手写的貌似中立的文章罢了。人们互相认识可以在酒吧，但谈生意还是更喜欢去咖啡厅或高尔夫球场。SNS光靠广告盈利貌似前途渺茫，和搜索不同。甚至我认为SNS作为单个实体去盈利就是很难的，可以和其他的东西结合起来。很多硬件公司（如Intel）做的软件都是亏钱的，号称无私地去贡献code给开源社区，还听说Oracle用Intel的compiler的话，Intel甚至要付钱给Oracle。为什么这样做？左手亏钱，右手补。用Intel软件的优化出来的软件，在Intel的硬件平台上会有比竞争对手更好（如AMD）更好的表现，那最终用户就喜欢Intel的平台咯。</p>
<p>所以，天下没有免费的午餐的，但有共赢。</p>
<p>他们把这种事情不叫development, 也不叫marketing，叫做&#8221;enabling&#8221;。中文应该译作叫“推动”？</p>
<p>一句话，SNS有价值，但还没有被充分发掘。</p>
]]></content:encoded>
			<wfw:commentRss>http://libaocun.com/open-source-my-facebook-app/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Calling SQL Server Stored Procedures with ADO.NET in 5 minutes</title>
		<link>http://libaocun.com/calling-sql-server-stored-procedures-with-ado-net-in-5-minutes</link>
		<comments>http://libaocun.com/calling-sql-server-stored-procedures-with-ado-net-in-5-minutes#comments</comments>
		<pubDate>Sun, 02 Aug 2009 02:35:01 +0000</pubDate>
		<dc:creator>Bali</dc:creator>
				<category><![CDATA[English - 英文]]></category>
		<category><![CDATA[ACT]]></category>
		<category><![CDATA[db]]></category>

		<guid isPermaLink="false">http://www.balionweb.com/?p=12</guid>
		<description><![CDATA[A stored procedure is an already written SQL statement that is saved in the database. It can take parameters; return objects you specified, just like what happens in any other programming languages you are familiar with.
 
Why stored procedures instead of random SQL? For me:
1. Modular Programming- Stored procedures allow developers to encapsulate business functionality [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;" lang="EN-US"><span style="font-family: Calibri; font-size: small;">A stored procedure is an already written SQL statement that is saved in the database. It can take parameters; return objects you specified, just like what happens in any other programming languages you are familiar with.</span></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span lang="EN-US"><span style="font-family: Calibri; font-size: small;"><span style="font-family: Calibri; font-size: small;"> </span></span></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;" lang="EN-US"><span style="font-family: Calibri; font-size: small;">Why stored procedures instead of random SQL? For me:</span></span></p>
<p class="MsoListParagraph" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;" lang="EN-US"><span><span style="font-family: Calibri; font-size: small;">1.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;"> </span></span></span></span><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;" lang="EN-US"><span style="font-family: Calibri; font-size: small;">Modular Programming- <em>Stored procedures</em> allow developers to encapsulate business functionality and provide callers with a simple interface. Once interfaces are settled down, caller and callee coding work can be assigned to different team/persons.</span></span></p>
<p class="MsoListParagraph" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;" lang="EN-US"><span><span style="font-family: Calibri; font-size: small;">2.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;"> </span></span></span></span><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;" lang="EN-US"><span style="font-family: Calibri; font-size: small;">Security Enhancement- Users can be granted permission to execute a stored procedure. Use parameterized queries—not string concatenation—to build queries.</span></span></p>
<p class="MsoListParagraph" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt;"><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;" lang="EN-US"><span><span style="font-family: Calibri; font-size: small;">3.<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;"> </span></span></span></span><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;" lang="EN-US"><span style="font-family: Calibri; font-size: small;">Reduce network traffic – Benefits can be easily noticed if you have frequently called T-SQL code of hundreds of lines.</span></span></p>
<p class="MsoListParagraph" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt;"><span style="font-family: 'Verdana','sans-serif';" lang="EN-US"><span><span style="font-family: Calibri; font-size: small;"><span style="font-size: small;">4.</span><span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;"> </span></span></span></span><span style="font-family: 'Verdana','sans-serif'; font-size: 10pt;" lang="EN-US"><span style="font-family: Calibri; font-size: small;">Performance – Stored procedures are registered at servers, and as a result DBAs/servers get more change to optimize them.</span></span><span style="font-family: 'Verdana','sans-serif';" lang="EN-US"> </span></p>
<p class="MsoListParagraph" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt;"><span lang="EN-US"> </span></p>
<p class="MsoListParagraph" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt;"><span lang="EN-US"><span style="font-family: Calibri; font-size: small;">Coding time now. </span></span><span lang="EN-US"><span style="font-family: Calibri; font-size: small;">Firstly, you need run below SQL script in SQL2005. </span></span></p>
<p class="MsoListParagraph" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt;">
<p class="MsoListParagraph" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt;"><span lang="EN-US"><span style="font-family: Calibri; font-size: small;"><strong><span style="text-decoration: underline;">SQL Script</span></strong></span></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left;" align="left"><span style="font-family: 'Courier New'; font-size: 10pt;" lang="EN-US"><strong> </strong></span></p>
<table class="MsoTableGrid" style="border: medium none ; background: #eeece1 none repeat scroll 0% 0%; border-collapse: collapse; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="border: medium none black; padding: 0in 5.4pt; background-color: transparent; width: 6.15in;" width="900" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: green; font-size: 8pt;">&#8211; Create a test DB</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: blue; font-size: 8pt;">USE</span><span style="font-family: 'Courier New'; font-size: 8pt;"> [master] </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;">GO</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: blue; font-size: 8pt;">CREATE</span><span style="font-family: 'Courier New'; font-size: 8pt;"> <span style="color: blue;">DATABASE</span> SpTestDB</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;">GO</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: blue; font-size: 8pt;">USE</span><span style="font-family: 'Courier New'; font-size: 8pt;"> SpTestDB</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;">GO</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: green; font-size: 8pt;">&#8211; Create a test Table</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: blue; font-size: 8pt;">CREATE</span><span style="font-family: 'Courier New'; font-size: 8pt;"> <span style="color: blue;">TABLE</span> dbo<span style="color: gray;">.</span>TestTable <span style="color: gray;">(</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>id [nvarchar]<span style="color: gray;">(</span>50<span style="color: gray;">)</span> <span style="color: gray;">NULL,</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>SomeValue [int] <span style="color: gray;">NULL</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: gray; font-size: 8pt;">)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;">GO</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: green; font-size: 8pt;">&#8211; Create read SP</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: blue; font-size: 8pt;">CREATE</span><span style="font-family: 'Courier New'; font-size: 8pt;"> <span style="color: blue;">PROCEDURE</span> dbo<span style="color: gray;">.</span>ReadData</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>@id <span style="color: blue;">nvarchar</span> <span style="color: gray;">(</span>50<span style="color: gray;">)</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: blue; font-size: 8pt;">AS</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: blue; font-size: 8pt;">BEGIN</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: blue;">SELECT</span> <span style="color: gray;">*</span> <span style="color: blue;">FROM</span> dbo<span style="color: gray;">.</span>TestTable</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: blue;">WHERE</span> id <span style="color: gray;">=</span> @id<span style="color: gray;">;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span style="color: gray;"><span style="color: #0000ff;">END</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;">GO</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: green; font-size: 8pt;">&#8211; Create write SP</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: blue; font-size: 8pt;">CREATE</span><span style="font-family: 'Courier New'; font-size: 8pt;"> <span style="color: blue;">PROCEDURE</span> dbo<span style="color: gray;">.</span>WriteData</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>@id <span style="color: blue;">nvarchar</span> <span style="color: gray;">(</span>50<span style="color: gray;">),</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>@SomeValue <span style="color: blue;">int</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: blue; font-size: 8pt;">AS</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: blue; font-size: 8pt;">BEGIN</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: blue;">INSERT</span> <span style="color: blue;">INTO</span> dbo<span style="color: gray;">.</span>TestTable <span style="color: gray;">(</span>id<span style="color: gray;">,</span> SomeValue<span style="color: gray;">)</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: blue;">VALUES</span> <span style="color: gray;">(</span>@id<span style="color: gray;">,</span> @SomeValue<span style="color: gray;">);</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span style="color: gray;"><span style="color: #0000ff;">END</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;">GO</span></p>
</td>
</tr>
</tbody>
</table>
<p><strong> </strong></p>
<p class="MsoListParagraph" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt;"><span lang="EN-US"><span style="font-family: Calibri; font-size: small;">Next, you can call in ADO.NET. </span></span></p>
<p class="MsoListParagraph" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt;">
<p class="MsoListParagraph" style="margin: 0cm 0cm 0pt 18pt; text-indent: -18pt;"><span lang="EN-US"><span style="font-family: Calibri; font-size: small;"><strong><span style="text-decoration: underline;">ADO.NET C# code</span></strong></span></span></p>
<table class="MsoTableGrid" style="border: medium none ; background: #eeece1 none repeat scroll 0% 0%; border-collapse: collapse; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="border: medium none black; padding: 0in 5.4pt; background-color: transparent; width: 6.15in;" width="900" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: blue; font-size: 8pt;">using</span><span style="font-family: 'Courier New'; font-size: 8pt;"> System;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: blue; font-size: 8pt;">using</span><span style="font-family: 'Courier New'; font-size: 8pt;"> System.Collections.Generic;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: blue; font-size: 8pt;">using</span><span style="font-family: 'Courier New'; font-size: 8pt;"> System.Text;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: blue; font-size: 8pt;">using</span><span style="font-family: 'Courier New'; font-size: 8pt;"> System.Data.SqlClient;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; color: blue; font-size: 8pt;">namespace</span><span style="font-family: 'Courier New'; font-size: 8pt;"> ConsoleApplication4</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;">{</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: blue;">class</span> <span style="color: #2b91af;">Program</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>{</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: green;">// NOTICE: You MUST replace &#8216;localhost\baligoal&#8217; with your own DB instance name</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: blue;">const</span> <span style="color: blue;">string</span> ConnString = <span style="color: #a31515;">@&#8221;Data Source=localhost\baligoal;Initial Catalog=SpTestDB;Integrated Security=True&#8221;</span>;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: gray;">///</span><span style="color: green;"> </span><span style="color: gray;">&lt;summary&gt;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: gray;">///</span><span style="color: green;"> Write a record to DB with stored procedure &#8220;WriteData&#8221;,</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: gray;">///</span><span style="color: green;"> and then read it out with stored procedure &#8220;ReadData&#8221;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: gray;">///</span><span style="color: green;"> </span><span style="color: gray;">&lt;/summary&gt;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: gray;">///</span><span style="color: green;"> </span><span style="color: gray;">&lt;param name=&#8221;args&#8221;&gt;&lt;/param&gt;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: blue;">static</span> <span style="color: blue;">void</span> Main(<span style="color: blue;">string</span>[] args)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>{</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: blue;">const</span> <span style="color: blue;">string</span> TestID = <span style="color: #a31515;">&#8220;firstid&#8221;</span>;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: blue;">const</span> <span style="color: blue;">int</span> TestValue = 500;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: green;">// Firstly, write a record with store procedure</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span> </span><span style="color: blue;">using</span> (<span style="color: #2b91af;">SqlConnection</span> conn = <span style="color: blue;">new</span> <span style="color: #2b91af;">SqlConnection</span>(ConnString))</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>{</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: green;">// Specify &#8216;WriteData&#8217; procedure in the params</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: blue;">using</span> (<span style="color: #2b91af;">SqlCommand</span> cmd = <span style="color: blue;">new</span> <span style="color: #2b91af;">SqlCommand</span>(<span style="color: #a31515;">&#8220;WriteData&#8221;</span>, conn))</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>{</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>cmd.CommandType = System.Data.<span style="color: #2b91af;">CommandType</span>.StoredProcedure;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: green;">// The param names are exactly the same with SP WriteData&#8217;s</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>cmd.Parameters.AddWithValue(<span style="color: #a31515;">&#8220;@id&#8221;</span>, TestID);</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>cmd.Parameters.AddWithValue(<span style="color: #a31515;">&#8220;@SomeValue&#8221;</span>, TestValue);</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>cmd.Connection.Open();</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>cmd.ExecuteNonQuery();</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>}</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>}</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: green;">// If you set BP here, and check you DB table, you should find &#8216;firstid, 500&#8242; there</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: #2b91af;">Console</span>.WriteLine(<span style="color: #a31515;">&#8220;Write: done.&#8221;</span>);</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: green;">// Next, read it out with store procedure</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: blue;">using</span> (<span style="color: #2b91af;">SqlConnection</span> conn = <span style="color: blue;">new</span> <span style="color: #2b91af;">SqlConnection</span>(ConnString)) {</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: green;">// Specify &#8216;ReadData&#8217; procedure in the params</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: blue;">using</span> (<span style="color: #2b91af;">SqlCommand</span> cmd = <span style="color: blue;">new</span> <span style="color: #2b91af;">SqlCommand</span>(<span style="color: #a31515;">&#8220;ReadData&#8221;</span>, conn)) {</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>cmd.CommandType = System.Data.<span style="color: #2b91af;">CommandType</span>.StoredProcedure;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: green;">// The param names is exactly the same with SP ReadData&#8217;s</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>cmd.Parameters.AddWithValue(<span style="color: #a31515;">&#8220;@id&#8221;</span>, TestID);</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>cmd.Connection.Open();</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: blue;">using</span> (<span style="color: #2b91af;">SqlDataReader</span> reader = cmd.ExecuteReader())</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>{</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: blue;">if</span> (reader.Read()) {</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: #2b91af;">Console</span>.WriteLine(<span style="color: #a31515;">&#8220;read: id &#8211; &#8220;</span> + <span style="color: #2b91af;">Convert</span>.ToString(reader[0]));</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: #2b91af;">Console</span>.WriteLine(<span style="color: #a31515;">&#8220;read: SomeValue &#8211; &#8220;</span> + <span style="color: #2b91af;">Convert</span>.ToInt32(reader[1]));</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>}</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>}</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>}</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>}</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span style="color: green;">// End for bp</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span><span> </span><span style="color: #2b91af;">Console</span>.WriteLine(<span style="color: #a31515;">&#8220;exit&#8221;</span>);</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>}</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;"><span> </span>}</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 8pt;">}</span></p>
<p class="MsoNormal" style="margin: 0in 0in 10pt; line-height: normal;"><span style="font-family: 'Courier New'; font-size: 10pt;"> </span></p>
</td>
</tr>
</tbody>
</table>
<p>That is it.</p>
]]></content:encoded>
			<wfw:commentRss>http://libaocun.com/calling-sql-server-stored-procedures-with-ado-net-in-5-minutes/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
