<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type='text/xsl' href='http://dineshpriyankara.spaces.live.com/mmm2008-05-17_13.22/rsspretty.aspx?rssquery=en-US;http%3a%2f%2fdineshpriyankara.spaces.live.com%2fcategory%2f__x1NET%2b2__x10%2ffeed.rss' version='1.0'?><rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:msn="http://schemas.microsoft.com/msn/spaces/2005/rss" xmlns:live="http://schemas.microsoft.com/live/spaces/2006/rss" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Dinesh's Blog             ::::::: Being Compiled :::::::: .NET 2.0</title><description /><link>http://dineshpriyankara.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&amp;_c=BlogPart&amp;partqs=cat__x1NET%2b2__x10</link><language>en-US</language><pubDate>Thu, 26 Jun 2008 19:40:52 GMT</pubDate><lastBuildDate>Thu, 26 Jun 2008 19:40:52 GMT</lastBuildDate><generator>Microsoft Spaces v1.1</generator><docs>http://www.rssboard.org/rss-specification</docs><ttl>60</ttl><cf:parentRSS>http://dineshpriyankara.spaces.live.com/blog/feed.rss</cf:parentRSS><live:type>blogcategory</live:type><live:identity><live:id>4683496953178731031</live:id><live:alias>dineshpriyankara</live:alias></live:identity><cf:listinfo><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="typelabel" label="Type" /><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="tag" label="Tag" /><cf:group element="category" label="Category" /><cf:sort element="pubDate" label="Date" data-type="date" default="true" /><cf:sort element="title" label="Title" data-type="string" /><cf:sort ns="http://purl.org/rss/1.0/modules/slash/" element="comments" label="Comments" data-type="number" /></cf:listinfo><item><title>Data source configuration wizard does not recognize the schema of the object</title><link>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!592.entry</link><description>&lt;p style="font-family:verdana,geneva,arial,sans-serif"&gt;&lt;font size=1&gt;I noticed this while I was writing a sample application. If
you go through the “Data Source Configuration Wizard” of a web control (ex.
DropDownList) and if you select the “Specify columns from a table or view”
option (like attached image), you will see that the schema of the table is not
added and control will not be populated with data. Data can be populated
without any problem if you select the first option. I’m not sure whether this
is a bug or not but let me know if you know the reason for this.&lt;/font&gt;&lt;div&gt;&lt;table cellspacing="0" border="0"&gt;&lt;tr height="8"&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;p&gt;&lt;a href="http://blufiles.storage.live.com&amp;#47;y1p2p3BFg5v6WPB3du8fzRl5HE6lu58_XTXg7N7saAdsZij6pHrwNf3GSFtg6BdiR_e"&gt;&lt;img src="http://storage.live.com&amp;#47;items&amp;#47;40FF1FAA28D7B217&amp;#33;593&amp;#58;thumbnail" border="0"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="15"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4683496953178731031&amp;page=RSS%3a+Data+source+configuration+wizard+does+not+recognize+the+schema+of+the+object&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dineshpriyankara.spaces.live.com&amp;amp;GT1=dineshpriyankara"&gt;</description><comments>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!592.entry#comment</comments><guid isPermaLink="true">http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!592.entry</guid><pubDate>Tue, 11 Jul 2006 11:21:01 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dineshpriyankara.spaces.live.com/blog/cns!40FF1FAA28D7B217!592/comments/feed.rss</wfw:commentRss><wfw:comment>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!592.entry#comment</wfw:comment><dcterms:modified>2006-07-11T11:21:01Z</dcterms:modified></item><item><title>The capacity of ArrayList is changed.</title><link>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!397.entry</link><description>&lt;div&gt;
&lt;p style=""&gt;&lt;font face="Times New Roman"&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;Did you notice that the default capacity and capacity once filled are changed in net 2.0? Yes, with 1.0 and 1.1 the default capacity of the ArrayList is 16. But with version 2.0, the default capacity is 0 and once added, it is 4. Has performance been more considered?&lt;br&gt;&lt;br&gt;check and see the below code with both 1.1 and 2.0&lt;br&gt;&lt;/font&gt;
&lt;p&gt;&lt;font size=1&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif"&gt;System.Collections.ArrayList arrayList = &lt;/font&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" color="#0000ff"&gt;new&lt;/font&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif"&gt;&lt;font color="#0000ff"&gt; &lt;/font&gt;System.Collections.ArrayList();&lt;br&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;Console.WriteLine(arrayList.Capacity);&lt;br&gt;&lt;/font&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;arrayList.Add(1);&lt;br&gt;&lt;/font&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;Console.WriteLine(arrayList.Capacity);&lt;/font&gt;&lt;font face=Tahoma&gt;&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4683496953178731031&amp;page=RSS%3a+The+capacity+of+ArrayList+is+changed.&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dineshpriyankara.spaces.live.com&amp;amp;GT1=dineshpriyankara"&gt;</description><comments>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!397.entry#comment</comments><guid isPermaLink="true">http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!397.entry</guid><pubDate>Thu, 29 Dec 2005 00:33:15 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dineshpriyankara.spaces.live.com/blog/cns!40FF1FAA28D7B217!397/comments/feed.rss</wfw:commentRss><wfw:comment>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!397.entry#comment</wfw:comment><dcterms:modified>2005-12-29T00:33:15Z</dcterms:modified></item><item><title>Mobile .NET Development Environment</title><link>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!381.entry</link><description>&lt;p style=""&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;Almost all developers customize their development environment for their won programming style. VS 2005 is open for extensive customization and because of that we can control the entire environment by setting as we want to use and we want see.&lt;/font&gt;
&lt;p style=""&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt; &lt;/font&gt;
&lt;p style=""&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;One nice feature of this is ability to save the configuration of the style we applied and load it when we want. If you are a person who does demonstration by using something like projectors, surely you need to have different font settings for demonstration. Having a saved development environment will be a smart option for this kind of purposes.&lt;/font&gt;
&lt;p style=""&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt; &lt;/font&gt;
&lt;p style=""&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;Not only that, having a mobile development environment will help you to have the same environment on all the machines you use.&lt;/font&gt;
&lt;p style=""&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt; &lt;/font&gt;
&lt;div&gt;&lt;span style="font-size:12pt;font-family:'Times New Roman'"&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;Exporting (saving) and importing (loading) can be done through “&lt;strong&gt;Import and Export Settings…&lt;/strong&gt;” menu item under “&lt;strong&gt;Tools&lt;/strong&gt;”. Files saved are stored with “&lt;strong&gt;&lt;font color="#800000"&gt;vssettings&lt;/font&gt;&lt;/strong&gt;” extension.&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size:12pt;font-family:'Times New Roman'"&gt;&lt;font face=Verdana size=1&gt;&lt;/font&gt;&lt;/span&gt; &lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4683496953178731031&amp;page=RSS%3a+Mobile+.NET+Development+Environment&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dineshpriyankara.spaces.live.com&amp;amp;GT1=dineshpriyankara"&gt;</description><comments>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!381.entry#comment</comments><guid isPermaLink="true">http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!381.entry</guid><pubDate>Thu, 24 Nov 2005 01:36:00 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dineshpriyankara.spaces.live.com/blog/cns!40FF1FAA28D7B217!381/comments/feed.rss</wfw:commentRss><wfw:comment>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!381.entry#comment</wfw:comment><dcterms:modified>2005-11-24T01:36:00Z</dcterms:modified></item><item><title>Wanna see diagnostic details of SQL Server with single line of code?</title><link>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!379.entry</link><description>&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;How nice if you can obtain some statistics of the connection like ConnectionTime, RowsSelected and NofRoundTrips with less codes? Yes, now you can. What you have to do is, simply make StatisticsEnabled of SqlConnection true. Once it is closed, you can get all you need with RetrieveStatistics method. See the code below.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;font color="#008080"&gt;SqlConnection &lt;/font&gt;sqlConnection = &lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;font color="#008080"&gt;SqlConnection&lt;/font&gt;(&lt;font color="#993300"&gt;&amp;quot;Server=(local);Database=AdventureWorks;Integrated Security=SSPI&amp;quot;&lt;/font&gt;);&lt;br&gt;&lt;font color="#008000"&gt;//Enabling the statistics collector&lt;/font&gt;&lt;br&gt;sqlConnection.StatisticsEnabled = &lt;font color="#0000ff"&gt;true&lt;/font&gt;;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;font color="#008080"&gt;SqlCommand &lt;/font&gt;sqlCommand = &lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;font color="#008080"&gt;SqlCommand&lt;/font&gt;(&lt;font color="#993300"&gt;&amp;quot;SELECT * FROM Person.Address&amp;quot;&lt;/font&gt;, sqlConnection);&lt;br&gt;sqlConnection.Open();&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;font color="#008000"&gt;//edxecuting first command&lt;br&gt;&lt;/font&gt;&lt;font color="#008080"&gt;SqlDataReader &lt;/font&gt;sqlDataReader = sqlCommand.ExecuteReader();&lt;br&gt;sqlDataReader.Close();&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;font color="#008000"&gt;//executing second command&lt;/font&gt;&lt;br&gt;sqlCommand.CommandText = &lt;font color="#993300"&gt;&amp;quot;SELECT * FROM Person.Contact&amp;quot;&lt;/font&gt;;&lt;br&gt;sqlDataReader = sqlCommand.ExecuteReader();&lt;br&gt;sqlDataReader.Close();&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;sqlConnection.Close();&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;font color="#008000"&gt;//load statistics to dictionary&lt;/font&gt;&lt;br&gt;&lt;font color="#008080"&gt;Hashtable &lt;/font&gt;statistics = (&lt;font color="#008080"&gt;Hashtable&lt;/font&gt;) sqlConnection.RetrieveStatistics();&lt;br&gt;&lt;font color="#0000ff"&gt;foreach &lt;/font&gt;(&lt;font color="#0000ff"&gt;string &lt;/font&gt;key &lt;font color="#0000ff"&gt;in &lt;/font&gt;statistics.Keys)&lt;br&gt;{&lt;br&gt; &lt;font color="#008080"&gt;Console&lt;/font&gt;.WriteLine(key + &amp;quot;: &amp;quot; + statistics[key]);&lt;br&gt;}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;Is it useful?&lt;br&gt; &lt;br&gt;&lt;/font&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4683496953178731031&amp;page=RSS%3a+Wanna+see+diagnostic+details+of+SQL+Server+with+single+line+of+code%3f&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dineshpriyankara.spaces.live.com&amp;amp;GT1=dineshpriyankara"&gt;</description><comments>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!379.entry#comment</comments><guid isPermaLink="true">http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!379.entry</guid><pubDate>Tue, 22 Nov 2005 02:25:48 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dineshpriyankara.spaces.live.com/blog/cns!40FF1FAA28D7B217!379/comments/feed.rss</wfw:commentRss><wfw:comment>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!379.entry#comment</wfw:comment><dcterms:modified>2005-11-22T04:50:58Z</dcterms:modified></item><item><title>Is it smart relative of Ternary Operator?</title><link>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!378.entry</link><description>&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;Accidentally I found this new operator while I was searching for best ways to convert nullable types to non-nullable types. Have you heard about it? It is &lt;strong&gt;&lt;font color="#800000"&gt;“??”&lt;/font&gt;&lt;/strong&gt; operator. You might have heard about it. Let’s see how to use it.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size=1&gt;&lt;/font&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif"&gt; &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size=1&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif"&gt;&lt;font color="#008000"&gt;//declare nullable int variable&lt;/font&gt;&lt;br&gt;&lt;font color="#0000ff"&gt;int&lt;/font&gt;? nullableInt = &lt;font color="#0000ff"&gt;null&lt;/font&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size=1&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif"&gt;&lt;font color="#008000"&gt;//declare non-nullable int variable&lt;/font&gt;&lt;br&gt;&lt;font color="#0000ff"&gt;int &lt;/font&gt;nonNullableInt;&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size=1&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif"&gt;&lt;font color="#008000"&gt;//Let's try to convert nullableInt into nonNullableInt&lt;/font&gt;&lt;br&gt;&lt;font color="#008000"&gt;//first implicit conversion&lt;/font&gt;&lt;br&gt;nonNullableInt = nullableInt; &lt;font color="#008000"&gt;//compiler error.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size=1&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif"&gt;&lt;font color="#008000"&gt;//explicit conversion&lt;/font&gt;&lt;br&gt;nonNullableInt = (&lt;font color="#0000ff"&gt;int&lt;/font&gt;)nullableInt; &lt;font color="#008000"&gt;//runtime error &lt;/font&gt;&lt;font color="#008000"&gt;because nullableInt has no value&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size=1&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif"&gt;&lt;font color="#008000"&gt;//using ternary operator&lt;/font&gt;&lt;br&gt;nonNullableInt = nullableInt == &lt;font color="#0000ff"&gt;null &lt;/font&gt;? 0 : (&lt;font color="#0000ff"&gt;int&lt;/font&gt;)nullableInt;&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size=1&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif"&gt;&lt;font color="#008000"&gt;//using new ?? operator&lt;/font&gt;&lt;br&gt;nonNullableInt = nullableInt ?? 0;&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size=1&gt;&lt;/font&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif"&gt; &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;The “??” operator returns the right-side value (in this case 0) if the left-side (nullableInt) is null or else it returns the left-side. How useful it is? Seems it comes in handy with user-defined types too.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;font size=1&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif"&gt;&lt;font color="#008080"&gt;Employee &lt;/font&gt;employee1 = &lt;font color="#0000ff"&gt;null&lt;/font&gt;;&lt;br&gt;&lt;font color="#008080"&gt;Employee &lt;/font&gt;employee2 = employee1 ?? &lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;font color="#008080"&gt;Employee&lt;/font&gt;();&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size=1&gt;&lt;/font&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif"&gt; &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;I surfed in the internet to find the name of it but couldn’t. If you know, please let me know.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size=1&gt;&lt;/font&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif"&gt; &lt;/font&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4683496953178731031&amp;page=RSS%3a+Is+it+smart+relative+of+Ternary+Operator%3f&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dineshpriyankara.spaces.live.com&amp;amp;GT1=dineshpriyankara"&gt;</description><comments>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!378.entry#comment</comments><guid isPermaLink="true">http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!378.entry</guid><pubDate>Sun, 20 Nov 2005 18:06:43 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dineshpriyankara.spaces.live.com/blog/cns!40FF1FAA28D7B217!378/comments/feed.rss</wfw:commentRss><wfw:comment>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!378.entry#comment</wfw:comment><dcterms:modified>2005-11-20T18:22:51Z</dcterms:modified></item><item><title>Making a class with static members? Make it a Static Class.</title><link>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!377.entry</link><description>&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;Pretty sure that you have written a class that all members are static and it delivers only static members. And definitely, to avoid it get instantiated, you made the constructor private. Unfortunately, still it is open to write members without static keyword and complier won’t enforce to write only static members.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;Now we do not want to worry about adding private constructor and make sure all members are static because C# 2.0 provides a facility make your CLASS static. One advantage of static class is, compiler enforce to make all members added static. So, you won’t miss the static keyword for methods. Another advantage is, no more private constructors are required to stop it get instantiated because once the class is made as static, it cannot be instantiated. See the simple example below and make sure you do it next time.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;font size=1&gt;&lt;font color="#0000ff"&gt;public static class &lt;/font&gt;&lt;font color="#008080"&gt;Class1&lt;/font&gt;&lt;br&gt;{&lt;br&gt;&lt;font color="#0000ff"&gt;   public static void &lt;/font&gt;TestMethod()&lt;br&gt;&lt;font color="#0000ff"&gt;   &lt;/font&gt;{&lt;br&gt;&lt;font color="#008080"&gt;&lt;font color="#0000ff"&gt;      &lt;/font&gt;Console&lt;/font&gt;.WriteLine(&lt;font color="#993300"&gt;&amp;quot;This is test method.&amp;quot;&lt;/font&gt;);&lt;br&gt;&lt;font color="#0000ff"&gt;   &lt;/font&gt;}&lt;br&gt;}&lt;br&gt;&lt;/font&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4683496953178731031&amp;page=RSS%3a+Making+a+class+with+static+members%3f+Make+it+a+Static+Class.&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dineshpriyankara.spaces.live.com&amp;amp;GT1=dineshpriyankara"&gt;</description><comments>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!377.entry#comment</comments><guid isPermaLink="true">http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!377.entry</guid><pubDate>Sun, 20 Nov 2005 07:54:46 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dineshpriyankara.spaces.live.com/blog/cns!40FF1FAA28D7B217!377/comments/feed.rss</wfw:commentRss><wfw:comment>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!377.entry#comment</wfw:comment><dcterms:modified>2005-11-20T07:54:46Z</dcterms:modified></item><item><title>Time is ripe for use of Database Project</title><link>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!313.entry</link><description>&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;In most of applications, Database is part of it. How do you develop and manage your database? Did you use Database Project for managing your application’s database? If yes, you know how rich it is and how useful it is. If no, have a look on guidelines below and see whether you can use it and make your life little bit easy.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;Database Project is a special type of VS.Net project that allows us to design, test, run and manage SQL scripts and queries. Database Projects can be added to the solution just like other projects with the reference to database need to be managed. Have a look on the image below that shows the added Database Project and Server Explorer. &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt; &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;img src="http://storage.msn.com/x1pqP5noGPWAA5YZvlNVhBmo2IhPl8D29ENaglUO3zQcEdxQm9Du97GtXQW5RJEiucO6C0dxBf1kARxcUeQGsgx1D2FTvLkyuDOj7RRgiSKwxfdBPQrF00_xubWwS5jQ_wtsG4HK7b8zB91VpMyPi8loQ" width=400&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt; &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;VS will automatically create three folders for us that allow us to store scripts and queries. We can add new scripts under “Create Scripts” folder by simply right clicking on the folder and using one of the templates given. Not only that, we can generate scripts for already added objects in the server by using “Server Explorer” and store them under the same folder. To do this, the relevant object in the “Server Explorer” has to be selected and right clicked, then need to be clicked on the “Generate Create Script to Project” menu item. The VS will generate the script and add to the “Create Scripts”. The below image shows the way of generating the script for already added object and some manually added scripts.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt; &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;img src="http://storage.msn.com/x1pqP5noGPWAA5YZvlNVhBmo2IhPl8D29ENaglUO3zQcEcRjwMutFYqFmPscEOgLxq5eRKSyipLfPKNNQdiBgPU1oyll_bNM0jdlV_5V99q5-flaiFqVPMoUQWdwqId2lm0uXGZxF4hqQNfrKmnCIUpLg" width=600&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt; &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;If the object created is need to be changed, click on the “Open Table Definition” menu item. It will open the same dialog box that is used to modify tables in the SQL Server VS. Once changed, remember, before saving the object, click on the “Generate Change Script”. It will automatically add the script of the changed item into “Change Scripts”.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt; &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;img src="http://storage.msn.com/x1pqP5noGPWAA5YZvlNVhBmo2IhPl8D29ENaglUO3zQcEdlTLxRyIbFQvqa96Sh0zP-qcAJS8LbIo3wD_qML4MJgM80SV9Nt8wgOPHwHpinUnZUQ-6WVbVC4sbxFOYYhzNXtlgmIsGTPOHO0d6ZbReXOA" width=600&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;The adding change scripts to the folder can be automated by checking the “Automatically generate change script on every save” in the “Generate Change Script” dialog box. This will cause to generate all scripts for changed items when the item is saved. &lt;/font&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;Remember, the change script has to be named in proper manner to identify the change. I have been trying to find a way to automate the naming change scripts (like Customer_20050820) with Macro but so far, unsuccessful. Does it solve your versioning problem with scripts?&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;So, what do you think? Is this an easy way to develop and manage the database layer of our application? We should not forget that this project can be added to the Visual Source Safe too that allows us to manage scripts efficiently among the team.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt; &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;I really want to enlarge on this, so keep your eye open.&lt;br&gt;&lt;/font&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4683496953178731031&amp;page=RSS%3a+Time+is+ripe+for+use+of+Database+Project&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dineshpriyankara.spaces.live.com&amp;amp;GT1=dineshpriyankara"&gt;</description><comments>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!313.entry#comment</comments><guid isPermaLink="true">http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!313.entry</guid><pubDate>Mon, 03 Oct 2005 01:15:31 GMT</pubDate><slash:comments>3</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dineshpriyankara.spaces.live.com/blog/cns!40FF1FAA28D7B217!313/comments/feed.rss</wfw:commentRss><wfw:comment>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!313.entry#comment</wfw:comment><dcterms:modified>2005-10-03T01:15:31Z</dcterms:modified></item><item><title>AsyncCallback with ADO.NET</title><link>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!306.entry</link><description>&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;I am pretty sure that you have already tested asynchronous execution with ADO.NET 2.0. One of the asynchronous models comes with ADO.NET 2.0 is “callback model” that let us to use AsynchCallback delegate that allows to specify callback routine that will be executed when the asynchronous process completes. Have a look on the simple code snippet.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;font color="#0000ff"&gt;string &lt;/font&gt;connectionString = &lt;font color="#993300"&gt;&amp;quot;Server=dinesh;Database=Test01;Integrated Security=True;Asynchronous Processing=true&amp;quot;&lt;/font&gt;;&lt;br&gt;&lt;font color="#0000ff"&gt;string &lt;/font&gt;updateStatement = &lt;font color="#993300"&gt;&amp;quot;UPDATE TestTable02 SET NewColumn = 1 WHERE Id % 2 !=0&amp;quot;&lt;/font&gt;;&lt;br&gt;&lt;font color="#008080"&gt;SqlConnection &lt;/font&gt;sqlConnection = &lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;font color="#008080"&gt;SqlConnection&lt;/font&gt;(connectionString);&lt;br&gt;&lt;font color="#008080"&gt;SqlCommand &lt;/font&gt;sqlCommand = &lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;font color="#008080"&gt;SqlCommand&lt;/font&gt;(updateStatement, sqlConnection);&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;sqlConnection.Open();&lt;br&gt;&lt;font color="#008080"&gt;AsyncCallback &lt;/font&gt;myCallBack = &lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;font color="#008080"&gt;AsyncCallback&lt;/font&gt;(CallBackMethod); &lt;br&gt;&lt;font color="#008080"&gt;IAsyncResult &lt;/font&gt;result = sqlCommand.BeginExecuteNonQuery(myCallBack, sqlCommand);&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;font color="#0000ff"&gt;private void&lt;/font&gt; CallBackMethod(&lt;font color="#008080"&gt;IAsyncResult &lt;/font&gt;result)&lt;br&gt;{&lt;br&gt;&lt;font color="#008080"&gt;   SqlCommand &lt;/font&gt;sqlCommand = (&lt;font color="#008080"&gt;SqlCommand&lt;/font&gt;)result.AsyncState;&lt;br&gt;&lt;font color="#0000ff"&gt;   int &lt;/font&gt;nofRows = sqlCommand.EndExecuteNonQuery(result);&lt;br&gt;&lt;font color="#008080"&gt;   MessageBox&lt;/font&gt;.Show(nofRows.ToString());&lt;br&gt;}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;With this code snippet, a new instance of AsyncCallback is created and used with command exeution that allows us to cotinue the code after command executiion without waiting for the completion. As soon as the query is completed, the callback is called with the reference of AsyncResult that is autometically created by the BeginExecuteNonQuery command. As soon as the test is sucessful, I relasized that this comes in handy with almost all our database operations. &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;OK, now I have a small problem with AsyncCallback. Can’t I use this with console applications? I tried simulate the same with console application, but it gives me a compile error with AsycCallback declaration. Here is the exact error: “&lt;em&gt;An object reference is required for the nonstatic field, method, or property&lt;/em&gt;”. Can you guys tell me the reason for this? &lt;br&gt;&lt;/font&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4683496953178731031&amp;page=RSS%3a+AsyncCallback+with+ADO.NET&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dineshpriyankara.spaces.live.com&amp;amp;GT1=dineshpriyankara"&gt;</description><comments>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!306.entry#comment</comments><guid isPermaLink="true">http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!306.entry</guid><pubDate>Wed, 28 Sep 2005 01:20:10 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dineshpriyankara.spaces.live.com/blog/cns!40FF1FAA28D7B217!306/comments/feed.rss</wfw:commentRss><wfw:comment>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!306.entry#comment</wfw:comment><dcterms:modified>2005-09-28T01:27:42Z</dcterms:modified></item><item><title>Opening Multiple Active Result Sets over the same connection</title><link>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!301.entry</link><description>&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;If you have opened a row set with the sql connection using ADO.NET 1.x, you can’t use the same connection for opening the second row set until the first one is closed. This limitation is overridden by ADO.NET 2.0, which means we can open multiple active result sets over the same connection and access them concurrently. The below code written for demonstrating the way of opening and fetching multiple row sets over the same connection and access them concurrently.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;font color="#0000ff"&gt;string &lt;/font&gt;connectionString = &lt;font color="#993300"&gt;&amp;quot;Server=dinesh;Database=Test01;Integrated Security=True;&amp;quot;&lt;/font&gt;;&lt;br&gt;&lt;font color="#0000ff"&gt;string &lt;/font&gt;firstCommandText = &lt;font color="#993300"&gt;&amp;quot;SELECT Id, FirstName FROM Employee&amp;quot;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;br&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;string &lt;/font&gt;secondCommandText = &lt;font color="#993300"&gt;&amp;quot;SELECT LeaveDate FROM Employee_Leave WHERE EmployeeId = @EmployeeId&amp;quot;&lt;/font&gt;;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;font color="#008000"&gt;//declare the connection and datareaders&lt;br&gt;&lt;/font&gt;&lt;font color="#33cccc"&gt;SqlConnection &lt;/font&gt;sqlConnection = &lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;font color="#33cccc"&gt;SqlConnection&lt;/font&gt;(connectionString);&lt;br&gt;&lt;font color="#33cccc"&gt;SqlCommand &lt;/font&gt;firstSqlCommand = &lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;font color="#33cccc"&gt;SqlCommand&lt;/font&gt;(firstCommandText, sqlConnection);&lt;br&gt;&lt;font color="#33cccc"&gt;SqlCommand &lt;/font&gt;secondSqlCommand = &lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;font color="#33cccc"&gt;SqlCommand&lt;/font&gt;(secondCommandText, sqlConnection);&lt;br&gt;secondSqlCommand.Parameters.Add(new &lt;font color="#33cccc"&gt;SqlParameter&lt;/font&gt;(&lt;font color="#993300"&gt;&amp;quot;EmployeeId&amp;quot;&lt;/font&gt;, &lt;font color="#33cccc"&gt;SqlDbType&lt;/font&gt;.Int));&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;font color="#008000"&gt;//open the connection and get row set&lt;/font&gt;&lt;br&gt;sqlConnection.Open();&lt;br&gt;&lt;font color="#33cccc"&gt;SqlDataReader &lt;/font&gt;firstReader = firstSqlCommand.ExecuteReader();&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;font color="#008000"&gt;//access the first data reader&lt;br&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;while &lt;/font&gt;(firstReader.Read())&lt;br&gt;{&lt;br&gt;&lt;font color="#33cccc"&gt;   Console&lt;/font&gt;.WriteLine(&lt;font color="#33cccc"&gt;Convert&lt;/font&gt;.ToString(firstReader[&lt;font color="#993300"&gt;&amp;quot;FirstName&amp;quot;&lt;/font&gt;]) + &amp;quot;:&amp;quot;);&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;font color="#008000"&gt;&lt;font color="#33cccc"&gt;   &lt;/font&gt;//open the second rowset with same connection and access it concurrently&lt;br&gt;&lt;/font&gt;&lt;font color="#33cccc"&gt;   &lt;/font&gt;secondSqlCommand.Parameters[&lt;font color="#993300"&gt;&amp;quot;EmployeeId&amp;quot;&lt;/font&gt;].Value = &lt;font color="#33cccc"&gt;Convert&lt;/font&gt;.ToInt32(firstReader[&lt;font color="#993300"&gt;&amp;quot;Id&amp;quot;&lt;/font&gt;]);&lt;br&gt;&lt;font color="#33cccc"&gt;   SqlDataReader &lt;/font&gt;secondReader = secondSqlCommand.ExecuteReader();&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;font color="#0000ff"&gt;&lt;font color="#33cccc"&gt;   &lt;/font&gt;while &lt;/font&gt;(secondReader.Read())&lt;br&gt;&lt;font color="#33cccc"&gt;   &lt;/font&gt;{&lt;br&gt;&lt;font color="#33cccc"&gt;      Console&lt;/font&gt;.WriteLine(&lt;font color="#33cccc"&gt;Convert&lt;/font&gt;.ToString(secondReader[&lt;font color="#993300"&gt;&amp;quot;LeaveDate&amp;quot;&lt;/font&gt;]));&lt;br&gt;&lt;font color="#33cccc"&gt;   &lt;/font&gt;}&lt;br&gt;&lt;font color="#33cccc"&gt;   &lt;/font&gt;secondReader.Close();&lt;br&gt;}&lt;br&gt;firstReader.Close();&lt;br&gt;sqlConnection.Close();&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;Not only this, ADO.Net 2.0 provides the ability to execute multiple commands concurrently and asynchronously. Yes, you heard the word, &lt;strong&gt;asynchronously&lt;/strong&gt;. We have been given three distinct techniques called; polling, callback, wait for access and execute data asynchronously. Let me post some ins and outs of this with in-coming posts.&lt;br&gt;&lt;/font&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4683496953178731031&amp;page=RSS%3a+Opening+Multiple+Active+Result+Sets+over+the+same+connection&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dineshpriyankara.spaces.live.com&amp;amp;GT1=dineshpriyankara"&gt;</description><comments>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!301.entry#comment</comments><guid isPermaLink="true">http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!301.entry</guid><pubDate>Sat, 24 Sep 2005 02:16:31 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dineshpriyankara.spaces.live.com/blog/cns!40FF1FAA28D7B217!301/comments/feed.rss</wfw:commentRss><wfw:comment>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!301.entry#comment</wfw:comment><dcterms:modified>2005-09-24T02:16:31Z</dcterms:modified></item><item><title>Built-In Stopwatch</title><link>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!283.entry</link><description>&lt;p&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;How many instances you had to measure the performance of your code? And how did you measure it? If you were working with .net 1.1, you must have created a stopwatch using either Environment.TickCount  or QueryPerformanceCounter  API. The wonderful news is, with .net 2.0, you do not need to worry about creating stopwatch. It is available with framework: &lt;strong&gt;&lt;font color="#800000"&gt;System.Diagnostics.Stopwatch&lt;/font&gt;&lt;/strong&gt;. See now how simple it is.&lt;/font&gt;
&lt;p&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;System.Diagnostics.&lt;font color="#008080"&gt;Stopwatch &lt;/font&gt;stopwatch = new System.Diagnostics.&lt;font color="#008080"&gt;Stopwatch&lt;/font&gt;();&lt;/font&gt;
&lt;p&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;stopwatch.Start();&lt;br&gt;&lt;font color="#0000ff"&gt;for &lt;/font&gt;(&lt;font color="#0000ff"&gt;int &lt;/font&gt;x = 0; x &amp;lt; 1000000; x++)&lt;br&gt;{&lt;br&gt;}&lt;br&gt;stopwatch.Stop();&lt;br&gt;&lt;font color="#008080"&gt;Console&lt;/font&gt;.WriteLine(stopwatch.ElapsedMilliseconds.ToString());&lt;/font&gt;
&lt;p&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;Not only “ElapsedMilliseconds”, you can get TimeSpan too.&lt;/font&gt;
&lt;p&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt; &lt;/font&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4683496953178731031&amp;page=RSS%3a+Built-In+Stopwatch&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dineshpriyankara.spaces.live.com&amp;amp;GT1=dineshpriyankara"&gt;</description><comments>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!283.entry#comment</comments><guid isPermaLink="true">http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!283.entry</guid><pubDate>Thu, 15 Sep 2005 07:13:28 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dineshpriyankara.spaces.live.com/blog/cns!40FF1FAA28D7B217!283/comments/feed.rss</wfw:commentRss><wfw:comment>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!283.entry#comment</wfw:comment><dcterms:modified>2005-09-15T07:13:28Z</dcterms:modified></item><item><title>Why Observer pattern APIs under java.util namespace?</title><link>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!266.entry</link><description>&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;If you are a java developer, you know that java has built-in support for Observer pattern APIs. I just searched the on the .net 2.0 class library for finding similar. Yes, I found the API but under java.util class library. I just wonder why this has been implemented under java.util instead of something called &amp;quot;system.util&amp;quot;. Do you know the reason?&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt; &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;Anyway, here is the way of using the Observer pattern APIs. Remember, you need to import the java.util library.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;font color="#0000ff"&gt;class &lt;/font&gt;&lt;font color="#008080"&gt;MyContainer &lt;/font&gt;: &lt;font color="#008080"&gt;Observable&lt;/font&gt;&lt;br&gt;{&lt;br&gt;   &lt;font color="#0000ff"&gt;private string&lt;/font&gt; _color;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;   &lt;font color="#0000ff"&gt;public string&lt;/font&gt; Color { &lt;font color="#0000ff"&gt;get &lt;/font&gt;{ &lt;font color="#0000ff"&gt;return &lt;/font&gt;_color; } }&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;   &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;   &lt;font color="#0000ff"&gt;public void &lt;/font&gt;colorChanged()&lt;br&gt;   {&lt;br&gt;      setChanged();&lt;br&gt;      notifyObservers();&lt;br&gt;   }&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;   &lt;font color="#0000ff"&gt;public void &lt;/font&gt;SetColor(&lt;font color="#0000ff"&gt;string &lt;/font&gt;color)&lt;br&gt;   {&lt;br&gt;      _color = color;&lt;br&gt;      colorChanged();&lt;br&gt;   }&lt;br&gt;}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;font color="#0000ff"&gt;class &lt;/font&gt;&lt;font color="#008080"&gt;MyCircle &lt;/font&gt;: &lt;font color="#008080"&gt;Observer&lt;/font&gt;&lt;br&gt;{&lt;br&gt;   &lt;font color="#0000ff"&gt;private string &lt;/font&gt;_color;&lt;br&gt;   &lt;font color="#0000ff"&gt;private &lt;/font&gt;&lt;font color="#008080"&gt;Observable &lt;/font&gt;_observable;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;   &lt;font color="#0000ff"&gt;public &lt;/font&gt;MyCircle(&lt;font color="#008080"&gt;Observable &lt;/font&gt;observable)&lt;br&gt;   {&lt;br&gt;      &lt;font color="#0000ff"&gt;this&lt;/font&gt;._observable = observable;&lt;br&gt;      observable.addObserver(&lt;font color="#0000ff"&gt;this&lt;/font&gt;);&lt;br&gt;   }&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;   &lt;font color="#0000ff"&gt;public string&lt;/font&gt; Color {&lt;font color="#0000ff"&gt;get &lt;/font&gt;{&lt;font color="#0000ff"&gt;return &lt;/font&gt;_color;}}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;   &lt;font color="#0000ff"&gt;#region &lt;/font&gt;Observer Members&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;   &lt;font color="#0000ff"&gt;public void &lt;/font&gt;update(&lt;font color="#008080"&gt;Observable &lt;/font&gt;o, &lt;font color="#0000ff"&gt;object &lt;/font&gt;arg)&lt;br&gt;   {&lt;br&gt;      &lt;font color="#0000ff"&gt;if&lt;/font&gt; (o &lt;font color="#0000ff"&gt;is&lt;/font&gt; MyContainer)&lt;br&gt;      {&lt;br&gt;         &lt;font color="#008080"&gt;MyContainer &lt;/font&gt;myContainer = (&lt;font color="#008080"&gt;MyContainer&lt;/font&gt;)o;&lt;br&gt;         _color = myContainer.Color;&lt;br&gt;      }&lt;br&gt;   }&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;   &lt;font color="#0000ff"&gt;#endregion&lt;/font&gt;&lt;br&gt;}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;font color="#0000ff"&gt;class &lt;/font&gt;&lt;font color="#008080"&gt;MyTriangle &lt;/font&gt;: &lt;font color="#008080"&gt;Observer&lt;/font&gt;&lt;br&gt;{&lt;br&gt;   &lt;font color="#0000ff"&gt;private string&lt;/font&gt; _color;&lt;br&gt;   &lt;font color="#0000ff"&gt;private&lt;/font&gt; &lt;font color="#008080"&gt;Observable &lt;/font&gt;_observable;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;   &lt;font color="#0000ff"&gt;public&lt;/font&gt; MyTriangle(&lt;font color="#008080"&gt;Observable &lt;/font&gt;observable)&lt;br&gt;   {&lt;br&gt;      &lt;font color="#0000ff"&gt;this&lt;/font&gt;._observable = observable;&lt;br&gt;      observable.addObserver(&lt;font color="#0000ff"&gt;this&lt;/font&gt;);&lt;br&gt;   }&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;   &lt;font color="#0000ff"&gt;public string &lt;/font&gt;Color { &lt;font color="#0000ff"&gt;get &lt;/font&gt;{ &lt;font color="#0000ff"&gt;return &lt;/font&gt;_color; } }&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Verdana size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;   &lt;font color="#0000ff"&gt;#region&lt;/font&gt; Observer Members&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;   &lt;font color="#0000ff"&gt;public void&lt;/font&gt; update(&lt;font color="#008080"&gt;Observable &lt;/font&gt;o, &lt;font color="#0000ff"&gt;object &lt;/font&gt;arg)&lt;br&gt;   {&lt;br&gt;      &lt;font color="#0000ff"&gt;if&lt;/font&gt; (o &lt;font color="#0000ff"&gt;is&lt;/font&gt; &lt;font color="#008080"&gt;MyContainer&lt;/font&gt;)&lt;br&gt;      {&lt;br&gt;         &lt;font color="#008080"&gt;MyContainer &lt;/font&gt;myContainer = (&lt;font color="#008080"&gt;MyContainer&lt;/font&gt;)o;&lt;br&gt;         _color = myContainer.Color;&lt;br&gt;      }&lt;br&gt;   }&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;   &lt;font color="#0000ff"&gt;#endregion&lt;/font&gt;&lt;br&gt;}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;font color="#008080"&gt;MyContainer &lt;/font&gt;myContainer = &lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;font color="#008080"&gt;MyContainer&lt;/font&gt;();&lt;br&gt;&lt;font color="#008080"&gt;MyCircle &lt;/font&gt;myCircle = &lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;font color="#008080"&gt;MyCircle&lt;/font&gt;(myContainer);&lt;br&gt;&lt;font color="#008080"&gt;MyTriangle &lt;/font&gt;myTriangle = &lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;font color="#008080"&gt;MyTriangle&lt;/font&gt;(myContainer);&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt; &lt;/font&gt;&lt;/div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;/font&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;myContainer.SetColor(&amp;quot;Blue&amp;quot;);&lt;br&gt;&lt;font color="#008080"&gt;Console&lt;/font&gt;.WriteLine(myCircle.Color);&lt;br&gt;&lt;font color="#008080"&gt;Console&lt;/font&gt;.WriteLine(myTriangle.Color);&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt; &lt;/font&gt;&lt;/div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;/font&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;myContainer.SetColor(&amp;quot;Red&amp;quot;);&lt;br&gt;&lt;font color="#008080"&gt;Console&lt;/font&gt;.WriteLine(myCircle.Color);&lt;br&gt;&lt;font color="#008080"&gt;Console&lt;/font&gt;.WriteLine(myTriangle.Color);&lt;/font&gt;&lt;/div&gt;
&lt;p&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;myContainer.SetColor(&amp;quot;Blue&amp;quot;);&lt;br&gt;&lt;font color="#008080"&gt;Console&lt;/font&gt;.WriteLine(myCircle.Color);&lt;br&gt;&lt;font color="#008080"&gt;Console&lt;/font&gt;.WriteLine(myTriangle.Color);&lt;/font&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;br&gt; &lt;/font&gt;&lt;/div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;/font&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=1&gt;&lt;strong&gt;To brush up on Observer Pattern, here is the definition&lt;/strong&gt;: &lt;font color="#800000"&gt;The &lt;strong&gt;Observer Pattern&lt;/strong&gt; defines a one-to-many dependency between objects so that when one object changes state, all of its dependencies are notified and updated automatically. &lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4683496953178731031&amp;page=RSS%3a+Why+Observer+pattern+APIs+under+java.util+namespace%3f&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dineshpriyankara.spaces.live.com&amp;amp;GT1=dineshpriyankara"&gt;</description><comments>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!266.entry#comment</comments><guid isPermaLink="true">http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!266.entry</guid><pubDate>Tue, 30 Aug 2005 00:23:41 GMT</pubDate><slash:comments>2</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dineshpriyankara.spaces.live.com/blog/cns!40FF1FAA28D7B217!266/comments/feed.rss</wfw:commentRss><wfw:comment>http://dineshpriyankara.spaces.live.com/Blog/cns!40FF1FAA28D7B217!266.entry#comment</wfw:comment><dcterms:modified>2005-08-30T00:36:22Z</dcterms:modified></item></channel></rss>