<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-62615523823450575</id><updated>2026-07-24T09:04:10.096+03:00</updated><category term="Programming"/><category term="Tips and Tricks"/><category term="SQL Server"/><title type='text'>MAVRA - Digital Technology</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>51</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-1730555288413161859</id><published>2014-05-03T16:34:00.002+03:00</published><updated>2014-05-03T16:34:37.796+03:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>How to Format Date/Time - SQL Server</title><content type='html'>Sometimes I can&#39;t find a better way to present something then through a series of code/exmaples, so, without much addoo:&lt;br /&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Microsoft SQL Server T-SQL date and datetime formats&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Date time formats - mssql datetime&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- MSSQL getdate returns current system date and time in standard internal format&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;100&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- mon dd yyyy hh:mmAM (or PM)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- Oct&amp;nbsp; 2 2008 11:01AM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;101&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- mm/dd/yyyy&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;-&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;10/02/2008&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;102&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- yyyy.mm.dd - 2008.10.02&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;103&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- dd/mm/yyyy&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;104&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- dd.mm.yyyy&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;105&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- dd-mm-yyyy&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;106&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- dd mon yyyy&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;107&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- mon dd, yyyy&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;108&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- hh:mm:ss&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;109&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- mon dd yyyy hh:mm:ss:mmmAM (or PM)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- Oct&amp;nbsp; 2 2008 11:02:44:013AM&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;110&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- mm-dd-yyyy&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;111&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- yyyy/mm/dd&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;112&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- yyyymmdd&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;113&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- dd mon yyyy hh:mm:ss:mmm&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 02 Oct 2008 11:02:07:577&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;114&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- hh:mm:ss:mmm(24h)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;120&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- yyyy-mm-dd hh:mm:ss(24h)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;121&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- yyyy-mm-dd hh:mm:ss.mmm&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;126&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- yyyy-mm-ddThh:mm:ss.mmm&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 2008-10-02T10:52:47.513&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL create different date styles with t-sql string functions&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;replace&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;111&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-/-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;- -&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- yyyy mm dd&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;126&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- yyyy-mm&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;right(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;106&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;8&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- mon yyyy&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server date formatting function - convert datetime to string&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL datetime functions&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server date formats&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- T-SQL convert dates&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Formatting dates sql server&lt;/div&gt;
&lt;div style=&quot;margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;FUNCTION&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;dbo&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;fnFormatDate&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Calibri; font-size: 11pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;@Datetime&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;DATETIME&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;@FormatMask&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;32&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;RETURNS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;32&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
AS&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
BEGIN&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@StringDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;32&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@StringDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@FormatMask&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;IF&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CHARINDEX&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-YYYY-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@StringDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;REPLACE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-YYYY-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATENAME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;YY&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;IF&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CHARINDEX&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-YY-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@StringDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;REPLACE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-YY-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;RIGHT(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATENAME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;YY&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;IF&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CHARINDEX&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-Month-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@StringDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;REPLACE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-Month-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATENAME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;IF&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CHARINDEX&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-MON-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;COLLATE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;SQL_Latin1_General_CP1_CS_AS&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@StringDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;REPLACE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-MON-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;LEFT(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;UPPER&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATENAME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;IF&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CHARINDEX&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-Mon-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@StringDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;REPLACE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-Mon-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;LEFT(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATENAME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;IF&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CHARINDEX&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-MM-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@StringDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;REPLACE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-MM-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;RIGHT(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-0-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEPART&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;IF&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CHARINDEX&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-M-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@StringDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;REPLACE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-M-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEPART&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;IF&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CHARINDEX&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-DD-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@StringDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;REPLACE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-DD-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;RIGHT(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-0-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATENAME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;DD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;IF&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CHARINDEX&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-D-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@StringDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;REPLACE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StringDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-D-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATENAME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;DD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;RETURN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@StringDate&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
END&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Microsoft SQL Server date format function test&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- MSSQL formatting dates&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fnFormatDate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-MM/DD/YYYY-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 01/03/2012&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fnFormatDate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-DD/MM/YYYY-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 03/01/2012&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fnFormatDate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-M/DD/YYYY-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 1/03/2012&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fnFormatDate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-M/D/YYYY-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 1/3/2012&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fnFormatDate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-M/D/YY-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 1/3/12&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fnFormatDate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-MM/DD/YY-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 01/03/12&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fnFormatDate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-MON DD, YYYY-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- JAN 03, 2012&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fnFormatDate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-Mon DD, YYYY-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- Jan 03, 2012&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fnFormatDate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-Month DD, YYYY-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- January 03, 2012&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fnFormatDate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-YYYY/MM/DD-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 2012/01/03&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fnFormatDate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-YYYYMMDD-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 20120103&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fnFormatDate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-YYYY-MM-DD-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 2012-01-03&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- CURRENT_TIMESTAMP returns current system date and time in standard internal format&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fnFormatDate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-YY.MM.DD-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 12.01.03&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: Calibri; font-size: 11pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/***** SELECTED SQL DATE/DATETIME FORMATS WITH NAMES *****/&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL format datetime&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Default format: Oct 23 2006 10:40AM&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;[Default]&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- US-Style format: 10/23/2006&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;[US-Style]&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;101&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- ANSI format: 2006.10.23&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;[ANSI]&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CURRENT_TIMESTAMP,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;102&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- UK-Style format: 23/10/2006&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;[UK-Style]&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;103&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- German format: 23.10.2006&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;[German]&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;104&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- ISO format: 20061023&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;ISO&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;112&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- ISO8601 format: 2008-10-23T19:20:16.003&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;[ISO8601]&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;126&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: Calibri; font-size: 11pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server datetime formats&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Century date format MM/DD/YYYY usage in a query&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Format dates SQL Server 2005&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;TOP&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SalesOrderID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;OrderDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;101&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderDateTime&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;OrderDate&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;AdventureWorks&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Sales&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;SalesOrderHeader&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Result&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
SalesOrderID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderDate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderDateTime&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
43697&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 07/01/2001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2001-07-01 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*/&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: Calibri; font-size: 11pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL update datetime column&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL datetime DATEADD&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;UPDATE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Production&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Product&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;ModifiedDate&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;dd&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;ModifiedDate&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;ProductID&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;1001&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: Calibri; font-size: 11pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- MM/DD/YY date format&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Datetime format sql&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;TOP&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SalesOrderID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;OrderDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderDateTime&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;OrderDate&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;AdventureWorks&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Sales&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;SalesOrderHeader&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ORDER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;SalesOrderID&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;desc&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Result&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
SalesOrderID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderDate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderDateTime&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
75123&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 07/31/04&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2004-07-31 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*/&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: Calibri; font-size: 11pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Combining different style formats for date &amp;amp; time&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Datetime formats&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Datetime formats sql&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Date&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DATETIME&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Date&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-2015-12-22 03:51 PM-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;CHAR&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@Date&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;110&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;SUBSTRING&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@Date&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;12&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Result: 12-22-2015&amp;nbsp; 3:51PM&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: Calibri; font-size: 11pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Microsoft SQL Server cast datetime to string&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;stringDateTime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Result: Dec 29 2012&amp;nbsp; 3:47AM&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server date and time functions overview&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server CURRENT_TIMESTAMP function&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server datetime functions&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- local NYC - EST - Eastern Standard Time zone&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL DATEADD function - SQL DATEDIFF function&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 2012-01-05 07:02:10.577&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server DATEADD function&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;month&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-2012-12-09-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 2013-02-09 00:00:00.000&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server DATEDIFF function&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;day&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-2012-12-09-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-2013-02-09-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 62&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server DATENAME function&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATENAME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;month&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-2012-12-09-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- December&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATENAME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;weekday&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-2012-12-09-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- Sunday&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server DATEPART function&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEPART&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;month&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-2012-12-09-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 12&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server DAY function&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DAY&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-2012-12-09-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 9&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server GETDATE function&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- local NYC - EST - Eastern Standard Time zone&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 2012-01-05 07:02:10.577&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server GETUTCDATE function&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- London - Greenwich Mean Time&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;GETUTCDATE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 2012-01-05 12:02:10.577&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server MONTH function&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;MONTH&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-2012-12-09-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 12&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server YEAR function&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;YEAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-2012-12-09-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;- 2012&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: Calibri; font-size: 11pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: Calibri; font-size: 11pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- T-SQL Date and time function application&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- CURRENT_TIMESTAMP and getdate() are the same in T-SQL&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL first day of the month&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL first date of the month&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL first day of current month - 2012-01-01 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;dd&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL last day of the month&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL last date of the month&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL last day of current month - 2012-01-31 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;dd&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL first day of last month&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL first day of previous month - 2011-12-01 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL last day of last month&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL last day of previous month - 2011-12-31 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;dd&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;()))+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL first day of next month - 2012-02-01 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL last day of next month - 2012-02-28 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;dd&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;()))+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL first day of a month - 2012-10-01 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Date&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Date&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-2012-10-23-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;dd&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@Date&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL last day of a month - 2012-03-31 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Date&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Date&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-2012-03-15-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;dd&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;mm&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@Date&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL first day of year&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL first day of the year&amp;nbsp; -&amp;nbsp; 2012-01-01 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;yy&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;yy&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL last day of year&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL last day of the year&amp;nbsp;&amp;nbsp; - 2012-12-31 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;yy&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;dd&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;yy&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;yy&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL last day of last year&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL last day of previous year&amp;nbsp;&amp;nbsp; - 2011-12-31 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;dd&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;yy&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;yy&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL calculate age in years, months, days&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL table-valued function&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL user-defined function - UDF&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server age calculation - date difference&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Format dates SQL Server 2008&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;USE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;AdventureWorks2008&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FUNCTION&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;fnAge&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@BirthDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DATETIME&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;RETURNS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Age&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Years&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Months&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Days&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
AS&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BEGIN&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; @EndDate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DATETIME&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Anniversary&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DATETIME&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@EndDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;Getdate&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;()&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Anniversary&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;Dateadd&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;yy&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;Datediff&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;yy&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@BirthDate&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@EndDate&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@BirthDate&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INSERT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Age&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;Datediff&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;yy&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@BirthDate&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@EndDate&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Anniversary&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@EndDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: navy; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Calibri; font-size: 11pt;&quot;&gt;0, 0&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;UPDATE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Age&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Months&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;Month&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@EndDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Anniversary&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;UPDATE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Age&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Days&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;Day&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@EndDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Anniversary&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;RETURN&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Test table-valued UDF&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp; fnAge&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-1956-10-23-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp; dbo&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fnAge&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-1956-10-23-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Results&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Years&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Months&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Days&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
52&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*/&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: Calibri; font-size: 11pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL date range between&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL between dates&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;USE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;AdventureWorks&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL between&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;POs&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;COUNT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(*)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Purchasing&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;PurchaseOrderHeader&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;OrderDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;BETWEEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-20040301-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-20040315-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Result: 108&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- BETWEEN operator is equivalent to &amp;gt;=-AND-.&amp;lt;=&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;POs&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;COUNT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(*)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Purchasing&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;PurchaseOrderHeader&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;OrderDate&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: navy;&quot;&gt;BETWEEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-2004-03-01 00:00:00.000-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-2004-03-15&amp;nbsp; 00:00:00.000-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/*&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Orders with OrderDates&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
-2004-03-15&amp;nbsp; 00:00:01.000-&amp;nbsp; - 1 second after midnight (12:00AM)&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
-2004-03-15&amp;nbsp; 00:01:00.000-&amp;nbsp; - 1 minute after midnight&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
-2004-03-15&amp;nbsp; 01:00:00.000-&amp;nbsp; - 1 hour after midnight&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
are not included in the two queries above.&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*/&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- To include the entire day of 2004-03-15 use the following two solutions&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;POs&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;COUNT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(*)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Purchasing&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;PurchaseOrderHeader&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;OrderDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-20040301-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;OrderDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-20040316-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: red; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL between with DATE type (SQL Server 2008)&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;POs&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;COUNT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(*)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Purchasing&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;PurchaseOrderHeader&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DATE&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;OrderDate&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;BETWEEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-20040301-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-20040315-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Non-standard format conversion: 2011 December 14&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL datetime to string&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;[YYYY Month DD]&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;YEAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;())&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;- -&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: magenta;&quot;&gt;DATENAME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MM&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;())&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;- -&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DAY&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;())&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Converting datetime to YYYYMMDDHHMMSS format: 20121214172638&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;replace&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;111&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-/-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: magenta;&quot;&gt;replace&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;108&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-:-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Datetime custom format conversion to YYYY_MM_DD&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;CurrentDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;rtrim&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;year&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;()))&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-_-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: grey;&quot;&gt;right(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-0-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;rtrim&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;month&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;())),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-_-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: grey;&quot;&gt;right(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-0-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;rtrim&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;day&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;())),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Converting seconds to HH:MM:SS format&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;declare&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Seconds&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Seconds&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;10000&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;TimeSpan&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=right(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-0-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;rtrim&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@Seconds&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;3600&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-:-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: grey;&quot;&gt;right(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-0-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;rtrim&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;((&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@Seconds&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;3600&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;60&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-:-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: grey;&quot;&gt;right(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-0-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;rtrim&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@Seconds&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;60&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Result: 02:46:40&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Test result&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;2&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;3600&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;46&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;60&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;40&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Result: 10000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Set the time portion of a datetime value to 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL strip time from date&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL strip time from datetime&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;dd&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;dd&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Results: 2014-01-23 05:35:52.793 2014-01-23 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/*******&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
VALID DATE RANGES FOR DATE/DATETIME DATA TYPES&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
SMALLDATETIME date range:&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
January 1, 1900 through June 6, 2079&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
DATETIME date range:&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
January 1, 1753 through December 31, 9999&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
DATETIME2 date range (SQL Server 2008):&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
January 1,1 AD through December 31, 9999 AD&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
DATE date range (SQL Server 2008):&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
January 1, 1 AD through December 31, 9999 AD&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*******/&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Selecting with CONVERT into different styles&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Note: Only Japan &amp;amp; ISO styles can be used in ORDER BY&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;TOP&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Italy &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;OrderDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;105&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;USA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;OrderDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;110&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Japan&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;OrderDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;111&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;ISO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;OrderDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;112&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;AdventureWorks&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Purchasing&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;PurchaseOrderHeader&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ORDER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;PurchaseOrderID&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DESC&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Results&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Italy&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; USA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Japan&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ISO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
25-07-2004&amp;nbsp; 07-25-2004&amp;nbsp; 2004/07/25&amp;nbsp; 20040725&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*/&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server convert date to integer&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Datetime&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;datetime&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Datetime&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-2012-10-23 10:21:05.345-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;DateAsInteger&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@Datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;112&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Result: 20121023&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server convert integer to datetime&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@intDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@intDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;20120315&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;IntegerToDatetime&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@intDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Result: 2012-03-15 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server CONVERT script applying table INSERT/UPDATE&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server convert date&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Datetime column is converted into date only string column&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;USE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;tempdb&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;sqlConvertDateTime&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DatetimeCol&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DateCol&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;INSERT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;sqlConvertDateTime&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;DatetimeCol&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;()&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;UPDATE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;sqlConvertDateTime&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;DateCol&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;DatetimeCol&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;112&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;sqlConvertDateTime&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server convert datetime&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- The string date column is converted into datetime column&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;UPDATE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;sqlConvertDateTime&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;DatetimeCol&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;DateCol&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;112&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;sqlConvertDateTime&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Adding a day to the converted datetime column with DATEADD&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;UPDATE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;sqlConvertDateTime&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;DatetimeCol&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;day&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;DateCol&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;112&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;sqlConvertDateTime&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Equivalent formulation&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server cast datetime&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;UPDATE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;sqlConvertDateTime&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;DatetimeCol&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;dd&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;DateCol&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;sqlConvertDateTime&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;DROP&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;sqlConvertDateTime&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* First results&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
DatetimeCol&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DateCol&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
2014-12-25 16:04:15.373 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20141225 */&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Second results:&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
DatetimeCol&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DateCol&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
2014-12-25 00:00:00.000 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20141225&amp;nbsp; */&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Third results:&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
DatetimeCol&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DateCol&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
2014-12-26 00:00:00.000 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20141225&amp;nbsp; */&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL month sequence - SQL date sequence generation with table variable&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server cast string to datetime - SQL Server cast datetime to string&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server insert default values method&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Sequence&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;table&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Sequence&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;identity&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@i&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@i&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@StartDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;datetime&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@StartDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;year&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;()))+&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;RIGHT(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-0-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;month&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;())),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-01-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DATETIME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;WHILE&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@i&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;120&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
BEGIN&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INSERT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Sequence&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DEFAULT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VALUES&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@i&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@i&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
END&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;MonthSequence&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;month&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Sequence&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@StartDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@Sequence&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Partial results:&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
MonthSequence&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Jan&amp;nbsp; 1 2012 12:00AM&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Feb&amp;nbsp; 1 2012 12:00AM&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Mar&amp;nbsp; 1 2012 12:00AM&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Apr&amp;nbsp; 1 2012 12:00AM&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*/&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: Calibri; font-size: 11pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server Server datetime internal storage&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server datetime formats&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server datetime to hex&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Now&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;HexNow&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CURRENT_TIMESTAMP&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BINARY&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Results&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Now&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HexNow&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
2009-01-02 17:35:59.297 0x00009B850122092D&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*/&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server date part - left 4 bytes - Days since 1900-01-01&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Now&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DAY&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0x00009B85&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-19000101-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Result: 2009-01-02 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL time part - right 4 bytes - milliseconds since midnight&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- 1000/300 is an adjustment factor&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL dateadd to Midnight&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Now&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MS&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1000.0&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;300&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BIGINT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0x0122092D&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-2009-01-02-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Result: 2009-01-02 17:35:59.290&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- String date and datetime date&amp;amp;time columns usage&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server datetime formats in tables&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;USE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;tempdb&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;NOCOUNT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ON&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server select into table create&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;TOP&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FullName&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;nvarchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;50&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;FirstName&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;- -&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;LastName&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BirthDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;BirthDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;112&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ModifiedDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;()&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;INTO&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Employee&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;AdventureWorks&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;HumanResources&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Employee e&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: grey;&quot;&gt;INNER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;JOIN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;AdventureWorks&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Person&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Contact c&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt 0pt 0pt 0.375in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ON&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;c&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;ContactID&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;e&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;ContactID&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ORDER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;EmployeeID&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server alter table&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ALTER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Employee&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ALTER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;COLUMN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;FullName&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;nvarchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;50&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;NOT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ALTER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Employee&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt 0pt 0pt 0.75in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ADD&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;CONSTRAINT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;[PK_Employee]&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;PRIMARY&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;KEY&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;FullName&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Results&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Table definition for the Employee table&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Note: BirthDate is string date (only)&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
CREATE TABLE dbo.Employee(&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FullName nvarchar(50) NOT NULL PRIMARY KEY,&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BirthDate char(8) NULL,&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ModifiedDate datetime NOT NULL&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*/&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Employee&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ORDER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;FullName&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Results&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
FullName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BirthDate&amp;nbsp;&amp;nbsp; ModifiedDate&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Guy Gilbert&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 19720515&amp;nbsp;&amp;nbsp;&amp;nbsp; 2009-01-03 10:10:19.217&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Kevin Brown&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 19770603&amp;nbsp;&amp;nbsp;&amp;nbsp; 2009-01-03 10:10:19.217&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Rob Walters&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 19650123&amp;nbsp;&amp;nbsp;&amp;nbsp; 2009-01-03 10:10:19.217&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Roberto Tamburello&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 19641213&amp;nbsp;&amp;nbsp;&amp;nbsp; 2009-01-03 10:10:19.217&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Thierry D-Hers&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 19490829&amp;nbsp;&amp;nbsp;&amp;nbsp; 2009-01-03 10:10:19.217&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*/&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server age&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;FullName&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Age&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;YEAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;BirthDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;()),&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RowMaintenanceDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;ModifiedDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Employee&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ORDER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;FullName&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Results&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
FullName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Age&amp;nbsp;&amp;nbsp; RowMaintenanceDate&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Guy Gilbert&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 37&amp;nbsp;&amp;nbsp;&amp;nbsp; Jan&amp;nbsp; 3 2009 10:10AM&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Kevin Brown&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 32&amp;nbsp;&amp;nbsp;&amp;nbsp; Jan&amp;nbsp; 3 2009 10:10AM&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Rob Walters&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 44&amp;nbsp;&amp;nbsp;&amp;nbsp; Jan&amp;nbsp; 3 2009 10:10AM&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Roberto Tamburello&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 45&amp;nbsp;&amp;nbsp;&amp;nbsp; Jan&amp;nbsp; 3 2009 10:10AM&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Thierry D-Hers&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 60&amp;nbsp;&amp;nbsp;&amp;nbsp; Jan&amp;nbsp; 3 2009 10:10AM&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*/&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server age of Rob Walters on specific dates&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server string to datetime implicit conversion with DATEADD&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;AGE50DATE&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;YY&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;50&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-19650123-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Result: 2015-01-23 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server datetime to string, Italian format for ModifiedDate&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server string to datetime implicit conversion with DATEDIFF&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;FullName&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; AgeDEC31&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;YEAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;BirthDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-20141231-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; AgeJAN01&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;YEAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;BirthDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-20150101-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; AgeJAN23&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;YEAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;BirthDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-20150123-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; AgeJAN24&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;YEAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;BirthDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-20150124-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ModDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;ModifiedDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;105&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Employee&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;FullName&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-Rob Walters-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ORDER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;FullName&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Results&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Important Note: age increments on Jan 1 (not as commonly calculated)&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
FullName&amp;nbsp;&amp;nbsp;&amp;nbsp; AgeDEC31&amp;nbsp;&amp;nbsp;&amp;nbsp; AgeJAN01&amp;nbsp;&amp;nbsp;&amp;nbsp; AgeJAN23&amp;nbsp;&amp;nbsp;&amp;nbsp; AgeJAN24&amp;nbsp;&amp;nbsp;&amp;nbsp; ModDate&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Rob Walters 49&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 03-01-2009&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*/&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: Calibri; font-size: 11pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL combine integer date &amp;amp; time into datetime&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Datetime format sql&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL stuff&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@DateTimeAsINT&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;TABLE&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;ID&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;identity&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;primary&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;key&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp; DateAsINT&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp; TimeAsINT&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: green;&quot;&gt;- NOTE: leading zeroes in time is for readability only!&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;INSERT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@DateTimeAsINT&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;DateAsINT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;TimeAsINT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VALUES&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;20121023&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;235959&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;INSERT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@DateTimeAsINT&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;DateAsINT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;TimeAsINT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VALUES&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;20121023&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;010204&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;INSERT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@DateTimeAsINT&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;DateAsINT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;TimeAsINT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VALUES&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;20121023&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;002350&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;INSERT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@DateTimeAsINT&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;DateAsINT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;TimeAsINT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VALUES&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;20121023&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;000244&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;INSERT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@DateTimeAsINT&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;DateAsINT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;TimeAsINT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VALUES&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;20121023&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;000050&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;INSERT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@DateTimeAsINT&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;DateAsINT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;TimeAsINT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VALUES&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;20121023&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;000006&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;DateAsINT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;TimeAsINT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;datetime&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;DateAsINT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;- -&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;+&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;STUFF&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;STUFF&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;RIGHT(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;REPLICATE&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-0-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;6&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;TimeAsINT&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;6&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;),&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-:-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;6&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;0&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-:-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;))&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;DateTimeValue&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp; @DateTimeAsINT&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ORDER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;ID&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Results&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
DateAsINT&amp;nbsp;&amp;nbsp; TimeAsINT&amp;nbsp;&amp;nbsp; DateTimeValue&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
20121023&amp;nbsp;&amp;nbsp;&amp;nbsp; 235959&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2012-10-23 23:59:59.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
20121023&amp;nbsp;&amp;nbsp;&amp;nbsp; 10204 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2012-10-23 01:02:04.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
20121023&amp;nbsp;&amp;nbsp;&amp;nbsp; 2350&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2012-10-23 00:23:50.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
20121023&amp;nbsp;&amp;nbsp;&amp;nbsp; 244&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2012-10-23 00:02:44.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
20121023&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2012-10-23 00:00:50.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
20121023&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2012-10-23 00:00:06.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*/&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: Calibri; font-size: 11pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server string to datetime, implicit conversion with assignment&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;UPDATE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Employee&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;ModifiedDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-20150123-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;FullName&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-Rob Walters-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;ModifiedDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Employee&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;FullName&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-Rob Walters-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Result: 2015-01-23 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* SQL string date, assemble string date from datetime parts&amp;nbsp; */&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server cast string to datetime - sql convert string date&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server number to varchar conversion&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server leading zeroes for month and day&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Server right string function&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;UPDATE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Employee&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;BirthDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;YEAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-1965-01-23-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DATETIME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)))+&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;RIGHT(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-0-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;MONTH&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-1965-01-23-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DATETIME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)+&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;RIGHT(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-0-&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DAY&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-1965-01-23-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DATETIME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;FullName&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-Rob Walters-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;BirthDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Employee&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;FullName&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-Rob Walters-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Result: 19650123&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Perform cleanup action&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;DROP&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Employee&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL nocount&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;NOCOUNT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;OFF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- sql isdate function&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;USE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;tempdb&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- sql newid - random sort&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;top&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;SalesOrderID&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;stringOrderDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;OrderDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;INTO&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;DateValidation&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;AdventureWorks&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Sales&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;SalesOrderHeader&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ORDER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;NEWID&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;()&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;DateValidation&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Results&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
SalesOrderID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; stringOrderDate&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
56720&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Oct 26 2003 12:00AM&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
73737&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Jun 25 2004 12:00AM&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
70573&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; May 14 2004 12:00AM&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*/&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL update with top&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;UPDATE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;TOP&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;DateValidation&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;stringOrderDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-Apb 29 2004 12:00AM-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL string to datetime fails without validation&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;SalesOrderID&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;OrderDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;stringOrderDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;datetime&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;DateValidation&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Msg 242, Level 16, State 3, Line 1&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
The conversion of a varchar data type to a datetime data type resulted in an&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
out-of-range value.&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*/&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- sql isdate - filter for valid dates&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;SalesOrderID&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;OrderDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;stringOrderDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;datetime&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;DateValidation&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;ISDATE&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;stringOrderDate&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Results&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
SalesOrderID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderDate&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
73737&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2004-06-25 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
70573&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2004-05-14 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*/&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL drop table&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;DROP&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;DateValidation&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
Go&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: Calibri; font-size: 11pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SELECT between two specified dates - assumption TIME part is 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL datetime between&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL select between two dates&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;EmployeeID&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;RateChangeDate&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;AdventureWorks&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;HumanResources&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;EmployeePayHistory&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;RateChangeDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-1997-11-01-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RateChangeDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;dd&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-1998-01-05-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Results&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
EmployeeID&amp;nbsp; RateChangeDate&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1997-12-12 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1998-01-05 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*/&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
/* Equivalent to&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL datetime range&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
SELECT EmployeeID, RateChangeDate&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
FROM AdventureWorks.HumanResources.EmployeePayHistory&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
WHERE RateChangeDate &amp;gt;= -1997-11-01 00:00:00- AND&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RateChangeDate &amp;lt;&amp;nbsp; -1998-01-06 00:00:00-&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
*/&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL datetime language setting&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL Nondeterministic function usage - result varies with language settings&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;LANGUAGE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-us_english-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; -- Jan 12 2015 12&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;00AM&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;US&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DATETIME&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-01/12/2015-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;LANGUAGE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-British-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dec&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; 1 2015 12&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;00AM&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;UK&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DATETIME&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-01/12/2015-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;LANGUAGE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-German-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Dez&amp;nbsp; 1 2015 12&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;00AM&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;LANGUAGE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-Deutsch-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Dez&amp;nbsp; 1 2015 12&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;00AM&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Germany&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DATETIME&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-01/12/2015-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;LANGUAGE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-French-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- d�c&amp;nbsp; 1 2015 12&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;00AM&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;France&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DATETIME&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-01/12/2015-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;LANGUAGE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-Spanish-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- Dic&amp;nbsp; 1 2015 12&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;00AM&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Spain&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DATETIME&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-01/12/2015-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;LANGUAGE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-Hungarian-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp; -- jan 12 2015 12&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;00AM&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;Hungary&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DATETIME&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-01/12/2015-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;LANGUAGE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-us_english-&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Function for Monday dates calculation&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;USE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;AdventureWorks2008&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL user-defined function&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- SQL scalar function - UDF&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FUNCTION&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;fnMondayDate&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@Year&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Month&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @MondayOrdinal&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;RETURNS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DATETIME&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
AS&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BEGIN&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; @FirstDayOfMonth&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;CHAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @SeedDate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;CHAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@FirstDayOfMonth&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@Year&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;---&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@Month&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;--01-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;@SeedDate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;-1900-01-01-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;RETURN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;DD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEDIFF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;DD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@SeedDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;DD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;@MondayOrdinal&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;7&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @FirstDayOfMonth&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;7&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;7&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; @SeedDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
GO&lt;/div&gt;
&lt;div style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Test Datetime UDF&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- Third Monday in Feb, 2015&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fnMondayDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;2016&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- 2015-02-16 00:00:00.000&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- First Monday of current month&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fnMondayDate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;Year&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;()),&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;Month&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;()),&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
- 2009-02-02 00:00:00.000&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; margin: 0pt;&quot;&gt;
----&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/1730555288413161859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2014/05/how-to-format-datetime-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/1730555288413161859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/1730555288413161859'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2014/05/how-to-format-datetime-sql-server.html' title='How to Format Date/Time - SQL Server'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-8249320983706839801</id><published>2014-04-15T09:22:00.001+03:00</published><updated>2014-04-15T09:22:48.362+03:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><title type='text'>How To: Fixing DNS problems</title><content type='html'>By &lt;a class=&quot;author spaceR5 crLink&quot; href=&quot;http://www.tomshardware.com/contact.html&quot; itemprop=&quot;author&quot; rel=&quot;author&quot;&gt;TG Publishing Team&lt;/a&gt;&lt;span class=&quot;date upper cInfos&quot;&gt;&lt;time datetime=&quot;2003-01-13&quot; itemprop=&quot;datePublished&quot;&gt;January 13, 2003 10:00 AM&lt;/time&gt;&lt;/span&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;The inability to open a website by name
usually indicates a &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;DNS (Domain Name System)
problem&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;. DNS is the service that converts the
website URL, i.e. www.yahoo.com into the IP address that is needed for actual
communication.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;A quick way to test this is to try to
access the problem website via its &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;IP
address&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; instead of its name. You can find a website’s
IP address by opening a Windows &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;MS-DOS&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
or &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Command&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
prompt and typing &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;ping&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;,
followed by the website domain you are trying to reach (don’t type the www,
though). Here’s an example using &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;google.com&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;C&amp;nbsp;:\Windows&amp;gt;ping
google.com&lt;/span&gt;&lt;/i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Pinging
google.com [216.239.51.100] with 32 Bytes of data&amp;nbsp;:&lt;/span&gt;&lt;/i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Reply
from 216.239.51.100&amp;nbsp;: Bytes=32 time=267ms TTL=242 &lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Reply from 216.239.51.100&amp;nbsp;: Bytes=32
time=261ms TTL=242 &lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Reply from 216.239.51.100&amp;nbsp;: Bytes=32
time=256ms TTL=242 &lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Reply from 216.239.51.100&amp;nbsp;: Bytes=32
time=252ms TTL=242&lt;/span&gt;&lt;/i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Ping
statistics for 216.239.51.100&amp;nbsp;: &lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Packets&amp;nbsp;: Sent = 4, Received = 4, Lost
= 0 (0% loss), &lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Approximate round trip times in
milli-seconds&amp;nbsp;: &lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Minimum = 252ms, Maximum = 267ms, Average =
259ms&lt;/span&gt;&lt;/i&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;You can see that &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;216.239.51.100&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; is google.com’s IP
address, so now enter &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;http://216.239.51.100/&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
into your web browser’s address or location box. If the website comes up,
you’ve got a DNS problem.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 5;&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 12pt; mso-ansi-language: EN; mso-bidi-font-size: 10.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Fixing DNS&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;The most common cause of the behavior
described above is incorrect DNS settings in your computer’s TCP/IP properties.
This typically happens after installing a &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;hardwarerouter&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; or &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Internet Sharing software&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
like Windows’ Internet Connection Sharing feature. If your computer had its &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;TCP/IP properties set manually&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
(statically), you’re likely to have DNS-related problems.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;The reason for the problem is that sharing
devices (and programs) usually like to handle DNS duties as part of their
sharing functions, and need to have computers that are connected to them set up
to get their DNS services from the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;router&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
(or sharing program) &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;instead&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
of your ISP. Even though most people follow the router setup instructions and
change their network adapter TCP/IP settings to &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&quot;Obtain an IP address automatically&quot;&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;,
they commonly may neglect to &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;clear
out the DNS settings&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;, which in Win98 are located on the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;DNS Configuration&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
tab of the Network Properties window. WinXP makes it harder to forget to clear
any manual DNS settings that you may have, since it puts IP address, default
gateway, and DNS settings in the same window.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Fixing the problem is easy. Here’s how for &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Win95 and 98&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;1)&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
Right click on the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Network Neighborhood&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
icon on your desktop and choose &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Properties&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;.
A window similar to &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Figure 1&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
will open.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Figure
1&amp;nbsp;: Win98SE TCP/IP properties&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;2)&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
Scroll down the window in the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Configuration&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; tab
until you find the copy of TCP/IP that is bound (indicated by &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;)
to the network adapter that you are using to connect to your network. You
should be able to recognize the correct adapter, since it will usually have
some sort of manufacturer’s name in it. Click on the adapter to select, then
click the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Properties&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
button. Another window similar to &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Figure
2&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; will appear.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;3)&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
The IP Address tab will probably have the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Obtain an IP address automatically&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
radio button selected. Click on the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;DNS
Configuration&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; tab.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Figure
2&amp;nbsp;: Win98SE DNS properties&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;4)
Figure 2&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; shows that the old DNS settings (your will
probably be different from the screenshot) are still in charge. Fix this by
deleting all entries in the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;DNS
Server Search Order&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; box. Then click the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Disable DNS&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
button. While you’re at it, click on the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Gateway&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; tab, and make sure there are no entries
there. Click the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;OK&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
button to close the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;TCP/IP properties&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
window, then click the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;OK&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
button to close the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Networkproperties&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
window. Restart your system when prompted.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;5)&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
After the system restarts, it’s possible that your computer may still have old
IP address information that can result in the same behavior as before. To force
the system to get new IP address information click &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Start &amp;gt; Run&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; and type &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;winipcfg&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;.
Click the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;More Info&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; button.
Select your network adapter, click the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Release&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; button, wait until the information in the
window is cleared, then click the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Renew&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
button. After a short delay you should see new information in the window. (This
is called a DHCP Release / Renew.)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;6)&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
Now open your web browser and try your problem sites. The problem should be
fixed. If it isn’t, see the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;a href=&quot;http://www.tomsguide.com/us/how-to-dns-fix,review-113.html#whatelse&quot;&gt;&lt;span style=&quot;color: #004488; text-decoration: none; text-underline: none;&quot;&gt;What Else can be
wrong&amp;nbsp;?&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; section below.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Here’s the fix for &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;WinXP&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;1)&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
Open the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Network Connections&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
Control Panel. Double click on the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Local
Area Connection&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; icon in the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;LAN or High-Speed Internet&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
section of the Network Connections window that opens. Click on the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Properties&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
button of the Local Area Connection Status window that opens. You should see
another window similar to &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Figure
3&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; open.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Figure
3&amp;nbsp;: WinXP Local Area Connection properties&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;2)&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
Click on the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Internet Protocol
(TCP/IP)&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; item to select it and click the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Properties&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
button. A new window similar to &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Figure
4&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; should open.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Figure
4&amp;nbsp;: WinXP TCP/IP properties&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;3)&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
All you need to do is click the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Obtain
DNS server address automatically&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; button (the static DNS server information
will automatically be cleared). Click OK in each of the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;TCP/IP&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
and &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Local Area Connection&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
properties windows to close them.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;4)&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
Once again, we want to be sure that we now have new IP address information. You
should still have the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Local
Area Connection Status&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; window open. Click the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Support&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
tab, then click the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Repair&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; button.
After a short delay, you should get a repair completed popup and IP address
information should reappear in the window. You’ll need to click the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Details...&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
button to see the DNS server information.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;5)&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
Now open your web browser and try your problem sites. The problem should be
fixed. If it isn’t, see the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;What
Else can be wrong&amp;nbsp;?&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; section below.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;What Else can be wrong&amp;nbsp;?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;If only all problems were so
straightforward&amp;nbsp;! But, unfortunately, bogus DNS settings in your computers
aren’t always the problem. Here are some other possible causes and actions to
take if you’re having problems accessing certain websites&amp;nbsp;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;ISP
DNS problems &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;If things &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;were&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
working correctly with your &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;exact
same network setup&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;, and then mysteriously stopped working,
it’s possible that your ISP’s DNS servers are having problems. Contact your
ISP’s tech support to report the problem and ask them to fix it&amp;nbsp;!&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 5;&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 16pt; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Proxy
problems&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;This also tends to fall into the ISP
problem category. Some ISPs (AOL for example) make all their subscribers run
through a &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;proxy server&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;.
Proxies sit between you and the actual Internet and are used both to locally
store (cache) content that doesn’t change very often and, in some cases,
prevent access to certain websites and web services. Most of the time proxies
operate without your knowing they’re even there, but sometimes they get
confused and cause problems. &lt;br /&gt;
&lt;br /&gt;
You can see if you’re using a proxy by checking the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Internet Options&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
Control Panel, selecting the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Connections&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
tab, and clicking the &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;LAN
Settings...&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; button. If &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;any&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt; of the checkboxes are checked on the
window that opens, you’re probably using a proxy. You can try clearing the
checkboxes (write down the settings first or grab a screenshot), then quitting
and restarting your browser and see if that helps. But if your ISP &lt;/span&gt;&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;requires&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
use of a proxy and doesn’t allow you to bypass it, this won’t help. Again, your
option will be to contact your ISP’s support and tell them your problem.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 140%; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Content
filtering&lt;/span&gt;&lt;/b&gt;&lt;span lang=&quot;EN&quot; style=&quot;color: #070f14; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 140%; mso-ansi-language: EN; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;br /&gt;
Although more popular in work-settings, content or website filtering is also
available on a simpler basis for consumer router and Internet sharing
applications. This function allows particular domains or website pages to be
blocked to some, or all users. In many cases you won’t get an indication that
the web page you’re trying to reach is being blocked and the router will just
hang. &lt;br /&gt;
&lt;br /&gt;
Again, if you don’t control your Internet access, there’s not much you can do
about this one. A &lt;a href=&quot;http://webveil.com/proxies.html&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #004488; line-height: 140%; mso-bidi-font-size: 11.0pt; text-decoration: none; text-underline: none;&quot;&gt;web-browsing proxy service&lt;/span&gt;&lt;/b&gt;&lt;/a&gt; may get you
past any filters set up by Mom or Dad, but savvy network admins will probably
have those websites blocked too.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/8249320983706839801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2014/04/how-to-fixing-dns-problems.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/8249320983706839801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/8249320983706839801'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2014/04/how-to-fixing-dns-problems.html' title='How To: Fixing DNS problems'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-3045763115898066110</id><published>2014-04-12T15:30:00.003+03:00</published><updated>2014-04-12T15:30:44.860+03:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><title type='text'>A COMPARISON OF MICROSOFT&#39;S C# PROGRAMMING LANGUAGE TO SUN MICROSYSTEMS&#39; JAVA PROGRAMMING LANGUAGE</title><content type='html'>&lt;strong&gt;&amp;nbsp;By: &lt;/strong&gt;&lt;a href=&quot;http://www.25hoursaday.com/weblog&quot;&gt;&lt;strong&gt;Dare Obasanjo&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;
&lt;pre&gt; 
&lt;/pre&gt;
&lt;h3&gt;
Introduction&lt;/h3&gt;
The C# language is an object-oriented language that is aimed at enabling  programmers to quickly build a wide range of applications for the Microsoft .NET  platform. The goal of C# and the .NET platform is to shorten development time by  freeing the developer from worrying about several low level plumbing issues such  as memory management, type safety issues, building low level libraries, array  boundschecking , etc. thus allowing developers to actually spend their time and  energy working on their application and business logic instead. As a Java  developer the previous sentence could be described as &quot;a short description of  the Java language and platform&quot; if the words C# and the .NET platform were  replaced with words Java and the Java platform.&lt;br /&gt;
What follows is an overview of similarities and differences between the  language features and libraries of the C# and Java programming languages based  on my experience using both languages. All code snippets below were tested on &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&quot;&gt;Microsoft&#39;s  .NET Framework version 2.0&lt;/a&gt; for C# snippets and &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://java.sun.com/javase/6/&quot;&gt;Java™ Platform, Standard Edition version  6&lt;/a&gt; for the Java snippets.&lt;br /&gt;
&lt;b&gt;Quick Index&lt;/b&gt; &lt;br /&gt;
&lt;ol type=&quot;A&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#same&quot;&gt;The More   Things Change The More They Stay The Same&lt;/a&gt;&lt;br /&gt;This section describes   concepts and language features that are almost exactly the same in C# and   Java.    &lt;ol&gt;&lt;div id=&quot;urlss-20121207-301&quot; style=&quot;display: none;&quot;&gt;
&lt;strong&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.cheappensmontblancsale.com/&quot; title=&quot;mont blanc pens outlet&quot;&gt;mont blanc pens outlet&lt;/a&gt; &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.montblancpenau.net/&quot; title=&quot;mont blanc pens&quot;&gt;mont blanc pens&lt;/a&gt; &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.comprarauricularesventa.com/&quot; title=&quot;beats by dr dre baratos&quot;&gt;beats by dr dre baratos&lt;/a&gt; &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.meizitangbotanicalgeluk.com/&quot; title=&quot;botanical slimming&quot;&gt;botanical slimming&lt;/a&gt; &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.jackormonclersverige.org/&quot; title=&quot;moncler billigt&quot;&gt;moncler billigt&lt;/a&gt; &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.soldedoudounepascher.eu/&quot; title=&quot;moncler&quot;&gt;moncler&lt;/a&gt; &lt;/strong&gt;&lt;/div&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#object&quot;&gt;We Are All     Objects&lt;/a&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#keyword&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Keyword     Jumble&lt;/span&gt;&lt;/a&gt; &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/updated.gif&quot; /&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#vmclr&quot;&gt;Of Virtual     Machines and Language Runtimes&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#heap&quot;&gt;Heap Based     Classes and Garbage Collection&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#jagged&quot;&gt;Arrays Can     Be Jagged&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#noglobal&quot;&gt;No     Global Methods&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#interfaceMI&quot;&gt;Interfaces,     Yes. Multiple Inheritance, No.&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#strings&quot;&gt;Strings     Are Immutable&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#noextend&quot;&gt;Unextendable     Classes&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#exceptions&quot;&gt;Throwing and     Catching Exceptions&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#staticconstructor&quot;&gt;Member     Initialization at Definition and Static Constructors&lt;/a&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#boxing&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Boxing&lt;/span&gt;&lt;/a&gt; &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/new.gif&quot; /&gt; &lt;br /&gt;&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#samediff&quot;&gt;The Same   But Different&lt;/a&gt;&lt;br /&gt;This section describes concepts and language features   that differ either only in syntax or in some similarly minor manner between C#   and Java.    &lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#main&quot;&gt;Main     Method&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#inheritance&quot;&gt;Inheritance     Syntax&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#is&quot;&gt;Run Time Type     Identification (is operator)&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#namespace&quot;&gt;Namespaces&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#constructdestruct&quot;&gt;Constructors,     Destructors and Finalizers&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#synchronization&quot;&gt;Synchronizing     Methods and Code Blocks&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#access&quot;&gt;Access     Modifiers&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#reflection&quot;&gt;Reflection&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#constants&quot;&gt;Declaring     Constants&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#primitives&quot;&gt;Primitive     Types&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#arraydecl&quot;&gt;Array     Declarations&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#baseconstructor&quot;&gt;Calling     Base Class Constructors and Constructor Chaining&lt;/a&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#params&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Variable Length     Parameter Lists&lt;/span&gt;&lt;/a&gt; &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/new.gif&quot; /&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#generics&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Generics&lt;/span&gt;&lt;/a&gt;     &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/new.gif&quot; /&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#foreach&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;for-each     Loop&lt;/span&gt;&lt;/a&gt; &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/new.gif&quot; /&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#attributes&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Metadata     Annotations&lt;/span&gt;&lt;/a&gt; &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/new.gif&quot; /&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#enums&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Enumerations&lt;/span&gt;&lt;/a&gt;     &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/new.gif&quot; /&gt; &lt;br /&gt;&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#dejavu&quot;&gt;An Ever So   Slight Feeling of D¨¨j¨¤ Vu&lt;/a&gt;&lt;br /&gt;This section describes concepts and language   features that exist in C# that are similar to those that exist in Java but   with a significant difference.    &lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#nested&quot;&gt;Nested     classes&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#threads&quot;&gt;Threads     and Volatile Members&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#operatoroverloading&quot;&gt;Operator     Overloading&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#switch&quot;&gt;switch     Statement&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#assemblies&quot;&gt;Assemblies&lt;/a&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#collections&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Collections&lt;/span&gt;&lt;/a&gt;     &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/updated.gif&quot; /&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#goto&quot;&gt;goto (no     longer considered harmful)&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#virtualfinal&quot;&gt;Virtual     Methods (and final ones too)&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#fileio&quot;&gt;File     I/O&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#serialization&quot;&gt;Object     Serialization&lt;/a&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#docgen&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Documentation     Generation from Source Code Comments&lt;/span&gt;&lt;/a&gt; &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/updated.gif&quot; /&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#multipleclasses&quot;&gt;Multiple     Classes in a Single File&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#importing&quot;&gt;Importing     Libraries&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#events&quot;&gt;Events&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#interop&quot;&gt;Cross     Language Interoperability&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#different&quot;&gt;Now For   Something Completely Different&lt;/a&gt;&lt;br /&gt;This section describes language features   and concepts that exist in C# and have no Java counterpart.    &lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#idisposable&quot;&gt;Deterministic     Object Cleanup&lt;/a&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#delegates&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Delegates&lt;/span&gt;&lt;/a&gt;     &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/updated.gif&quot; /&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#structs&quot;&gt;Value     Types (Structs)&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#as&quot;&gt;Run Time Type     Identification (as operator)&lt;/a&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#properties&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Properties&lt;/span&gt;&lt;/a&gt;     &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/updated.gif&quot; /&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#multiarrays&quot;&gt;Multidimensional     Arrays&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#indexers&quot;&gt;Indexers&lt;/a&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#preprocessor&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Preprocessor     Directives&lt;/span&gt;&lt;/a&gt; &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/updated.gif&quot; /&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#aliases&quot;&gt;Aliases&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#reflectionemit&quot;&gt;Runtime     Code Generation&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#unsafe&quot;&gt;Pointers     and Unsafe Code&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#passbyref&quot;&gt;Pass by     Reference&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#verbatim&quot;&gt;Verbatim     Strings&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#overflow&quot;&gt;Overflow     Detection&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#explicitinterface&quot;&gt;Explicit     Interface Implementation&lt;/a&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#friends&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Friend     Assemblies&lt;/span&gt;&lt;/a&gt; &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/new.gif&quot; /&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#globalnamespace&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;The     Namespace Qualifier&lt;/span&gt;&lt;/a&gt; &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/new.gif&quot; /&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#iterators&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Iterators     (Continuations)&lt;/span&gt;&lt;/a&gt; &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/new.gif&quot; /&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#partial&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Partial     Types&lt;/span&gt;&lt;/a&gt; &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/new.gif&quot; /&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#staticclasses&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Static     Classes&lt;/span&gt;&lt;/a&gt; &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/new.gif&quot; /&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#nullable&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Nullable     Types&lt;/span&gt;&lt;/a&gt; &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/new.gif&quot; /&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#anonymousmethods&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Anonymous     Methods&lt;/span&gt;&lt;/a&gt; &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/new.gif&quot; /&gt; &lt;br /&gt;&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#wishlist&quot;&gt;Wish You   Were Here&lt;/a&gt;&lt;br /&gt;This section describes language features and concepts that   exist in Java and have no C# counterpart.    &lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#checked&quot;&gt;Checked     Exceptions&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#wora&quot;&gt;Cross     Platform Portability (Write Once, Run Anywhere)&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#extensions&quot;&gt;Extensions&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#strictfp&quot;&gt;strictfp&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#classloading&quot;&gt;Dynamic     Class Loading&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#interfacefields&quot;&gt;Interfaces     That Contain Fields&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#anoninnerclasses&quot;&gt;Anonymous     Inner Classes&lt;/a&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#staticimports&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Static     Imports&lt;/span&gt;&lt;/a&gt; &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/new.gif&quot; /&gt; &lt;br /&gt;&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#conclusion2k1&quot;&gt;Conclusion(2001)&lt;/a&gt;
&lt;li&gt;&lt;a class=&quot;new&quot; href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#conclusion2k7&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Conclusion   (2007)&lt;/span&gt;&lt;/a&gt; &lt;img src=&quot;http://www.25hoursaday.com/web/20130119011220im_/http://www.25hoursaday.com/new.gif&quot; /&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#resources&quot;&gt;Resources&lt;/a&gt; &lt;!-- Gunnerson, Eckel, Java Tutorial, .NET SDK docs --&gt;
&lt;li&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#acknowledgements&quot;&gt;Acknowledgements&lt;/a&gt;   &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;same&quot; name=&quot;same&quot;&gt;The More Things Change The More They Stay The  Same&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;object&quot; name=&quot;object&quot;&gt;We Are All Objects&lt;/a&gt;&lt;/h3&gt;
Just like Java, C# has a single rooted class hierarchy where all classes in   C# are subclasses of &lt;code&gt;System.Object&lt;/code&gt; the same way all Java classes   are subclasses of &lt;code&gt;java.lang.Object&lt;/code&gt;. The methods of the two   languages&#39; Object classes share some similarities (e.g.    &lt;code&gt;System.Object&#39;s&lt;/code&gt; ToString() to &lt;code&gt;java.lang.Object&#39;s&lt;/code&gt;   toString()) and differences (&lt;code&gt;System.Object&lt;/code&gt; does not have analogs   to wait(), notify() or notifyAll() in    &lt;code&gt;java.lang.Object&lt;/code&gt;).&lt;br /&gt;&lt;br /&gt;NOTE: In C#, the object class can   either be written as &lt;code&gt;object&lt;/code&gt; or Object. The lower case &quot;object&quot; is   a C# keyword which is replaced with the class name &quot;System.Object&quot; during   compilation.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;keyword&quot; name=&quot;keyword&quot;&gt;Keyword Jumble&lt;/a&gt;&lt;/h3&gt;
There are a large number of syntactic similarities between Java and C#,   similarly almost every Java keyword has a C# equivalent except for a few like   transient, throws and strictfp. Below is a table of Java and C# keywords with   the Java keywords in red while the equivalent C# keywords are in blue.&lt;br /&gt;
&lt;!-- false, where, extern, alias, yield, partial --&gt;   &lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; style=&quot;margin-left: 0.5in; width: 635px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# keyword&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java keyword&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# keyword&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java keyword&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# keyword&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java keyword&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C#&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;keyword&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;keyword&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;abstract&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;abstract&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;extern&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;native&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;operator&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;throw&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;throw&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;false&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;out&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;true&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;base&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;super&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;finally&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;finally&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;try&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;try&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;boolean&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;fixed&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;params&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span class=&quot;new&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;...&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;typeof&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;N/A&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;break&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;break&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;float&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;float&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span class=&quot;new&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;partial&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;uint&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;N/A&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;byte&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;for&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;for&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;private&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;ulong&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;N/A&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;case&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;case&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;foreach&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span class=&quot;new&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;for&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;unchecked&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;N/A&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;catch&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;catch&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;get&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;public&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;unsafe&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;char&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;goto&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;goto&lt;sup&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;readonly&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;ushort&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;N/A&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;checked&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;if&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;ref&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;import&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;class&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;implicit&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;return&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;value&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;N/A&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;const&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;const&lt;sup&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;in&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;sbyte&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;byte&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;virtual&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;N/A&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;continue&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;continue&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;int&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;sealed&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;final&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;void&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;decimal&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;interface&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;interface&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;set&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;N/A&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;volatile&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;volatile&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;default&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;default&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;internal&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;protected&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;short&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;short&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span class=&quot;new&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;where&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;extends&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;delegate&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;is&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;instanceof&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;sizeof&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;N/A&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;while&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;while&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;do&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;do&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;lock&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;synchronized&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;stackalloc&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;N/A&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span class=&quot;new&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;yield&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;N/A&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;double&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;double&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;long&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;long&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;static&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;extends&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;else&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;namespace&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;package&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;N/A&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;div align=&quot;center&quot; style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;implements&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;enum&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;new&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;struct&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;N/A&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;strictfp&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;event&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;null&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;switch&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;switch&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;throws&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;explicit&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;this&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;N/A&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;padding: 3.75pt;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;transient&lt;/span&gt;&lt;sup&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#2&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;1&quot; name=&quot;1&quot;&gt;&lt;/a&gt;   NOTE: Although &lt;code&gt;goto&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; are Java language   keywords they are unused in the Java language.&lt;br /&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;2&quot; name=&quot;2&quot;&gt;&lt;/a&gt;   NOTE: The &lt;code&gt;[NonSerialized]&lt;/code&gt; attribute in C# is equivalent to the    &lt;code&gt;transient&lt;/code&gt; keyword in Java. &lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;vmclr&quot; name=&quot;vmclr&quot;&gt;Of Virtual Machines and Language Runtimes&lt;/a&gt;&lt;/h3&gt;
Just like Java is typically compiled to Java byte code which then runs in   managed execution environment (the Java Virtual Machine or JVM) so also is C#   code compiled to an Intermediate Language (IL) which then runs in the Common   Language Runtime (CLR). Both platforms support native compilation via &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://whatis.techtarget.com/definition/0,,sid9_gci212423,00.html&quot;&gt;Just   In Time compilers&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;NOTE: While the Java platform supports   interpretation of byte code or byte code being JITed then run natively, the   .NET platform only supports native execution of C# code because the IL code is    &lt;b&gt;always&lt;/b&gt; natively compiled before running.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;heap&quot; name=&quot;heap&quot;&gt;Heap Based Classes and Garbage Collection&lt;/a&gt;&lt;/h3&gt;
In Java objects are created on the heap using the &lt;code&gt;new&lt;/code&gt; keyword.   Most classes in C# are created on the heap by using the &lt;code&gt;new&lt;/code&gt;   keyword. Also just as the JVM manages the destruction of objects so also does   the CLR via a &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.pads.uwaterloo.ca/Bruno.Preiss/books/opus5/html/page428.html&quot;&gt;Mark   and Compact garbage collection algorithm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;NOTE: C# also supports   stack-based classes, called value types, which are discussed further  below.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;jagged&quot; name=&quot;jagged&quot;&gt;Arrays Can Be Jagged&lt;/a&gt;&lt;/h3&gt;
In languages like C and C++, each subarray of a multidimensional array must   have the same dimensions. In Java and C# arrays do not have to be uniform   because jagged arrays can be created as one-dimensional arrays of arrays. In a   jagged array the contents of the array are arrays which may hold instances of   a type or references to other arrays. For this reason the rows and columns in   a jagged array need not have uniform length as can be seen from the following   code snippet:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt; int [][]myArray = new int[2][]; 
  myArray[0] = new int[3]; 
  myArray[1] = new int[9];
&lt;/code&gt;
&lt;/pre&gt;
The above code snippet is valid for both C# and Java. &lt;br /&gt;&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;noglobal&quot; name=&quot;noglobal&quot;&gt;No Global Methods&lt;/a&gt;&lt;/h3&gt;
Just like Java and unlike C++, methods in C# have to be part of a class   either as member or static methods.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;interfaceMI&quot; name=&quot;interfaceMI&quot;&gt;Interfaces, Yes. Multiple Inheritance,   No&lt;/a&gt;&lt;/h3&gt;
C#, like Java, supports the concept of an interface which is akin to a pure   abstract class. Similarly C# and Java both allow only single inheritance of   classes but multiple inheritance (or implementation) of interfaces.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;#strings&quot; name=&quot;#strings&quot;&gt;Strings Are Immutable&lt;/a&gt;&lt;/h3&gt;
C# has a System.String class which is analogous to the java.lang.String   class. Both classes are immutable meaning that the values of the strings   cannot be changed once the strings have been created. In both instances   methods that appear to modify the actual content of a string actually create a   new string to return, leaving the original string unchanged. Thus the   following C# and Java code does not modify the string in either case&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
   String csString = &quot;Apple Jack&quot;; 
   csString.ToLower(); /* Does not modify string, instead returns lower case copy of string */ 

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
   String jString = &quot;Grapes&quot;; 
   jString.toLowerCase(); /* Does not modify string, instead returns lower case copy of string */ 
&lt;/code&gt;
&lt;/pre&gt;
To create a string-like object that allows modification in C# it is   advisable to use the System.Text.StringBuilder class whereas in Java one would   use the java.lang.StringBuffer class.&lt;br /&gt;&lt;br /&gt;NOTE: In C#, the string class can   either be written as &lt;code&gt;string&lt;/code&gt; or String. &lt;br /&gt;&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;noextend&quot; name=&quot;noextend&quot;&gt;Unextendable Classes&lt;/a&gt;&lt;/h3&gt;
Both Java and C# provide mechanisms to specify that a class should be the   last one in an inheritance hierarchy and cannot be used as a base class. In   Java this is done by preceding the class declaration with the    &lt;code&gt;final&lt;/code&gt; keyword while in C# this is done by preceding the class   declaration with the &lt;code&gt;sealed&lt;/code&gt; keyword. Below are examples of   classes that cannot be extended in either language&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
 sealed class Student {
   string fname;
   string lname;
   int uid;
   void attendClass() {}
} 

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
 final class Student {
   String fname;
   String lname;
   int uid;
   void attendClass() {}
} 
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;exceptions&quot; name=&quot;exceptions&quot;&gt;Throwing and Catching   Exceptions&lt;/a&gt;&lt;/h3&gt;
Exceptions in C# and Java share a lot of similarities. Both   languages support the use of the try block for indicating guarded regions, the   catch block for handling thrown exceptions and the finally block for releasing   resources before leaving the method. Both languages have an inheritance   hierarchy where all exceptions are derived from a single Exception class.   Exceptions can be caught and rethrown after some error handling occurs in both   languages. Finally, both languages provide a mechanism for wrapping exceptions   in one another for cases where a different exception is rethrown from the one   that was caught. An example of using the exception wrapping capability is a   three tier application where a SQLException is thrown during database access   but is caught, examined, then an application specific exception is thrown. In   this scenario the application specific exception can be initialized with the   original SQLException so handlers of the application specific exception can   access the original exception thrown if needed. Below are two equivalent code   samples that show the similarities between exceptions in both   languages.&lt;br /&gt;&lt;br /&gt;NOTE: Although exceptions in both languages support methods for getting a   stack trace, only Java exceptions have methods that allow one to alter the   stack trace.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;
using System.IO; 

class MyException: Exception{

  public MyException(string message): base(message){ }

  public MyException(string message, Exception innerException): 
    base(message, innerException){ }


}

public class ExceptionTest {
    
    
    static void DoStuff(){  
    throw new FileNotFoundException();  
    }
    
    
    public static void Main(string[] args){

    try{            

        try{        
        
        DoStuff(); 
        return;  //won&#39;t get to execute 

        }catch(IOException ioe){ /* parent of FileNotFoundException */ 
        
        throw new MyException(&quot;MyException occured&quot;, ioe); /* rethrow new exception with inner exception specified */
        }
        
    }finally{
        
        Console.WriteLine(&quot;***Finally block executes even though MyException not caught***&quot;);
    
    }
    
}//Main(string[])

} // ExceptionTest

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;

class MyException extends Exception{

    public MyException(String message){ super(message); }
    
    public MyException(String message, Exception innerException){ super(message, innerException); }


}

public class ExceptionTest {
    
    
    static void doStuff(){  
    throw new ArithmeticException();    
    }
    
    
    public static void main(String[] args) throws Exception{
    
    try{            
        
        try{        
        
        doStuff(); 
        return;  //won&#39;t get to execute 
        
        }catch(RuntimeException re){ /* parent of ArithmeticException */ 
        
        throw new MyException(&quot;MyException occured&quot;, re); /* rethrow new exception with cause specified */
        }
        
    }finally{
        
        System.out.println(&quot;***Finally block executes even though MyException not caught***&quot;);
    
    }
    
}//main(string[])

} // ExceptionTest
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;staticconstructor&quot; name=&quot;staticconstructor&quot;&gt;Member Initialization at   Definition and Static Constructors&lt;/a&gt;&lt;/h3&gt;
Instance and static variables can be initialized at their point of   definition in both C# and Java. If the member variable is an instance   variable, then initialization occurs just before the constructor is called.   Static members are initialized sometime before the first usage of the member   and before the first creation of an instance of the class. It is also possible   to specify a block of code that should run before the class is used either via   creation of an instance variable or invocation of a static method. These code   blocks are called are called static constructors in C# and static   initialization blocks in Java. Static constructors are invoked before the   first invocation of a static method in the class and before the first time an   instance of the class is created.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System; 

class StaticInitTest{


    string instMember = InitInstance(); 

    string staMember = InitStatic(); 
    

    StaticInitTest(){
    Console.WriteLine(&quot;In instance constructor&quot;);
    }

    static StaticInitTest(){
    Console.WriteLine(&quot;In static constructor&quot;);
    }


    static String InitInstance(){
    Console.WriteLine(&quot;Initializing instance variable&quot;);
    return &quot;instance&quot;;
    }

     static String InitStatic(){
    Console.WriteLine(&quot;Initializing static variable&quot;);
    return &quot;static&quot;;
    }


    static void DoStuff(){
    Console.WriteLine(&quot;Invoking static DoStuff() method&quot;);
    }

    
    public static void Main(string[] args){

    Console.WriteLine(&quot;Beginning main()&quot;);

    StaticInitTest.DoStuff(); 
    
    StaticInitTest sti = new StaticInitTest(); 

    Console.WriteLine(&quot;Completed main()&quot;);

    }

}

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
class StaticInitTest{


    String instMember = initInstance(); 

    String staMember = initStatic(); 
    

    StaticInitTest(){
    System.out.println(&quot;In instance constructor&quot;);
    }

    static{
    System.out.println(&quot;In static constructor&quot;);
    }


    static String initInstance(){
    System.out.println(&quot;Initializing instance variable&quot;);
    return &quot;instance&quot;;
    }

     static String initStatic(){
    System.out.println(&quot;Initializing static variable&quot;);
    return &quot;static&quot;;
    }


    static void doStuff(){
    System.out.println(&quot;Invoking static DoStuff() method&quot;);
    }

    
    public static void main(String[] args){

    System.out.println(&quot;Beginning main()&quot;);

    StaticInitTest.doStuff(); 
    
    StaticInitTest sti = new StaticInitTest(); 

    System.out.println(&quot;Completed main()&quot;);

    }

}


OUTPUT FROM BOTH EXAMPLES: 
In static constructor
Beginning main()
Invoking static DoStuff() method
Initializing instance variable
Initializing static variable
In instance constructor
Completed main()
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;boxing&quot; name=&quot;boxing&quot;&gt;Boxing&lt;/a&gt;&lt;/h3&gt;
In situations where value types need to be treated as objects, the .NET and   Java runtimes automatically converts value types to objects by wrapping them   within a heap-allocated reference type in a process called &lt;i&gt;boxing&lt;/i&gt;. The   process of automatically convert an object to its corresponding value type   such as converting an instance of &lt;code&gt;java.lang.Integer&lt;/code&gt; to an int is   known as &lt;i&gt;unboxing&lt;/i&gt;. Below are examples of various situations where   boxing occurs in both runtimes.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;

&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System; 
using System.Collections;

//stack allocated structs also need to be boxed to be treated as objects
struct Point{

  //member fields 
    private int x; 
    private int y; 

    public Point (int x, int y){
  
    this.x = x;
    this.y = y; 

    } 
    
    public override string ToString(){

    return String.Format(&quot;({0}, {1})&quot;, x, y); 

    }


}//Point

class Test{


     public static void PrintString(object o){

     Console.WriteLine(o);

     }

     public static void Main(string[] args){

       Point p = new Point(10, 15); 
       ArrayList list = new ArrayList(); 
       int z = 100;

       PrintString(p); //p boxed to object when passed to PrintString
       PrintString(z); //z boxed to object when passed to PrintString

       // integers and float boxed when stored in collection 
       // therefore no need for Java-like wrapper classes 
       list.Add(1); 
       list.Add(13.12); 
       list.Add(z); 
       
       for(int i =0; i &amp;lt; list.Count; i++)
       PrintString(list[i]);    
       
     }

}

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
import java.util.*;

class Test{

public static void PrintString(Object o){

 System.out.println(o);

}

public static void PrintInt(int i){

 System.out.println(i); 
  
}

public static void main(String[] args){

 Vector list = new Vector(); 
 int z = 100;
 Integer x = new Integer(300);
 PrintString(z); //z boxed to object when passed to PrintString
 PrintInt(x); //x unboxed to int when passed to PrintInt

 // integers and float boxed when stored in collection 
 // therefore no need for Java wrapper classes 
 list.add(1); 
 list.add(13.12); 
 list.add(z); 
       
 for(int i =0; i &amp;lt; list.size(); i++)
   PrintString(list.elementAt(i));    
       
}

}
&lt;/code&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;samediff&quot; name=&quot;samediff&quot;&gt;The Same But Different&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;main&quot; name=&quot;main&quot;&gt;Main Method&lt;/a&gt;&lt;/h3&gt;
The entry point of both C# and   Java programs is a main method. There is a superficial difference in that the    &lt;code&gt;Main&lt;/code&gt; method in C# begins with an uppercase &quot;M&quot; (as do all .NET   Framework method names, by convention) while the &lt;code&gt;main&lt;/code&gt; method in   Java begins with a lowercase &quot;m&quot; (as do all Java method names, by convention).   The declaration for the main method is otherwise the same in both cases except   for the fact that parameter to the Main() method in C# can have a    &lt;code&gt;void&lt;/code&gt; parameter. &lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
 using System; 

 class A{
   
   public static void Main(String[] args){
   
     Console.WriteLine(&quot;Hello World&quot;); 
   
   }
} 

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
 class B{
   
   public static void main(String[] args){
   
     System.out.println(&quot;Hello World&quot;); 
   
   }
} 
&lt;/code&gt;
&lt;/pre&gt;
It is typically recommended that one creates a main method for each class   in an application to test the functionality of that class besides whatever   main method actually drives the application. For instance it is possible to   have two classes, A and B, which both contain main methods. In Java, since a   class is the unit of compilation then all one has to do is invoke the specific   class one wants run via the command line to run its main method. In C# one can   get the same effect by compiling the application with the /main switch to   specify which main should be used as the starting point of the application   when the executable is created. Using test mains in combination with   conditional compilation via &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#preprocessor&quot;&gt;preprocessor   directives&lt;/a&gt; is a powerful testing technique.&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Example&lt;/span&gt;&lt;/b&gt;
C:\CodeSample&amp;gt; javac A.java B.java 

C:\CodeSample&amp;gt; java A
 Hello World from class A

C:\CodeSample&amp;gt; java B
 Hello World from class B

&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Example&lt;/span&gt;&lt;/b&gt;
C:\CodeSample&amp;gt; csc /main:A /out:example.exe A.cs B.cs 

C:\CodeSample&amp;gt; example.exe
 Hello World from class A

C:\CodeSample&amp;gt; csc /main:B /out:example.exe A.cs B.cs 

C:\CodeSample&amp;gt; example.exe
 Hello World from class B
&lt;/code&gt;
&lt;/pre&gt;
So in Java&#39;s favor, one doesn&#39;t have to recompile to change which main is   used by the application while a recompile is needed in a C# application.   However, On the other hand, Java doesn&#39;t support conditional compilation, so   the main method will be part of even your released classes.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;inheritance&quot; name=&quot;inheritance&quot;&gt;Inheritance Syntax&lt;/a&gt;&lt;/h3&gt;
C# uses C++ syntax for inheritance, both for class inheritance and   interface implementation as opposed to the &lt;code&gt;extends&lt;/code&gt; and    &lt;code&gt;implements&lt;/code&gt; keywords.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
 using System;

 class B:A, IComparable{
   
  int CompareTo(){}

   public static void Main(String[] args){
   
     Console.WriteLine(&quot;Hello World&quot;); 
   
   }
} 

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
 class B extends A implements Comparable{
   
   int compareTo(){}

   public static void main(String[] args){
   
     System.out.println(&quot;Hello World&quot;); 
   
   }
} 
&lt;/code&gt;
&lt;/pre&gt;
Since C# is aimed at transitioning C++ developers the above syntax is   understandable although Java developers may pine for the Java syntax   especially since it is clear from looking at the class declaration in the Java   version whether the class is subclassing a class or simply implementing an   interface while it isn&#39;t in the C# version without intimate knowledge of all   the classes involved. Although it should be noted that in .NET naming   conventions, interface names have an upper-case &quot;I&quot; prepended to their names   (as in IClonable), so this isn&#39;t an issue for programs that conform to   standard naming conventions.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;is&quot; name=&quot;is&quot;&gt;Run Time Type Identification (is operator)&lt;/a&gt;&lt;/h3&gt;
The C#    &lt;code&gt;is&lt;/code&gt; operator is completely analogous to Java&#39;s    &lt;code&gt;instanceof&lt;/code&gt; operator. The two code snippets below are equivalent.    &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;

  if(x is MyClass)
   MyClass mc = (MyClass) x;

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;

  if(x instanceof MyClass)
   MyClass mc = (MyClass) x;


&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;namespace&quot; name=&quot;namespace&quot;&gt;Namespaces&lt;/a&gt;&lt;/h3&gt;
A C# namespace is a way to group a collection of classes and is used in a   manner similar to Java&#39;s &lt;code&gt;package&lt;/code&gt; construct. Users of C++ will   notice the similarities between the C# namespace syntax and that in C++. In   Java, the package names dictate the directory structure of source files in an   application whereas in C# namespaces do &lt;b&gt;not&lt;/b&gt; dictate the physical layout   of source files in directories only their logical structure. Examples   below:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;

  namespace com.carnage4life{

   public class MyClass {
 
   int x; 

   void doStuff(){}

   }

 }

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
  package com.carnage4life;

  public class MyClass {
 
  int x; 

  void doStuff(){}

 }
&lt;/code&gt;
&lt;/pre&gt;
C# &lt;code&gt;namespace&lt;/code&gt; syntax also allows one to nest namespaces in the   following way&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
  using System;

  namespace Company{
    
    public class MyClass { /* Company.MyClass */ 
 
        int x; 

        void doStuff(){}

        } 

    namespace Carnage4life{
    
       public class MyOtherClass {  /* Company.Carnage4life.MyOtherClass */ 
 
        int y; 

        void doOtherStuff(){}
    
       public static void Main(string[] args){
    
        Console.WriteLine(&quot;Hey, I can nest namespaces&quot;); 
       }

      }// class MyOtherClass
       }// namespace Carnage4life
   }// namespace Company 
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;constructdestruct&quot; name=&quot;constructdestruct&quot;&gt;Constructors, Destructors   and Finalizers&lt;/a&gt;&lt;/h3&gt;
The syntax and semantics for constructors in C# is identical to that in   Java. C# also has the concept of destructors which use syntax similar to C++   destructor syntax but have the mostly the same semantics as Java finalizers.   Although finalizers exist doing work within them is not encouraged for a   number of reasons including the fact that there is no way to control the order   of finalization which can lead to interesting problems if objects that hold   references to each other are finalized out of order. Finalization also causes   more overhead because objects with finalizers aren&#39;t removed after the garbage   collection thread runs but instead are eliminated after the finalization   thread runs which means they have to be maintained in the system longer than   objects without finalizers. Below are equivalent examples in C# and Java.&lt;br /&gt;
NOTE: In C#, destructors(finalizers) automatically call the base class   finalizer after executing which is &lt;b&gt;not&lt;/b&gt; the case in Java.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System; 

  public class MyClass {
 
     static int num_created = 0; 
     int i = 0;    

      MyClass(){  
        i = ++num_created; 
        Console.WriteLine(&quot;Created object #&quot; + i);    
     }

     ~MyClass(){
         Console.WriteLine(&quot;Object #&quot; + i + &quot; is being finalized&quot;);  
     }

    public static void Main(string[] args){

    for(int i=0; i &amp;lt; 10000; i++)
      new MyClass(); 
    
    }

   }

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
  public class MyClass {
 
     static int num_created = 0; 
     int i = 0;    

      MyClass(){  
        i = ++num_created; 
        System.out.println(&quot;Created object #&quot; + i);    
     }

     public void finalize(){
        System.out.println(&quot;Object #&quot; + i + &quot; is being finalized&quot;);  
     }

    public static void main(String[] args){

    for(int i=0; i &amp;lt; 10000; i++)
      new MyClass(); 
    
    }

   }
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;synchronization&quot; name=&quot;synchronization&quot;&gt;Synchronizing Methods and Code   Blocks&lt;/a&gt;&lt;/h3&gt;
In Java it is possible to specify synchronized blocks of code   that ensure that only one thread can access a particular object at a time and   then create a critical section of code. C# provides the &lt;code&gt;lock&lt;/code&gt;   statement which is semantically identical to the &lt;code&gt;synchronized&lt;/code&gt;   statement in Java. &lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;

 public void WithdrawAmount(int num){ 

   lock(this){ 

   if(num &amp;lt; this.amount)
     this.amount -= num; 

   }

 }

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;

  public void withdrawAmount(int num){ 

   synchronized(this){ 

   if(num &amp;lt; this.amount)
     this.amount -= num; 

   }

 }

&lt;/code&gt;
&lt;/pre&gt;
Both C# and Java support the concept of synchronized methods. Whenever a   synchronized method is called, the thread that called the method locks the   object that contains the method. Thus other threads cannot call a synchronized   method on the same object until the object is unlocked by the first thread   when it finishes executing the synchronized method. Synchronized methods are   marked in Java by using the &lt;code&gt;synchronized&lt;/code&gt; keyword while in C# it   is done by annotating the method with the    &lt;code&gt;[MethodImpl(MethodImplOptions.Synchronized)]&lt;/code&gt; attribute. Examples   of synchronized methods are shown below&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;
using System.Runtime.CompilerServices;

public class BankAccount{

 [MethodImpl(MethodImplOptions.Synchronized)]
 public void WithdrawAmount(int num){ 

   if(num &amp;lt; this.amount)
     this.amount - num; 

 }

}//BankAccount

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;

public class BankAccount{

  public synchronized void withdrawAmount(int num){ 

   if(num &amp;lt; this.amount)
     this.amount - num; 

 }

}//BankAccount
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;access&quot; name=&quot;access&quot;&gt;Access Modifiers&lt;/a&gt;&lt;/h3&gt;
Below is a table mapping C# access modifiers to Java&#39;s. C++ fans who were   disappointed when Sun changed the semantics of the &lt;code&gt;protected&lt;/code&gt;   keyword in Java 2 will be happy to note that the C# &lt;code&gt;protected&lt;/code&gt;   keyword has the same semantics as the C++ version. This means that a    &lt;code&gt;protected&lt;/code&gt; member can only be accessed by member methods in that   class or member methods in derived classes but is inaccessible to any other   classes. The &lt;code&gt;internal&lt;/code&gt; modifier means that the member can be   accessed from other classes in the same &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#assemblies&quot;&gt;assembly&lt;/a&gt; as   the class. The &lt;code&gt;internal protected&lt;/code&gt; modifier means that a member   can be accessed from classes that are in the same assembly or from derived   classes.&lt;br /&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;5&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td class=&quot;csharpk&quot;&gt;C# access modifier&lt;/td&gt;&lt;td class=&quot;javak&quot;&gt;Java access modifier&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;csharpk&quot;&gt;private&lt;/td&gt;&lt;td class=&quot;javak&quot;&gt;private&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;csharpk&quot;&gt;public&lt;/td&gt;&lt;td class=&quot;javak&quot;&gt;public&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;csharpk&quot;&gt;internal&lt;/td&gt;&lt;td class=&quot;javak&quot;&gt;protected&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;csharpk&quot;&gt;protected&lt;/td&gt;&lt;td&gt;N/A&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;csharpk&quot;&gt;internal protected&lt;/td&gt;&lt;td&gt;N/A&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
NOTE: The default accessibility of a C# field or method when no access   modifier is specified is &lt;code&gt;private&lt;/code&gt; while in Java it is    &lt;code&gt;protected&lt;/code&gt; (except that derived classes from outside the package   cannot inherit the field).&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;reflection&quot; name=&quot;reflection&quot;&gt;Reflection&lt;/a&gt;&lt;/h3&gt;
The ability to   discover the methods and fields in a class as well as invoke methods in a   class at runtime, typically called reflection, is a feature of both Java and   C#. The primary difference between reflection in Java versus reflection in C#   is that reflection in C# is done at the &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#assemblies&quot;&gt;assembly&lt;/a&gt;   level while reflection in Java is done at the class level. Since assemblies   are typically stored in DLLs, one needs the DLL containing the targeted class   to be available in C# while in Java one needs to be able to load the class   file for the targeted class. The examples below which enumerate the methods in   a specified class should show the difference between reflection in C# and   Java. &lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;

using System; 
using System.Xml; 
using System.Reflection;
using System.IO; 

class ReflectionSample {

   
    public static void Main( string[] args){


    Assembly assembly=null;
    Type type=null;
    XmlDocument doc=null; 

    try{
        // Load the requested assembly and get the requested type
        assembly = Assembly.LoadFrom(&quot;C:\\WINNT\\Microsoft.NET\\Framework\\v1.0.2914\\System.XML.dll&quot;);
        type = assembly.GetType(&quot;System.Xml.XmlDocument&quot;, true);

        //Unfortunately one cannot dynamically instantiate types via the Type object in C#. 
        doc  =  Activator.CreateInstance(&quot;System.Xml&quot;,&quot;System.Xml.XmlDocument&quot;).Unwrap() as XmlDocument;

          if(doc != null)
                 Console.WriteLine(doc.GetType() + &quot; was created at runtime&quot;);
              else
                 Console.WriteLine(&quot;Could not dynamically create object at runtime&quot;);

    }catch(FileNotFoundException){
        Console.WriteLine(&quot;Could not load Assembly: system.xml.dll&quot;);
         return;
    }catch(TypeLoadException){
        Console.WriteLine(&quot;Could not load Type: System.Xml.XmlDocument from assembly: system.xml.dll&quot;);
        
        return;
    }catch(MissingMethodException){
       Console.WriteLine(&quot;Cannot find default constructor of &quot; + type);
       }catch(MemberAccessException){
       Console.WriteLine(&quot;Could not create new XmlDocument instance&quot;);
       }
    
    // Get the methods from the type
    MethodInfo[] methods = type.GetMethods();
        
    //print the method signatures and parameters
    for(int i=0; i &amp;lt; methods.Length; i++){
    
        Console.WriteLine (&quot;{0}&quot;, methods[i]);
        
        ParameterInfo[] parameters = methods[i].GetParameters(); 
        
        for(int j=0; j &amp;lt; parameters.Length; j++){   
        Console.WriteLine (&quot; Parameter: {0} {1}&quot;, parameters[j].ParameterType, parameters[j].Name);
        }
        
    }//for (int i...) 
    
    }

}
&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;

import java.lang.reflect.*;
import org.w3c.dom.*;
import javax.xml.parsers.*; 

class ReflectionTest {

   public static void main(String[] args) {
     
       Class c=null; 
       Document d;

       try{

       c =  DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument().getClass();
       d =  (Document) c.newInstance();
       
       System.out.println(d + &quot; was created at runtime from its Class object&quot;);

       }catch(ParserConfigurationException pce){
       System.out.println(&quot;No document builder exists that can satisfy the requested configuration&quot;);
       }catch(InstantiationException ie){
       System.out.println(&quot;Could not create new Document instance&quot;);
       }catch(IllegalAccessException iae){
       System.out.println(&quot;Cannot access default constructor of &quot; + c);
       }

       // Get the methods from the class
      Method[] methods = c.getMethods();

        //print the method signatures and parameters
      for (int i = 0; i &amp;lt; methods.length; i++) {

         System.out.println( methods[i]);
        
         Class[] parameters = methods[i].getParameterTypes();
        
         for (int j = 0; j &amp;lt; parameters.length; j++) {         
            System.out.println(&quot;Parameters: &quot; +  parameters[j].getName());
         }
      
      }
   }
}
&lt;/code&gt;
&lt;/pre&gt;
One might notice from the above code samples that there is slightly more   granularity in the C# Reflection API than the Java Reflection API as can be   seen by the fact that C# has a ParameterInfo class which contains metadata   about the parameters of a Method while Java uses Class objects for that which   lose some information such as the name of the parameter.&lt;br /&gt;
Sometimes there is a need to obtain the metadata of a specific class   encapsulated as an object. This object is the &lt;code&gt;java.lang.Class&lt;/code&gt;   object in Java and the &lt;code&gt;System.Type&lt;/code&gt; object in C#. To retrieve this   metadata class from an instance of the target class, the getClass() method is   used in Java while the GetType() method is used in C#. If the name of the   class is known at compile time then one can avoid creating an instance of the   class just to obtain the metadata class by doing the following&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
  
   Type t = typeof(ArrayList);

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;

   Class c = java.util.Arraylist.class; /* Must append &quot;.class&quot; to fullname of class */

&lt;/code&gt;
&lt;/pre&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;constants&quot; name=&quot;constants&quot;&gt;Declaring Constants&lt;/a&gt;&lt;/h3&gt;
To declare constants in Java the &lt;code&gt;final&lt;/code&gt; keyword is used. Final   variables can be set either at compile time or run time. In Java, when the    &lt;code&gt;final&lt;/code&gt; is used on a primitive it makes the value of the primitive   immutable while when used on object references it makes the reference constant   meaning that the reference can only point to only one object during its   lifetime. Final members can be left uninitialized when declared but then must   be defined in the constructor.&lt;br /&gt;
To declare constants in C# the &lt;code&gt;const&lt;/code&gt; keyword is used for   compile time constants while the &lt;code&gt;readonly&lt;/code&gt; keyword is used for   runtime constants. The semantics of constant primitives and object references   in C# is the same as in Java.&lt;br /&gt;
Unlike C++, it is not possible to specify an immutable class via language   constructs in either C# or Java. Neither is it possible to create a reference   through which it&#39;s impossible to modify a mutable object.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;

using System; 

public class ConstantTest{
    
    /* Compile time constants */ 
    const int i1 = 10;   //implicitly a static variable 
    
    // code below won&#39;t compile because of &#39;static&#39; keyword
    // public static const int i2 = 20; 

    /* run time constants */
    public static readonly uint l1 =  (uint) DateTime.Now.Ticks;
  
    /* object reference as constant */ 
    readonly Object o = new Object();
 
    /* uninitialized readonly variable */ 
    readonly float f; 

  
    ConstantTest() {
    // unitialized readonly variable must be initialized in constructor 
    f = 17.21f; 
    }
  
}

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;

import java.util.*; 

public class ConstantTest{
    
    /* Compile time constants */ 
    final int i1 = 10;   //instance variable 
    static final int i2 = 20; //class variable 

    /* run time constants */
    public static final long l1 = new Date().getTime();
  
    /* object reference as constant */ 
    final Vector v = new Vector();
 
    /* uninitialized final */ 
    final float f; 

  
    ConstantTest() {
    // unitialized final variable must be initialized in constructor 
    f = 17.21f; 
    }
  
}

&lt;/code&gt;
&lt;/pre&gt;
NOTE: The Java language also supports having &lt;code&gt;final&lt;/code&gt; parameters   to a method. This functionality is non-existent in C#.&lt;br /&gt;&lt;br /&gt;The primary use   of final parameters is to allow arguments to a method to be accessible from   within &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#nested&quot;&gt;inner   classes&lt;/a&gt; declared in the method body.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;primitives&quot; name=&quot;primitives&quot;&gt;Primitive Types&lt;/a&gt;&lt;/h3&gt;
For every Java   primitive type there is a corresponding C# type which has the same name   (except for &lt;code&gt;byte&lt;/code&gt;). The &lt;code&gt;byte&lt;/code&gt; type in Java is signed   and is thus analagous to the &lt;code&gt;sbyte&lt;/code&gt; type in C# and &lt;b&gt;not&lt;/b&gt; the    &lt;code&gt;byte&lt;/code&gt; type.C# also has unsigned versions of some primitives such   as &lt;code&gt;ulong, uint, ushort&lt;/code&gt; and &lt;code&gt;byte&lt;/code&gt; . The only   significantly different primitive in C# is the &lt;code&gt;decimal&lt;/code&gt; type, a   type which stores decimal numbers without rounding errors (at the cost of more   space and less speed).&lt;br /&gt;&lt;br /&gt;Below are different ways to declare real valued   numbers in C#. &lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;

  decimal dec = 100.44m; //m is the suffix used to specify decimal numbers
  double  dbl = 1.44e2d; //e is used to specify exponential notation while d is the suffix used for doubles
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;arraydecl&quot; name=&quot;arraydecl&quot;&gt;Array Declarations&lt;/a&gt;&lt;/h3&gt;
Java has two   ways in which one can declare an array, one which is backwards compatible with   the notation used in C &amp;amp; C++ and another which is generally accepted as   being clearer to read, C# uses only the latter array declaration syntax. &lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;

  int[] iArray = new int[100]; //valid, iArray is an object of type int[] 
  float fArray[] = new float[100]; //ERROR: Won&#39;t compile  

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;

  int[] iArray = new int[100]; //valid, iArray is an object of type int[] 
  float fArray[] = new float[100]; //valid, but isn&#39;t clear that fArray is an object of type float[] 

&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;baseconstructor&quot; name=&quot;baseconstructor&quot;&gt;Calling Base Class Constructors   and Constructor Chaining&lt;/a&gt;&lt;/h3&gt;
C# and Java automatically call base class constructors, and both provide a   way to call the constructor of the base class with specific parameters.   Similarly both languages enforce that the call to the base class constructor   occurs before any initializations in the derived constructor which prevents   the derived constructor from using members that are yet to be initialized. The   C# syntax for calling the base class constructor is reminiscent of the C++   initializer list syntax.&lt;br /&gt;
Both languages also provide a way to call a constructor from another which   allows one to reduce the amount of code duplication that can occur in   constructors. This practice is typically called constructor chaining.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;

using System; 

class MyException: Exception
{

  private int Id; 

  public MyException(string message): this(message, null, 100){ }

  public MyException(string message, Exception innerException): 
    this(message, innerException, 100){ }

  public MyException(string message, Exception innerException, int id):
    base(message, innerException){
    
    this.Id = id;   
  }

}
  
&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;


class MyException extends Exception{

    private int Id; 
    

    public MyException(String message){
    
    this(message, null, 100); 
    }

    public MyException(String message, Exception innerException){
    
    this(message, innerException, 100); 
    
    }

  public MyException( String message,Exception innerException, int id){
      
      super(message, innerException); 
      this.Id = id;     

  }
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;params&quot; name=&quot;params&quot;&gt;Variable Length Parameter Lists&lt;/a&gt;&lt;/h3&gt;
In C and C++ it is possible to specify that a function takes a variable   number of arguments. This functionality is used extensively in the printf and   scanf family of functions. Both C# and Java allow one to define a parameter   that indicates that a variable number of arguments are accepted by a method.   In C#, the mechanism for specifying that a method accepts a variable number of   arguments is by using the &lt;code&gt;params&lt;/code&gt; keyword as a qualifier to the   last argument to the method which should be an array. In Java, the same effect   is achieved by appending the string &quot;...&quot; to the typename of the last argument   to the method.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;

class ParamsTest{

    public static void PrintInts(string title, params int[] args){

    Console.WriteLine(title + &quot;:&quot;);

    foreach(int num in args)
        Console.WriteLine(num); 

    }


    public static void Main(string[] args){

    PrintInts(&quot;First Ten Numbers in Fibonacci Sequence&quot;, 0, 1, 1, 2, 3, 5, 8, 13, 21, 34);
    }

}
&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
class Test{

    public static void PrintInts(String title, Integer... args){

    System.out.println(title + &quot;:&quot;);

    for(int num : args)
        System.out.println(num); 

    }

    public static void main(String[] args){

    PrintInts(&quot;First Ten Numbers in Fibonacci Sequence&quot;, 0, 1, 1, 2, 3, 5, 8, 13, 21, 34);
    }

}
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;generics&quot; name=&quot;generics&quot;&gt;Generics&lt;/a&gt;&lt;/h3&gt;
Both C# and Java provide a mechanism for creating strongly typed data   structures without knowing the specific types at compile time. Prior to the   existence of the Generics feature set, this capability was achieved by   specifying the type of the objects within the data structure as    &lt;code&gt;Object&lt;/code&gt; then casting to specific types at runtime. This technique   had several drawbacks including lack of type safety, poor performance and code   bloat. &lt;br /&gt;
The following code sample shows how one would calculate the sum of all the   integers in a collection using generics and using a collection of Objects so   that both approaches can be compared. &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;
using System.Collections;
using System.Collections.Generic; 

class Test{

    public static Stack GetStackB4Generics(){
	Stack s = new Stack(); 
	s.Push(2);
	s.Push(4); 
	s.Push(5);

	return s;
    }

    public static Stack&lt;int&gt; GetStackAfterGenerics(){
	Stack&lt;int&gt; s = new Stack&lt;int&gt;(); 
	s.Push(12);
	s.Push(14); 
	s.Push(50);

	return s;
    }

    public static void Main(String[] args){

	Stack s1 = GetStackB4Generics(); 
	int sum1 = 0; 
	
	while(s1.Count != 0){
	    sum1 += (int) s1.Pop(); //cast 
	}
	
	Console.WriteLine(&quot;Sum of stack 1 is &quot; + sum1); 

	Stack&lt;int&gt; s2 = GetStackAfterGenerics(); 
	int sum2 = 0; 
	
	while(s2.Count != 0){
	    sum2 += s2.Pop(); //no cast
	}
	
	Console.WriteLine(&quot;Sum of stack 2 is &quot; + sum2); 
    }

}
&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
import java.util.*; 

class Test{

    public static Stack GetStackB4Generics(){
	Stack s = new Stack(); 
	s.push(2);
	s.push(4); 
	s.push(5);

	return s;
    }

    public static Stack&lt;integer&gt; GetStackAfterGenerics(){
	Stack&lt;integer&gt; s = new Stack&lt;integer&gt;(); 
	s.push(12);
	s.push(14); 
	s.push(50);

	return s;
    }

    public static void main(String[] args){

	Stack s1 = GetStackB4Generics(); 
	int sum1 = 0; 
	
	while(!s1.empty()){
	    sum1 += (Integer) s1.pop(); //cast 
	}
	
	System.out.println(&quot;Sum of stack 1 is &quot; + sum1); 

	Stack&lt;integer&gt; s2 = GetStackAfterGenerics(); 
	int sum2 = 0; 
	
	while(!s2.empty()){
	    sum2 += s2.pop(); //no cast
	}
	
	System.out.println(&quot;Sum of stack 2 is &quot; + sum2); 
    }

}
&lt;/integer&gt;&lt;/integer&gt;&lt;/integer&gt;&lt;/integer&gt;&lt;/int&gt;&lt;/int&gt;&lt;/int&gt;&lt;/int&gt;&lt;/code&gt;&lt;/pre&gt;
Although similar in concept to templates in C++, the Generics feature in C#   and Java is not implemented similarly. In Java, the generic functionality is   implemented using &lt;i&gt;type erasure&lt;/i&gt;. Specifically the generic type   information is present only at compile time, after which it is erased by the   compiler and all the type declarations are replaced with &lt;code&gt;Object&lt;/code&gt;.   The compiler then automatically inserts casts in the right places. The reason   for this approach is that it provides total interoperability between generic   code and legacy code that doesn&#39;t support generics. The main problem with type   erasure is that the generic type information is not available at run time via   reflection or run time type identification. Another consequence of this   approach is that generic data structures types must always be declared using   objects and not primitive types. Thus one must create    &lt;code&gt;Stack&lt;integer&gt;&lt;/integer&gt;&lt;/code&gt; instead of &lt;code&gt;Stack&lt;int&gt;&lt;/int&gt;&lt;/code&gt;   when working integers. &lt;br /&gt;
In C#, there is explicit support for generics in the .NET runtime&#39;s   instruction language (IL). When the generic type is compiled, the generated IL   contains place holders for specific types. At runtime, when an initial   reference is made to a generic type (e.g. &lt;code&gt;List&lt;int&gt;&lt;/int&gt;&lt;/code&gt;) the   system looks to see if anyone already asked for the type or not. If the type   has been previously requested, then the previously generated specific type is   returned. If not, the JIT compiler instantiates a new type by replacing the   generic type parameters in the IL with the specific type (e.g. replacing    &lt;code&gt;List&lt;t&gt;&lt;/t&gt;&lt;/code&gt; with &lt;code&gt;List&lt;int&gt;&lt;/int&gt;&lt;/code&gt;). It should be   noted that if the requested type is a reference type as opposed to a value   type then the generic type parameter is replaced with &lt;code&gt;Object&lt;/code&gt;.   However there is no casting done internally by the .NET runtime when accessing   the type. &lt;br /&gt;
In certain cases, one may need create a method that can operate on data   structures containing any type as opposed to those that contain a specific   type (e.g. a method to print all the objects in a data structure) while still   taking advantage of the benefits of strong typing in generics. The mechanism   for specifying this in C# is via a feature called &lt;i&gt;generic type   inferencing&lt;/i&gt; while in Java this is done using &lt;i&gt;wildcard types&lt;/i&gt;. The   following code samples show how both approaches lead to the same result. &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;
using System.Collections;
using System.Collections.Generic; 

class Test{

    //Prints the contents of any generic Stack by 
    //using generic type inference 
    public static void PrintStackContents&lt;t&gt;(Stack&lt;t&gt; s){
	while(s.Count != 0){
	    Console.WriteLine(s.Pop()); 
	}	
    }

    public static void Main(String[] args){

	Stack&lt;int&gt; s2 = new Stack&lt;int&gt;(); 
	s2.Push(4); 
	s2.Push(5); 
	s2.Push(6); 

	PrintStackContents(s2); 	
	
	Stack&lt;string&gt; s1 = new Stack&lt;string&gt;(); 
	s1.Push(&quot;One&quot;); 
	s1.Push(&quot;Two&quot;); 
	s1.Push(&quot;Three&quot;); 

	PrintStackContents(s1); 
    }

}
&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
import java.util.*; 

class Test{

    //Prints the contents of any generic Stack by 
    //specifying wildcard type 
    public static void PrintStackContents(Stack s){
	while(!s.empty()){
	    System.out.println(s.pop()); 
	}	
    }

    public static void main(String[] args){

	Stack &lt;integer&gt; s2 = new Stack &lt;integer&gt;(); 
	s2.push(4); 
	s2.push(5); 
	s2.push(6); 

	PrintStackContents(s2); 	
	
	Stack&lt;string&gt; s1 = new Stack&lt;string&gt;(); 
	s1.push(&quot;One&quot;); 
	s1.push(&quot;Two&quot;); 
	s1.push(&quot;Three&quot;); 

	PrintStackContents(s1); 
    }

}
&lt;/string&gt;&lt;/string&gt;&lt;/integer&gt;&lt;/integer&gt;&lt;/string&gt;&lt;/string&gt;&lt;/int&gt;&lt;/int&gt;&lt;/t&gt;&lt;/t&gt;&lt;/code&gt;&lt;/pre&gt;
Both C# and Java provide mechanisms for specifying constraints on generic   types. In C# there are three types of constraints that can be applied to   generic types    &lt;ol&gt;
&lt;li&gt;A derivation constraint indicates to the compiler that the generic type     parameter derives from a base type such an interface or a particular base     class
&lt;li&gt;A default constructor constraint indicates to the compiler that the     generic type parameter exposes a public default constructor
&lt;li&gt;A reference/value type constraint constrains the generic type parameter     to be a reference or a value type. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
In Java, only the derivation   constraint is supported. The following code sample shows how constraints are   used in practice.    &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;
using System.Collections;
using System.Collections.Generic; 

public class Mammal {
    public Mammal(){;}

    public virtual void Speak(){;} 
}

public class Cat : Mammal{
    public Cat(){;}

    public override void Speak(){
	Console.WriteLine(&quot;Meow&quot;);
    }
}

public class Dog : Mammal{
    public Dog(){;}

    public override void Speak(){
	Console.WriteLine(&quot;Woof&quot;);
    } 
}


public class MammalHelper&lt;t&gt; where T: Mammal /* derivation constraint */,
                                   new() /* default constructor constraint */{ 

    public static T CreatePet(){
	return new T(); 
    }

    
    public static void AnnoyNeighbors(Stack&lt;t&gt; pets){
	while(pets.Count != 0){
	    Mammal m = pets.Pop(); 
	    m.Speak();  
	}	
    }  
}

public class Test{

 public static void Main(String[] args){

	Stack&lt;mammal&gt; s2 = new Stack&lt;mammal&gt;(); 
	s2.Push(MammalHelper&lt;dog&gt;.CreatePet()); 
	s2.Push(MammalHelper&lt;cat&gt;.CreatePet()); 

	MammalHelper&lt;mammal&gt;.AnnoyNeighbors(s2); 		
    }
}

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
import java.util.*; 

abstract class Mammal {
    public abstract void speak(); 
}

class Cat extends Mammal{
    public void speak(){
	System.out.println(&quot;Meow&quot;);
    }
}

class Dog extends Mammal{
    public void speak(){
	System.out.println(&quot;Woof&quot;);
    } 
}

public class Test{
    
    //derivation constraint applied to pets parameter
    public static void AnnoyNeighbors(Stack pets){
	while(!pets.empty()){
	    Mammal m = pets.pop(); 
	    m.speak();  
	}	
    }

    public static void main(String[] args){

	Stack&lt;mammal&gt; s2 = new Stack&lt;mammal&gt;(); 
	s2.push(new Dog()); 
	s2.push(new Cat()); 

	AnnoyNeighbors(s2); 		
    }
}
&lt;/mammal&gt;&lt;/mammal&gt;&lt;/mammal&gt;&lt;/cat&gt;&lt;/dog&gt;&lt;/mammal&gt;&lt;/mammal&gt;&lt;/t&gt;&lt;/t&gt;&lt;/code&gt;&lt;/pre&gt;
C# also includes the &lt;code&gt;default&lt;/code&gt; operator which returns the   default value for a type. The default value for reference types is    &lt;code&gt;null&lt;/code&gt;, and the default value for value types (such as integers,   enum, and structures) is a zero whitewash (filling the structure with zeros).   This operator is very useful when combined with generics. The following code   sample excercises the functionality of this operator. &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;

public class Test{

    public static T GetDefaultForType&lt;t&gt;(){
	return default(T); //return default value of type T
    }

    public static void Main(String[] args){
	
	Console.WriteLine(GetDefaultForType&lt;int&gt;());
	Console.WriteLine(GetDefaultForType&lt;string&gt;());	
	Console.WriteLine(GetDefaultForType&lt;float&gt;());

    }
}
&lt;/float&gt;&lt;/string&gt;&lt;/int&gt;&lt;/t&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;foreach&quot; name=&quot;foreach&quot;&gt;for-each Loop&lt;/a&gt;&lt;/h3&gt;
The for-each loop is an iteration construct that is popular in a number of   scripting languages (e.g. Perl, PHP, Tcl/Tk), build tools (GNU Make) and   function libraries (e.g. for_each in &lt;algorithm&gt; in C++). The for-each   loop is a less verbose way to iterate through arrays or classes that implement   the the &lt;code&gt;System.Collections.IEnumerable&lt;/code&gt; interface in C# or the    &lt;code&gt;java.lang.Iterable&lt;/code&gt; interface in Java.&lt;/algorithm&gt;&lt;br /&gt;
In C#, the keywords &lt;code&gt;foreach&lt;/code&gt; and &lt;code&gt;in&lt;/code&gt; are used when   creating the for-each loop while in Java the keyword &lt;code&gt;for&lt;/code&gt; and the   operator &lt;code&gt;:&lt;/code&gt; are used. &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
string[] greek_alphabet = {&quot;alpha&quot;, &quot;beta&quot;, &quot;gamma&quot;, &quot;delta&quot;, &quot;epsilon&quot;};

foreach(string str in greek_alphabet)
  Console.WriteLine(str + &quot; is a letter of the greek alphabet&quot;);

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
String[] greek_alphabet = {&quot;alpha&quot;, &quot;beta&quot;, &quot;gamma&quot;, &quot;delta&quot;, &quot;epsilon&quot;};

for(String str : greek_alphabet)
  System.out.println(str + &quot; is a letter of the greek alphabet&quot;);
&lt;/code&gt;
&lt;/pre&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;attributes&quot; name=&quot;attributes&quot;&gt;Metadata Annotations&lt;/a&gt;&lt;/h3&gt;
Metadata annotations provide a powerful way to extend the capabilities of a   programming language and the language runtime. These annotations can be   directives that request the runtime to perform certain additional tasks,   provide extra information about an item or extend the abilities of a type.   Metadata annotations are common in a number of programming environments   including Microsoft&#39;s COM and the Linux kernel. &lt;br /&gt;
C# attributes provide a way to add annotations (i.e. metadata) to a module,   type, method, parameter or member variable. Below are descriptions of a few   attributes that are intrinsic to .NET and how they are used to extend the   capabilities of the C#.&lt;br /&gt;
&lt;br /&gt;
&lt;ol type=&quot;I&quot;&gt;
&lt;li&gt;&lt;code&gt;[MethodImpl(MethodImplOptions.Synchronized)]&lt;/code&gt;: is used to     specify that a access to a method by multiple threads is protected by a lock     to prevent concurrent access to the method and is similar to the      &lt;code&gt;synchronized&lt;/code&gt; in Java.&lt;br /&gt;&lt;br /&gt;
&lt;li&gt;&lt;code&gt;[Serializable]&lt;/code&gt;: is used to mark a class as serializable and     is similar to a Java class implementing the Serializable interface.&lt;br /&gt;&lt;br /&gt;
&lt;li&gt;&lt;code&gt;[FlagsAttribute]&lt;/code&gt;: is used to specify that an enum should     support bitwise operations. This is particularly important for enumerations     where the target can have multiple values. &lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
   //declaration of bit field enumeration 
   [Flags]
   enum ProgrammingLanguages{ 
   C     = 1, 
   Lisp  = 2, 
   Basic = 4, 
   All  = C | Lisp | Basic
   }

  aProgrammer.KnownLanguages  =  ProgrammingLanguages.Lisp; //set known languages  =&quot;Lisp&quot;
  aProgrammer.KnownLanguages |=  ProgrammingLanguages.C; //set known languages  =&quot;Lisp C&quot;
  aProgrammer.KnownLanguages &amp;amp;= ~ProgrammingLanguages.Lisp; //set known languages  =&quot;C&quot;

  if((aProgrammer.KnownLanguages &amp;amp; ProgrammingLanguages.C) &amp;gt; 0){ //if programmer knows C
    //.. do something 
  }
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;code&gt;[WebMethod]&lt;/code&gt;: is used in combination with ASP.NET to specify     that a method should be available over the web as a web service     automatically. Doing the same in Java involves &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.theserverside.com/resources/article.jsp?l=WebServices-Dev-Guide&quot;&gt;configuring     JAXP, UDDI, and J2EE as well as have to create an Enterprise Java Bean&lt;/a&gt;     which involves at least two interfaces and one implementation class plus     setting up the deployment descriptor. For more information on webservices in     C#, examine the &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.codeproject.com/cs/webservices/myservice.asp&quot;&gt;Your First C#     Web Service page on CodeProject&lt;/a&gt;. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
It is possible to access the attributes of a module, class, method or field   via &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#reflection&quot;&gt;reflection&lt;/a&gt;.   This is particularly useful for seeing if a class supports certain behavior at   runtime or for extracting metadata about a class for usage by others.   Developers can create their own custom attributes by subclassing the    &lt;code&gt;System.Attribute&lt;/code&gt; class. What follows is an example of using an   attribute to provide information about the author of a class then using   reflection to access that information.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System; 
using System.Reflection;
[AttributeUsage(AttributeTargets.Class)]
public class AuthorInfoAttribute: System.Attribute{

    string author; 
    string email; 
    string version;


    public AuthorInfoAttribute(string author, string email){

    this.author = author; 
    this.email  = email;
    
    }


    public string Version{


    get{
        return version;
    }

    set{
        version = value; 
    }

    }


    public string Email{


    get{
        return email;
    }

    }

     public string Author{


    get{
        return author;
    }

    }

}



[AuthorInfo(&quot;Dare Obasanjo&quot;, &quot;kpako@yahoo.com&quot;, Version=&quot;1.0&quot;)]
class HelloWorld{

}



class AttributeTest{

    public static void Main(string[] args){

    /* Get Type object of HelloWorld class */      
    Type t = typeof(HelloWorld); 

    Console.WriteLine(&quot;Author Information for &quot; + t);
    Console.WriteLine(&quot;=================================&quot;);

    foreach(AuthorInfoAttribute att in t.GetCustomAttributes(typeof(AuthorInfoAttribute), false)){

        Console.WriteLine(&quot;Author: &quot; + att.Author);
        Console.WriteLine(&quot;Email: &quot; + att.Email);
        Console.WriteLine(&quot;Version: &quot; + att.Version);   

    }//foreach

    }//Main

}
&lt;/code&gt;
&lt;/pre&gt;
Java annotations provide a way to add annotations (i.e. metadata) to an   package, type, method, parameter, member or local variable. There are only   three built-in annotations provided in the Java language which are listed   below. &lt;br /&gt;
&lt;ol type=&quot;I&quot;&gt;
&lt;li&gt;&lt;code&gt;@Override&lt;/code&gt;: is used to specify that a method is intended to     override a method in a base class. If the annotated method does not override     a method in the base class then an error is issued during compilation.      &lt;br /&gt;&lt;br /&gt;
&lt;li&gt;&lt;code&gt;@Deprecated&lt;/code&gt;: is used to indicate that a particular method     has been deprecated. If the annotated method is used then a warning is     issued during compilation. &lt;br /&gt;&lt;br /&gt;
&lt;li&gt;&lt;code&gt;@SuppressWarnings&lt;/code&gt;: is used to prevent particular warnings     from being issued by the compiler. This annotation optionally takes the name     of the specific warning to suppress as an argument. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
As in C# it is possible to access the annotations on a module, class,   method or field via &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#reflection&quot;&gt;reflection&lt;/a&gt;.   However a key difference between C# attributes and Java annotations is that   one can create meta-annotations (i.e. annotations on annotations) in Java but   can not do the same in C#. Developers can create their own custom annotations   by creating an annotation type which is similar to an interface except that   the keyword &lt;code&gt;@interface&lt;/code&gt; is used to define it. What follows is an   example of using an attribute to provide information about the author of a   class then using reflection to access that information.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
import java.lang.annotation.*;
import java.lang.reflect.*;

@Documented //we want the annotation to show up in the Javadocs 
@Retention(RetentionPolicy.RUNTIME) //we want annotation metadata to be exposed at runtime
@interface AuthorInfo{
    String author(); 
    String email(); 
    String version() default &quot;1.0&quot;;
}

@AuthorInfo(author=&quot;Dare Obasanjo&quot;, email=&quot;kpako@yahoo.com&quot;)
class HelloWorld{

}

public class Test{

    public static void main(String[] args) throws Exception{

    /* Get Class object of HelloWorld class */      
    Class c = Class.forName(&quot;HelloWorld&quot;);
    AuthorInfo a = (AuthorInfo) c.getAnnotation(AuthorInfo.class); 
    
    System.out.println(&quot;Author Information for &quot; + c);
    System.out.println(&quot;=======================================&quot;);
    System.out.println(&quot;Author: &quot; + a.author());
    System.out.println(&quot;Email: &quot; + a.email());
    System.out.println(&quot;Version: &quot; + a.version());      

    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;enums&quot; name=&quot;enums&quot;&gt;Enumerations&lt;/a&gt;&lt;/h3&gt;
Enums are used to create and group together a list of user defined named   constants. Although on the surface the enumerated types in C# and Java seem   quite similar there are some significant differences in the implementation of   enumerated types in both languages. In Java, enumerated types are a full   fledged class which means they are typesafe and can be extended by adding   methods, fields or even implementing interfaces. Whereas in C#, an enumerated   type is simply syntactic sugar around an integral type (typically an    &lt;code&gt;int&lt;/code&gt;) meaning they cannot be extended and are not typesafe. &lt;br /&gt;
The following code sample highlights the differences between enums in both   languages. &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;

public enum DaysOfWeek{
    SUNDAY, 
    MONDAY, 
    TUESDAY, 
    WEDNESDAY,
    THURSDAY, 
    FRIDAY,
    SATURDAY
}

public class Test{

    public static bool isWeekDay(DaysOfWeek day){
	return !isWeekEnd(day);   
    }

    public static bool isWeekEnd(DaysOfWeek day){
	return (day == DaysOfWeek.SUNDAY || day == DaysOfWeek.SATURDAY); 
    }

    public static void Main(String[] args){

	DaysOfWeek sun = DaysOfWeek.SUNDAY; 
	Console.WriteLine(&quot;Is &quot; + sun + &quot; a weekend? &quot; + isWeekEnd(sun));
	Console.WriteLine(&quot;Is &quot; + sun + &quot; a week day? &quot; + isWeekDay(sun));

	/* Example of how C# enums are not type safe */
	sun = (DaysOfWeek) 1999;
	Console.WriteLine(sun);
	
    }
}

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
enum DaysOfWeek{
    SUNDAY, 
    MONDAY, 
    TUESDAY, 
    WEDNESDAY,
    THURSDAY, 
    FRIDAY,
    SATURDAY;

    public boolean isWeekDay(){
	return !isWeekEnd();   
    }

    public boolean isWeekEnd(){
	return (this == SUNDAY || this == SATURDAY); 
    }

}

public class Test{

    public static void main(String[] args) throws Exception{

	DaysOfWeek sun = DaysOfWeek.SUNDAY; 
	System.out.println(&quot;Is &quot; + sun + &quot; a weekend? &quot; + sun.isWeekEnd());
	System.out.println(&quot;Is &quot; + sun + &quot; a week day? &quot; + sun.isWeekDay());
    }
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;dejavu&quot; name=&quot;dejavu&quot;&gt;An Ever So Slight Feeling of D¨¨j¨¤ Vu&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;nested&quot; name=&quot;nested&quot;&gt;Nested classes&lt;/a&gt;&lt;/h3&gt;
In Java and C# it is possible to nest class declarations within each other.   In Java there are two kinds of nested classes; non-static nested classes also   known as inner classes and static nested classes. A Java inner class can be   considered as a one-to-one relationship between the inner class and its   enclosing class where for each instance of the enclosing class there exists a   corresponding instance of the inner class that has access to the enclosing   class&#39;s instance variables and contains no static methods. On the other hand a   Java static nested class is a similar to nesting a class decaration within   another where the nested class has access to the static members and methods of   the enclosing class.&lt;br /&gt;
C# has the equivalent of Java&#39;s static nested classes but has nothing   analogous to Java&#39;s inner classes. The following nested class declarations   below are equivalent&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
public class Car{

  private Engine engine;

  private class Engine{

    string make; 

  }

}

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
public class Car{

  private Engine engine;

  private static class Engine{

    String make; 

  }

}
&lt;/code&gt;
&lt;/pre&gt;
NOTE: In Java a nested class can be declared in any block of code including   methods, this is &lt;b&gt;not&lt;/b&gt; the case in C#. The ability to create nested   classes in methods in Java may seem unnecessary but combined with anonymous   inner classes can provide a means of creating powerful design patterns.&lt;br /&gt;
&lt;li&gt;&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;threads&quot; name=&quot;threads&quot;&gt;Threads and Volatile Members&lt;/a&gt;   A thread is a sequential flow of control within a program. A program or   process can have multiple threads running concurrently all of which may share   data or run independently while performing tasks. Threads are powerful in that   they allow a developer to perform multiple tasks at once in a single program   or process. Advantages of threads include exploiting parallelism in   multiprocessor architectures, reducing execution time by being able to perform   tasks while waiting on a blocking system calls (such as printing or other   I/O), and avoiding &lt;i&gt;freezing&lt;/i&gt; in GUI applications.&lt;br /&gt;
Java threads are created by subclassing the &lt;code&gt;java.lang.Thread&lt;/code&gt;   class and overriding its run() method or by implementing the    &lt;code&gt;java.lang.Runnable&lt;/code&gt; interface and implementing the run() method.   Whereas in C#, one creates a thread by creating a new    &lt;code&gt;System.Threading.Thread&lt;/code&gt; object and passing it a    &lt;code&gt;System.Threading.ThreadStart&lt;/code&gt; &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#delegates&quot;&gt;delegate&lt;/a&gt;   which is initialized with the method that is to be run as a thread. Thus, in   Java a method that shall run in a multithreaded context is designed up front   specifically with that in mind. On the other hand, in C# any method can be   passed to a ThreadStart object and run in a multithreaded scenario.&lt;br /&gt;
In Java, every class inherits the wait(), notify() and notifyAll() from    &lt;code&gt;java.lang.Object&lt;/code&gt; which are used for thread operations. The   equivalent methods in C# are the Wait(), Pulse() and PulseAll() methods in the    &lt;code&gt;System.Threading.Monitor&lt;/code&gt; class.&lt;br /&gt;
The example below shows a scenario where worker threads are dispatched in a   specific order and must be processed in the same order upon return. Due to the   non-deterministic nature of threads, on some runs the threads finish working   in the order they were dispatched in and in other runs they appear out of   order and thus each thread must wait until its turn comes up.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;

using System; 
using System.Threading; 
using System.Collections; 

public class WorkerThread{
       
    private int idNumber;
    private static int num_threads_made = 1; 
    private ThreadSample owner; 

    public WorkerThread(ThreadSample owner){
        
        idNumber = num_threads_made;    
    num_threads_made++;        
    this.owner = owner;
    
    }/* WorkerThread() */
    
    //sleeps for a random amount of time to simulate working on a task
    
    public void PerformTask(){

    Random r = new Random((int) DateTime.Now.Ticks); 
    int timeout = (int) r.Next() % 1000; 

    if(timeout &amp;lt; 0)
        timeout *= -1; 

    //Console.WriteLine(idNumber + &quot;:A&quot;);
       
    try{        
        Thread.Sleep(timeout);      
        } catch (ThreadInterruptedException e){
            Console.WriteLine(&quot;Thread #&quot; + idNumber + &quot; interrupted&quot;);
        }
    
    //Console.WriteLine(idNumber + &quot;:B&quot;);

    owner.workCompleted(this); 

    }/* performTask() */
    
           
    public int getIDNumber() {return idNumber;}
         
    
} // WorkerThread



public class ThreadSample {

    private static Mutex m = new Mutex(); 
    private ArrayList threadOrderList = new ArrayList(); 
    
    private int NextInLine(){

    return (int) threadOrderList[0]; 
    }

    private void RemoveNextInLine(){

    threadOrderList.RemoveAt(0);

    //all threads have shown up 
    if(threadOrderList.Count == 0)
        Environment.Exit(0);
    }

    
    public void workCompleted(WorkerThread worker){
        
    try{
        
        lock(this){
        
        
        while(worker.getIDNumber() != NextInLine()){
            
            try {
            //wait for some other thread to finish working
            Console.WriteLine (&quot;Thread #&quot; + worker.getIDNumber() + &quot; is waiting for Thread #&quot; + 
                       NextInLine() + &quot; to show up.&quot;);
            
            Monitor.Wait(this, Timeout.Infinite);
            
            } catch (ThreadInterruptedException e) {}
            
        }//while
            
        
        Console.WriteLine(&quot;Thread #&quot; + worker.getIDNumber() + &quot; is home free&quot;);
        
        //remove this ID number from the list of threads yet to be seen
        RemoveNextInLine(); 
        
        //tell the other threads to resume
        Monitor.PulseAll(this); 
        
        }
        
    }catch(SynchronizationLockException){Console.WriteLine(&quot;SynchronizationLockException occurred&quot;);}
                
    }

    public static void Main(String[] args){
    

    ThreadSample ts = new ThreadSample(); 

    /* Launch 25 threads */ 
    for(int i=1; i &amp;lt;= 25; i++){
        WorkerThread wt = new WorkerThread(ts); 
        ts.threadOrderList.Add(i); 
        Thread t = new Thread(new ThreadStart(wt.PerformTask));
        t.Start();    
    }

    Thread.Sleep(3600000); //wait for it all to end
    
    }/* main(String[]) */ 


}//ThreadSample

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
import java.util.*; 


class WorkerThread extends Thread{
       
    private Integer idNumber;
    private static int num_threads_made = 1; 
    private ThreadSample owner; 

    public WorkerThread(ThreadSample owner){
        
        super(&quot;Thread #&quot; + num_threads_made);   
    
        idNumber = new Integer(num_threads_made);   
    num_threads_made++;        
    this.owner = owner;
    
    start(); //calls run and starts the thread.
    }/* WorkerThread() */
    
    //sleeps for a random amount of time to simulate working on a task
    public void run(){

    Random r = new Random(System.currentTimeMillis()); 
    int timeout = r.nextInt()  % 1000; 

    if(timeout &amp;lt; 0)
        timeout *= -1 ;

    try{        
        Thread.sleep(timeout);      
        } catch (InterruptedException e){
            System.out.println(&quot;Thread #&quot; + idNumber + &quot; interrupted&quot;);
        }
    
    owner.workCompleted(this); 

    }/* run() */
    
           
    public Integer getIDNumber() {return idNumber;}
         
    
} // WorkerThread



public class ThreadSample{

    private Vector threadOrderList = new Vector(); 
    
    private Integer nextInLine(){

    return (Integer) threadOrderList.firstElement(); 
    }

    private void removeNextInLine(){

    threadOrderList.removeElementAt(0);

    //all threads have shown up 
    if(threadOrderList.isEmpty())
        System.exit(0); 
    }

    public synchronized void workCompleted(WorkerThread worker){

    
    while(worker.getIDNumber().equals(nextInLine())==false){
    
        try {
        //wait for some other thread to finish working
        System.out.println (Thread.currentThread().getName() + &quot; is waiting for Thread #&quot; + 
                    nextInLine() + &quot; to show up.&quot;);
        wait();
        } catch (InterruptedException e) {}
           
    }//while
    
    System.out.println(&quot;Thread #&quot; + worker.getIDNumber() + &quot; is home free&quot;);

    //remove this ID number from the list of threads yet to be seen
    removeNextInLine(); 

    //tell the other threads to resume
    notifyAll(); 
    }

    public static void main(String[] args) throws InterruptedException{
    

    ThreadSample ts = new ThreadSample(); 

    /* Launch 25 threads */ 
    for(int i=1; i &amp;lt;= 25; i++){
        new WorkerThread(ts); 
        ts.threadOrderList.add(new Integer(i)); 
    }

    Thread.sleep(3600000); //wait for it all to end
    
    }/* main(String[]) */ 


}//ThreadSample
&lt;/code&gt;
&lt;/pre&gt;
In many situations one cannot guarantee that the order of execution of a   program will be the same as that in the source code. Reasons for the   unexpected ordering of program execution include compiler optimizations that   reorder statements or mulitiprocessor systems that fail to store variables in   global memory amongst others. To work around this, both C# and Java have the   concept of the &lt;code&gt;volatile&lt;/code&gt; keyword which is used to tell the   language runtime that reordering instructions related to accessing such fields   is prohibited. There are &lt;b&gt;major differences&lt;/b&gt; in the semantics of    &lt;code&gt;volatile&lt;/code&gt; in Java and C# which are illustrated in the example   below taken from &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html&quot;&gt;The   &quot;Double-Checked Locking is Broken&quot; Declaration&lt;/a&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;

/* Used to lazily instantiate a singleton class */ 
/*             WORKS AS EXPECTED                */
  class Foo {
        private volatile Helper helper = null;
        public Helper getHelper() {
            if (helper == null) {
                lock(this) {
                    if (helper == null)
                        helper = new Helper();
                }
            }
            return helper;
        }
    }


&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;

/* Used to lazily instantiate a singleton class */ 
/* BROKEN UNDER CURRENT SEMANTICS FOR VOLATILE */ 

  class Foo {
        private volatile Helper helper = null;
        public Helper getHelper() {
            if (helper == null) {
                synchronized(this) {
                    if (helper == null)
                        helper = new Helper();
                }
            }
            return helper;
        }
    }


&lt;/code&gt;
&lt;/pre&gt;
Although the above code snippets seem identical save for the substitution   of the &lt;code&gt;synchronized&lt;/code&gt; keyword with the &lt;code&gt;lock&lt;/code&gt; keyword,   the Java version is not guaranteed to work on all JVMs. Currently the Java   Memory Model does not prevent reordering of writes to volatile variables with   writes to other variables so it is possible that the new object is constructed   before the helper reference is made to point at the newly created object   meaning that two objects are created. Also it is possible that the helper   reference is made to point at a block of memory while the object is still   being created meaning that a reference to an incomplete object will be   returned. In C#, the semantics of &lt;code&gt;volatile&lt;/code&gt; prevent such problems   from occurring because reads and writes cannot be moved backward or forward   across a volatile write. Also in C#, being marked as &lt;code&gt;volatile&lt;/code&gt;   also prevents the Just In Time compiler from placing the variable in a   register and also ensures that the variable is stored in global memory on   multiprocessor systems.&lt;br /&gt;
For more information on the problems with the Java Memory Model and   Double-Checked Locking, see the &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-double.html&quot;&gt;Double-checked   locking: Clever, but broken&lt;/a&gt; article on Javaworld.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;operatoroverloading&quot; name=&quot;operatoroverloading&quot;&gt;Operator   Overloading&lt;/a&gt;&lt;/h3&gt;
Operator overloading allows standard operators in a language to be given   new semantics when applied in the context of a particular class or type.   Operator overloading can be used to simplify the syntax of certain operations   especially when they are performed very often, such as string concatenation in   Java or interactions with iterators and collections in the C++ Standard   Template Library.&lt;br /&gt;
Operator overloading is a point of contention for many developers due to   the fact that it provides a lot of flexibility and power which makes it prone   to abuse. There is a tendency for developers to use it poorly by doings like   overloading operators in an unintuitive manner (e.g. overloading    &lt;code&gt;++&lt;/code&gt; and &lt;code&gt;--&lt;/code&gt; to connect and disconnect from the   network) , overloading operators in a manner inconsistent with their typical   use (e.g. overloading &lt;code&gt;[ ]&lt;/code&gt; to return a &lt;i&gt;copy&lt;/i&gt; of an object at   a particular index in a collection instead of a reference to the actual   object) or overloading some operators and not others (e.g. overloading    &lt;code&gt;&amp;lt;&lt;/code&gt; but not &lt;code&gt;&amp;gt;&lt;/code&gt;).&lt;br /&gt;
Overloading operators tends to be most useful when the class lends itself   intuitively to using that operator. Examples of situations that intuitively   suggest that operator overloading would be beneficial are overloading &lt;code&gt;[   ]&lt;/code&gt; for use with collections, overloading &lt;code&gt;+&lt;/code&gt; and    &lt;code&gt;*&lt;/code&gt; for use with matrices, overloading mathematical operators for   use with complex numbers, and overloading the &lt;code&gt;==&lt;/code&gt; and    &lt;code&gt;!=&lt;/code&gt; operators for classes that have some means to measure   equality. Below is an example that shows how operator overloading works in   C#.&lt;br /&gt;
NOTE: Unlike C++, C# does not allow the overloading of the following   operators; &lt;code&gt;new&lt;/code&gt;, &lt;code&gt;( )&lt;/code&gt;, &lt;code&gt;||&lt;/code&gt;,    &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt;, &lt;code&gt;=&lt;/code&gt;, or any variations of compound   assignments such as &lt;code&gt;+=&lt;/code&gt;, &lt;code&gt;-=&lt;/code&gt;, etc. However, compound   assignment operators will call overloaded operators, for instance, += would   call overloaded +.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;

class OverloadedNumber{

    private int value; 

    public OverloadedNumber(int value){

    this.value = value; 

    }

    public override string ToString(){
    return value.ToString(); 
    }


    public static OverloadedNumber operator -(OverloadedNumber number){
    return new OverloadedNumber(-number.value); 
    }

    public static OverloadedNumber operator +(OverloadedNumber number1, OverloadedNumber number2){
    return new OverloadedNumber(number1.value + number2.value); 
    }

    public static OverloadedNumber operator ++(OverloadedNumber number){
    return new OverloadedNumber(number.value + 1); 
    }

}

public class OperatorOverloadingTest {

  
    public static void Main(string[] args){

    OverloadedNumber number1 = new OverloadedNumber(12); 
    OverloadedNumber number2 = new OverloadedNumber(125); 

    Console.WriteLine(&quot;Increment: {0}&quot;, ++number1);
    Console.WriteLine(&quot;Addition: {0}&quot;, number1 + number2);
  
    }
} // OperatorOverloadingTest
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;switch&quot; name=&quot;switch&quot;&gt;switch Statment&lt;/a&gt;&lt;/h3&gt;
There are two major   differences between the &lt;code&gt;switch&lt;/code&gt; statement in C# versus that in   Java. In C#, &lt;code&gt;switch&lt;/code&gt; statements support the use of string literals   and do not allow fall-through unless the label contains no statements.   Fall-throughs are explicitly disallowed because they are a leading cause of   hard-to-find bugs in software. &lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;

switch(foo){    
    
    case &quot;A&quot;: 
        Console.WriteLine(&quot;A seen&quot;);
        break;
    case &quot;B&quot;: 
    case &quot;C&quot;: 
        Console.WriteLine(&quot;B or C seen&quot;);
        break; 

        /* ERROR: Won&#39;t compile due to fall-through at case &quot;D&quot; */
    case &quot;D&quot;: 
        Console.WriteLine(&quot;D seen&quot;);
    case &quot;E&quot;:
        Console.WriteLine(&quot;E seen&quot;);
        break; 
    }
  

&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;assemblies&quot; name=&quot;assemblies&quot;&gt;Assemblies&lt;/a&gt;&lt;/h3&gt;
C# assemblies share a lot in common with Java JAR files. An assembly is the   fundamental unit of code packaging in the .NET environment. Assemblies are   self contained and typically contain the intermediate code from compiling   classes, metadata about the classes, and any other files needed by the   packaged code to perform its task.&lt;br /&gt;
Since assemblies are the fundamental unit of code packaging, several   actions related to interacting with types must be done at the assembly level.   For instance, granting of security permissions, code deployment, and   versioning are done at the assembly level. Java JAR files perform a similar   task in Java with most differences being in the implementation. Assemblies are   usually stored as EXEs or DLLs while JAR files are stored in the ZIP file   format.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;collections&quot; name=&quot;collections&quot;&gt;Collections&lt;/a&gt;&lt;/h3&gt;
A number of popular programming languages contain a collections framework   which typically consists of a number of data structures for holding multiple   objects as well as algorithms for manipulating the objects within the   aforementioned data structures. The primary advantage of a collections   framework is that it frees developers from having to write data structures and   sort algorithms every time one is needed and instead frees them up to work on   the actual application logic. A secondary benefit is that collections   frameworks lead to consistency across projects which means the learning curve   for new developers using applications that use a collections framework is less   steep when compared to a situation where one was not used.&lt;br /&gt;
The C# collections framework consists of the classes in the    &lt;code&gt;System.Collections&lt;/code&gt; &lt;span class=&quot;new&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;and the    &lt;code&gt;System.Collections.Generic&lt;/code&gt; namespaces&lt;/span&gt;&lt;/span&gt;. The    &lt;code&gt;Systems.Collections&lt;/code&gt; namespace contains interfaces and abstract   classes that represent abstract data types such as IList, IEnumerable,   IDictionary, ICollection, and CollectionBase which enable developers to   manipulate data structures independently of how they are actually implemented   as long as the data structures inherit from the abstract data types. The    &lt;code&gt;System.Collections&lt;/code&gt; namespace also contains some concrete   implementations of data structures such as ArrayList, Stack, Queue, HashTable   and SortedList. All four of the concrete data structure implementations enable   one to obtain synchronized wrappers to the collection which allows for access   in a thread-safe manner. &lt;span class=&quot;new&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;The    &lt;code&gt;System.Collections.Generic&lt;/code&gt; namespace has generic implementations   of the key data structures in the &lt;code&gt;System.Collections&lt;/code&gt;&lt;/span&gt; namespace   including generic List&lt;t&gt;, Stack&lt;t&gt;,Queue&lt;t&gt;,   Dictionary&lt;k&gt; and SortedDictionary&lt;k&gt; classes .&lt;/k&gt;&lt;/k&gt;&lt;/t&gt;&lt;/t&gt;&lt;/t&gt;&lt;/span&gt;&lt;br /&gt;
The Java collections framework consists of a large number of the classes   and interfaces in the &lt;code&gt;java.util&lt;/code&gt; package. &lt;span class=&quot;new&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Instead   of having a separate namespace for generic collections, the collections in the    &lt;code&gt;java.util&lt;/code&gt; package have been retrofitted to support   generics.&lt;/span&gt;&lt;/span&gt; The Java collection framework is similar to that in C# except   for the fact that it can be considered a superset of the C# collection   framework since it contains a number of extra features. The Java collection   framework contains data structures that are missing from those in C# such as   sets and linked lists. Also the Java collections framework not only has   methods that enable one to access unsafe collections in a thread safe manner   but contains thread-safe versions of most of the data structures as well.   Finally, the Java collections framework has a number of algorithms for   manipulating the elements within the data structures including algorithms that   can do the following; find the largest element based on some Comparator, find   the smallest element, find sublists within a list, reverse the contents of a   list, shuffle the contents of a list, creates immutable versions of a   colection, performs sorts, and binary searches.&lt;br /&gt;
At the current time, the Java collections framework is more sophisticated   than that available in .NET via C#.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;goto&quot; name=&quot;goto&quot;&gt;goto (no longer considered harmful)&lt;/a&gt;&lt;/h3&gt;
Unlike Java, C# contains the &lt;code&gt;goto&lt;/code&gt; statement which can be used   to jump directly from a point in the code to a label. Although much derided,   gotos can be used in certain situations to reduce code duplication while   enhancing readability. A secondary usage of the &lt;code&gt;goto&lt;/code&gt; statement is   the ability to mimic resumeable exceptions like those in Smalltalk, as long as   the exception thrown does not cross method boundaries.&lt;br /&gt;
NOTE: In C#, one &lt;b&gt;cannot&lt;/b&gt; jump into a statement block using the    &lt;code&gt;goto&lt;/code&gt; statement;&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System; 
using System.Net.Sockets; 

class GotoSample{


    public static void Main(string[] args){
    
    int num_tries = 0;
    
       retry: 

    try{             

        num_tries++;    
        Console.WriteLine(&quot;Attempting to connect to network. Number of tries =&quot; + num_tries);

        //Attempt to connect to a network times out 
        //or some some other network connection error that 
        //can be recovered from
       
        throw new SocketException(); 

    }catch(SocketException){

        if(num_tries &amp;lt; 5)
        goto retry;                 
    }       
   
   }/* Main(string[]) */ 

}//GotoSample

&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;virtualfinal&quot; name=&quot;virtualfinal&quot;&gt;Virtual Methods (and final ones   too)&lt;/a&gt;&lt;/h3&gt;
One of the tenets of object oriented programming is polymorphism.   Polymorphism enables one to interact with members of a type hierarchy as   generic types instead of dealing with specific types. The means of   implementing polymorphism typically involves having methods in a base class   that may be overidden by derived classes. These methods can be invoked even   though the client has a reference to a base class type which points to an   object of the derived class. Such methods are bound at runtime instead of   being bound during compilation and are typically called virtual methods.&lt;br /&gt;
In Java all methods are virtual methods while in C#, as in C++, one must   explicitly state which methods one wants to be virtual since by default they   are not. To mark a method as virtual in C#, one uses the &lt;code&gt;virtual&lt;/code&gt;   keyword. Also, implementers of a child class can decide to either explicitly   override the virtual method by using the &lt;code&gt;override&lt;/code&gt; keyword or   explicitly choose not to by using the &lt;code&gt;new&lt;/code&gt; keyword instead. By   default, in C#, the behavior of methods in a derived class that have the same   signature as those in the base class is as if they were declared with the    &lt;code&gt;new&lt;/code&gt; keyword.&lt;br /&gt;
It is possible to mark methods as &lt;code&gt;final&lt;/code&gt; in Java which means   that the method cannot be overridden by derived classes. In C# this can be   done by not marking the method as &lt;code&gt;virtual&lt;/code&gt;. The major difference   is that in C#, the class can still define the method but the base class   version is the one that will be called if the object is used via a base class   reference. Java disallows the derived class from containing a method that has   the same signature as the final base class method.&lt;br /&gt;
Below are examples that show the differences in virtual methods in both   languages.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System; 

public class Parent{

    public void DoStuff(string str){
    Console.WriteLine(&quot;In Parent.DoStuff: &quot; + str); 
    }

}

public class Child: Parent{

     public void DoStuff(int n){
    Console.WriteLine(&quot;In Child.DoStuff: &quot; + n);    
    }

     public void DoStuff(string str){
    Console.WriteLine(&quot;In Child.DoStuff: &quot; + str);  
    }
}


public class VirtualTest{

    public static void Main(string[] args){

    Child ch = new Child(); 

    ch.DoStuff(100); 
    ch.DoStuff(&quot;Test&quot;); 

    ((Parent) ch).DoStuff(&quot;Second Test&quot;); 
    }

}//VirtualTest

&lt;b&gt;OUTPUT&lt;/b&gt;:
In Child.DoStuff: 100
In Child.DoStuff: Test
In Parent.DoStuff: Second Test

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
class Parent{

    public void DoStuff(String str){
    System.out.println(&quot;In Parent.DoStuff: &quot; + str);    
    }

}

class Child extends Parent{

     public void DoStuff(int n){
    System.out.println(&quot;In Child.DoStuff: &quot; + n);   
    }

     public void DoStuff(String str){
    System.out.println(&quot;In Child.DoStuff: &quot; + str); 
    }
}


public class VirtualTest{

    public static void main(String[] args){

    Child ch = new Child(); 

    ch.DoStuff(100); 
    ch.DoStuff(&quot;Test&quot;); 

    ((Parent) ch).DoStuff(&quot;Second Test&quot;); 
    }

}//VirtualTest

&lt;b&gt;OUTPUT&lt;/b&gt;:
In Child.DoStuff: 100
In Child.DoStuff: Test
In Child.DoStuff: Second Test
&lt;/code&gt;
&lt;/pre&gt;
The C# example can be made to produce the same output as the Java example   by marking the DoStuff(string) method in the Parent class as    &lt;code&gt;virtual&lt;/code&gt; and marking the DoStuff(string) method in the Child class   with the &lt;code&gt;override&lt;/code&gt; keyword.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;

using System; 

public class Parent{

    public virtual void DoStuff(string str){
    Console.WriteLine(&quot;In Parent.DoStuff: &quot; + str); 
    }

}

public class Child: Parent{

     public void DoStuff(int n){
    Console.WriteLine(&quot;In Child.DoStuff: &quot; + n);    
    }

     public override void DoStuff(string str){
    Console.WriteLine(&quot;In Child.DoStuff: &quot; + str);  
    }
}


public class VirtualTest{

    public static void Main(string[] args){

    Child ch = new Child(); 

    ch.DoStuff(100); 
    ch.DoStuff(&quot;Test&quot;); 

    ((Parent) ch).DoStuff(&quot;Second Test&quot;); 
    }

}//VirtualTest

&lt;b&gt;OUTPUT&lt;/b&gt;:
In Child.DoStuff: 100
In Child.DoStuff: Test
In Child.DoStuff: Second Test
&lt;/code&gt;
&lt;/pre&gt;
The above example can be made to produce the original results by altering   the signature of the DoStuff(string) method in the Child class to&lt;br /&gt;
&lt;blockquote&gt;
&lt;code&gt;public new void DoStuff(string str)&lt;/code&gt;   &lt;/blockquote&gt;
which states that although the DoStuff method is virtual in the   base class, the child class would like to treat it as a non-virtual method.    &lt;br /&gt;&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;fileio&quot; name=&quot;fileio&quot;&gt;File I/O&lt;/a&gt;&lt;/h3&gt;
Both languages support performing I/O via Stream classes. The examples   below copy the contents of a file named &quot;input.txt&quot; to another called   &quot;output.txt&quot;.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;
using System.IO; 


public class FileIOTest {

    public static void Main(string[] args){

    FileStream inputFile  = new FileStream(&quot;input.txt&quot;, FileMode.Open);
    FileStream outputFile = new FileStream(&quot;output.txt&quot;, FileMode.Open);

        StreamReader sr     = new StreamReader(inputFile);
        StreamWriter sw     = new StreamWriter(outputFile);


    String str;

    while((str = sr.ReadLine())!= null)
        sw.Write(str);

        sr.Close();
        sw.Close();
    }

}//FileIOTest

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
import java.io.*;

public class FileIO{

    public static void main(String[] args) throws IOException {

    File inputFile  = new File(&quot;input.txt&quot;);
    File outputFile = new File(&quot;output.txt&quot;);

        FileReader in     = new FileReader(inputFile);
    BufferedReader br = new BufferedReader(in);

        FileWriter out    = new FileWriter(outputFile);
    BufferedWriter bw = new BufferedWriter(out);

    String str;

    while((str = br.readLine())!= null)
        bw.write(str);

        br.close();
        bw.close();
    }

}//FileIOTest

&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;serialization&quot; name=&quot;serialization&quot;&gt;Object Serialization&lt;/a&gt;&lt;/h3&gt;
Object Persistence also known as Serialization is the ability to read and   write objects via a stream such as a file or network socket. Object   Persistence is useful in situations where the state of an object must be   retained across invocations of a program. Usually in such cases simply storing   data in a flat file is insufficient yet using a Database Management System   (DBMS) is overkill. Serialization is also useful as a means of transferring   the representation of a class in an automatic and fairly seamless manner.&lt;br /&gt;
Serializable objects in C# are annotated with the    &lt;code&gt;[Serializable]&lt;/code&gt; attribute. The &lt;code&gt;[NonSerialized]&lt;/code&gt;   attribute is used to annote members of a C# class that should not be   serialized by the runtime. Such fields are usually calculated or temporary   values that have no meaning when saved. C# provides two formats for   serializing classes; either as XML or in a binary format, the former is more   readable by humans and applications while the latter is more efficient. One   can also define custom ways an object is serialized if the standard ways are   insufficient by implementing the &lt;code&gt;ISerializable&lt;/code&gt; interface.&lt;br /&gt;
In Java, serializable objects are those that implement the    &lt;code&gt;Serializable&lt;/code&gt; interface while the &lt;code&gt;transient&lt;/code&gt; keyword   is used to mark members of a Java class as ones not to be serialized. By   default Java supports serializing objects to a binary format but does provide   a way of overriding the standard serialization process. Objects that plan to   override default serializations can implement methods with the following   signatures&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;   private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException;

   private void writeObject(java.io.ObjectOutputStream stream) throws IOException
&lt;/code&gt;
&lt;/pre&gt;
Since the above methods are &lt;code&gt;private&lt;/code&gt; there is no interface   that can be implemented to indicate that a Java class supports custom   serialization using readObject and writeObject. For classes that need publicly   accessible methods for custom serialization there exists the    &lt;code&gt;java.io.Externalizable&lt;/code&gt; interface which specifies the   readExternal() and writeExternal() for use in customizing how an object is   read and written to a stream. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;

using System;
using System.IO;
using System.Reflection;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization.Formatters.Soap;


[Serializable]
class SerializeTest{

    [NonSerialized]
    private int x; 

    private int y; 

    public SerializeTest(int a, int b){

    x = a; 
    y = b; 

    }

    public override String ToString(){

    return &quot;{x=&quot; + x + &quot;, y=&quot; + y + &quot;}&quot;; 

    }

    public static void Main(String[] args){

    SerializeTest st = new SerializeTest(66, 61); 
    Console.WriteLine(&quot;Before Binary Write := &quot; + st);

    Console.WriteLine(&quot;\n Writing SerializeTest object to disk&quot;);
    Stream output  = File.Create(&quot;serialized.bin&quot;);
    BinaryFormatter bwrite = new BinaryFormatter(); 
    bwrite.Serialize(output, st); 
    output.Close(); 

    Console.WriteLine(&quot;\n Reading SerializeTest object from disk\n&quot;);
    Stream input  = File.OpenRead(&quot;serialized.bin&quot;);
    BinaryFormatter bread = new BinaryFormatter(); 
    SerializeTest fromdisk = (SerializeTest)bread.Deserialize(input); 
    input.Close(); 


    /* x will be 0 because it won&#39;t be read from disk since non-serialized */ 
    Console.WriteLine(&quot;After Binary Read := &quot; + fromdisk);

    
    st = new SerializeTest(19, 99);  
    Console.WriteLine(&quot;\n\nBefore SOAP(XML) Serialization := &quot; + st);

    Console.WriteLine(&quot;\n Writing SerializeTest object to disk&quot;);
    output  = File.Create(&quot;serialized.xml&quot;);
    SoapFormatter swrite = new SoapFormatter(); 
    swrite.Serialize(output, st); 
    output.Close(); 

    Console.WriteLine(&quot;\n Reading SerializeTest object from disk\n&quot;);
    input  = File.OpenRead(&quot;serialized.xml&quot;);
    SoapFormatter sread = new SoapFormatter(); 
    fromdisk = (SerializeTest)sread.Deserialize(input); 
    input.Close(); 


    /* x will be 0 because it won&#39;t be read from disk since non-serialized */ 
    Console.WriteLine(&quot;After SOAP(XML) Serialization := &quot; + fromdisk);

    
    Console.WriteLine(&quot;\n\nPrinting XML Representation of Object&quot;);

    XmlDocument doc = new XmlDocument(); 
    doc.Load(&quot;serialized.xml&quot;); 
    Console.WriteLine(doc.OuterXml);

    }

}

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
import java.io.*; 

class SerializeTest implements Serializable{

    transient int x; 

    private int y; 

    public SerializeTest(int a, int b){

    x = a; 
    y = b; 

    }

    public String toString(){

    return &quot;{x=&quot; + x + &quot;, y=&quot; + y + &quot;}&quot;; 

    }

    public static void main(String[] args) throws Exception{

    SerializeTest st = new SerializeTest(66, 61); 
    System.out.println(&quot;Before Write := &quot; + st);

    System.out.println(&quot;\n Writing SerializeTest object to disk&quot;);
    FileOutputStream out  = new FileOutputStream(&quot;serialized.txt&quot;);
    ObjectOutputStream so = new ObjectOutputStream(out);    
    so.writeObject(st);
    so.flush();

    System.out.println(&quot;\n Reading SerializeTest object from disk\n&quot;);
    FileInputStream in     = new FileInputStream(&quot;serialized.txt&quot;);
    ObjectInputStream si   = new ObjectInputStream(in); 
    SerializeTest fromdisk = (SerializeTest)si.readObject();

    /* x will be 0 because it won&#39;t be read from disk since transient */ 
    System.out.println(&quot;After Read := &quot; + fromdisk);


    }

}
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;docgen&quot; name=&quot;docgen&quot;&gt;Documentation Generation from Source Code   Comments&lt;/a&gt;&lt;/h3&gt;
Both C# and Java provide a mechanism for extracting specially formatted   comments from source code and placing them in an alternate document. These   comments are typically API specifications and are very useful way to provide   API documentation to the users of a library. The generated documentation is   also useful to share the specifications for an API between designers,   developers and QA.&lt;br /&gt;
Javadoc is the tool used to extract API documentation from source code.   Javadoc generates HTML documentation from the source code comment, an example   of which is the &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://java.sun.com/javase/6/docs/api/&quot;&gt;Java™   Platform, Standard Edition API Documentation&lt;/a&gt; which was all generated using   Javadoc. Javadoc can be used to describe information at the package, class,   member and method level. Descriptions of classes and member variables can be   provided with the option to add references to other classes, class members and   methods.&lt;br /&gt;
Javadoc allows one to document the following metadata about a method:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Description of the method.
&lt;li&gt;Exceptions thrown by the method.
&lt;li&gt;Parameters the method accepts
&lt;li&gt;Return type of the method.
&lt;li&gt;Associated methods and members.
&lt;li&gt;Indication as to whether the API has been deprecated or not.
&lt;li&gt;Version of the API the method was first added. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
The deprecated   information is also used by the compiler which issues a warning if a call to a   method marked with the deprecated tag is encountered during compilation.    &lt;br /&gt;&lt;br /&gt;Javadoc also provides the following information automatically:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Inherited API
&lt;li&gt;List of derived classes
&lt;li&gt;List of implementing classes for interfaces
&lt;li&gt;Serialized form of the class
&lt;li&gt;Alphabetical class listing.
&lt;li&gt;Package hierarchy in a tree format. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;&lt;br /&gt;Since Javadoc generates HTML documentation, it is valid to use HTML in   Javadoc comments. There is support for linking the generated documentation   with other generated documentation available over the web. Such linking is   useful when one wants readers of the documentation to be able to read the API   documentation from the related sources. An example of this is the &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/MultiEdit/&quot;&gt;following generated documentation   which contains links&lt;/a&gt; to the Java 2 API documentation. If no such linking   is specified then the &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/qry_mgr_api/&quot;&gt;generated documentation   contains no links to other API documentation&lt;/a&gt;. Below is an example of how   Javadoc comments are used&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;

/**
 * Calculates the square of a number. 
 * @param num the number to calculate. 
 * @return the square of the number. 
 * @exception NumberTooBigException this occurs if the square of the number 
 * is too big to be stored in an int. 
 */
 public static int square(int num) throws NumberTooBigException{}
&lt;/code&gt;
&lt;/pre&gt;
C# uses XML as the format for the documentation. The generated   documentation is an XML file that contains the metadata specified by the user   with very little additional information generated automatically. All the C#   XML documentation tags have an analogous Javadoc construct while the same   cannot be said for the Javadoc tags having C# XML documentation analogs. For   instance, the default C# XML documentation does not have analogs to Javadoc&#39;s    &lt;code&gt;@author&lt;/code&gt;, &lt;code&gt;@version&lt;/code&gt;, or &lt;code&gt;@deprecated&lt;/code&gt; tags   although such metadata can be generated by reflecting on the assembly, as   Microsoft&#39;s documentation build process does. One could also create custom   tags that are analogous to the Javadoc tags and more but they would be ignored   by standard tools used for handling C# XML documentation including Visual   Studio.NET. Also of note is that C#&#39;s XML documentation when generated does   not contain metadata about the class such as listings of inherited API,   derived classes or implementing interfaces. Here is an &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/code.xml&quot;&gt;example of an XML file generated   from C# source code&lt;/a&gt;.&lt;br /&gt;
The primary benefit of an XML format is that the documentation   specification can now be used in many different ways. XSLT stylesheets can   then be used to convert the generated documentation to ASCII text, HTML, or   Postscript files. Also of note is that the generated documentation can be fed   to tools that use it for spec verification or other similar tasks. &lt;span class=&quot;new&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;It should be noted that C# currently does not have a tool analogous   to Javadoc for converting the XML documentation into HTML. Microsoft is in the   process of developing such a tool which is currently codenamed &lt;/span&gt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.sandcastledocs.com/&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;SandCastle&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;.&lt;/span&gt;&lt;/span&gt; &lt;br /&gt;
Below is an example of how C# XML documentation is used.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;

///&lt;summary&gt;Calculates the square of a number.&lt;/summary&gt;
///&lt;param name=&quot;num&quot; /&gt;The number to calculate.
///&lt;return&gt;The square of the number. &lt;/return&gt;
///&lt;exception&gt;NumberTooBigException - this occurs if the square of the number 
///is too big to be stored in an int. &lt;/exception&gt;
 public static int square(int num){}
&lt;/code&gt;&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;multipleclasses&quot; name=&quot;multipleclasses&quot;&gt;Multiple Classes in a Single   File&lt;/a&gt;&lt;/h3&gt;
Multiple classes can be defined in a single file in both languages with   some significant differences. In Java, there can only be one class per source   file that has &lt;code&gt;public&lt;/code&gt; access and it must have the same name as the   source file minus the file extension. C# does not have a restriction on the   number of public classes that can exist in a source file and neither is there   a requirement for the name of any of the classes in the file to match that of   the source file.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;importing&quot; name=&quot;importing&quot;&gt;Importing Libraries&lt;/a&gt;&lt;/h3&gt;
Using libraries in an application is a two-step process. First the needed   libraries must be referenced somewhere in the source file which is done via   the &lt;code&gt;using&lt;/code&gt; keyword in C# and the &lt;code&gt;import&lt;/code&gt; keyword in   Java. Secondly, there must be a way to tell the compiler where to find the   location of the needed library. Specifying the location of libraries that will   be used by a Java program is done using the &lt;code&gt;CLASSPATH&lt;/code&gt; environment   variable or the &lt;code&gt;-classpath&lt;/code&gt; compiler option. Assembly locations   are specified with the &lt;code&gt;/r&lt;/code&gt; compiler switch in C#.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;events&quot; name=&quot;events&quot;&gt;Events&lt;/a&gt;&lt;/h3&gt;
Event-driven programming is a programming model where objects can register   themselves to be notified of a specific occurrence or state change in another   object. Event-driven programming is also referred to as the publish-subscribe   model or the observer design pattern and is very popular in graphical user   interface (GUI) programming. Java and C# both have mechanisms that support   events but there are significant differences. The typical publish-subscribe   model has a one to many relationship between an object (publisher) and its   event handlers (subscribers). A subscriber is registered by invoking a method   on the publisher which then adds the subscriber to an internal collection of   interested objects. When the state change that a registered subscriber is   interested in occurs, a method is invoked in the publisher that cycles through   the collection of subscribers and invokes a callback method on each one.&lt;br /&gt;
There is no general mechanism for event handling in Java. Instead there are   design patterns that are used by the GUI classes which developers can take   their cue from. An event is typically a subclass of the    &lt;code&gt;java.util.EventObject&lt;/code&gt; class, which has methods that enable   setting or getting of the object that was the source of the event. A   subscriber in the Java model usually implements an interface that ends with   the word Listener (e.g. MouseListener, ActionListener, KeyListener, etc) which   should contain a callback method that would be called by the publisher on the   occurrence of the event. The publisher typically has a method that begins with   add and ends with Listener (e.g. addMouseListener, addActionListener,   addKeyListener, etc) which is used to register subscribers. The publisher also   has remove methods for unregistering the subscribers. The aforementioned   components are the primary entities in an event-driven Java program.&lt;br /&gt;
C# uses &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#delegates&quot;&gt;delegates&lt;/a&gt; to   provide an explicit mechanism for creating a publish-subscribe model. An event   is typically a subclass of the &lt;code&gt;System.EventArgs&lt;/code&gt; class. Like all   data classes, the event class should have a constructor that allows complete   initialization without calling any other methods so that you can pass new   YourEventArgs(inits) to the subscriber delegate. The publisher has a protected   method preceded with the word &quot;On&quot; (e.g. OnClick, OnClose, OnInit, etc) which   is invoked when a specified event occurs, this method would then invoke the   delegate passing it the source and an instance of the EventArgs object. Making   the method protected allows derived classes to call it directly without the   need to register a delegate. The subscriber is a method that accepts the same   argument and returns the same type as the event delegate. The event delegate   usually returns &lt;code&gt;void&lt;/code&gt; and accepts two parameters; an Object which   should be the source of the event and the EventArgs subclass which should   represent the event that occured.&lt;br /&gt;
In C#, the &lt;code&gt;event&lt;/code&gt; is used to automatically specify that a field   within a subscriber is a delegate that will be used as a callback during an   event-driven situation. During compilation the compiler adds overloaded   versions of the &lt;code&gt;+=&lt;/code&gt; and &lt;code&gt;-=&lt;/code&gt; operators that are   analogous to the add and remove methods that are used in Java to register and   unregister a subscriber.&lt;br /&gt;
The example below shows a class that generates 20 random numbers and fires   an event whenever one of the numbers is even.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System; 

class EvenNumberEvent: EventArgs{

    /* HACK: fields are typically private, but making this internal so it
     * can be accessed from other classes. In practice should use properties.
     */ 
    internal int number; 

    public EvenNumberEvent(int number):base(){

    this.number = number;
    }

}

class Publisher{

    public delegate void EvenNumberSeenHandler(object sender, EventArgs e); 
    
    public event EvenNumberSeenHandler EvenNumHandler; 
    
    protected void OnEvenNumberSeen(int num){

    if(EvenNumHandler!= null)
        EvenNumHandler(this, new EvenNumberEvent(num));
    }
    

    //generates 20 random numbers between 1 and 20 then causes and 
    //event to occur if the current number is even. 
    public void RunNumbers(){
    
    Random r = new Random((int) DateTime.Now.Ticks); 

    for(int i=0; i &amp;lt; 20; i++){     
        int current = (int) r.Next(20); 

        Console.WriteLine(&quot;Current number is:&quot; + current);

        //check if number is even and if so initiate callback call
        if((current % 2) == 0)
        OnEvenNumberSeen(current);

    }//for
    
    }
    

}//Publisher


public class EventTest{

    //callback function that will be called when even number is seen
    public static void EventHandler(object sender, EventArgs e){

    Console.WriteLine(&quot;\t\tEven Number Seen:&quot; + ((EvenNumberEvent)e).number);
    
    }


    public static void Main(string[] args){

    Publisher pub = new Publisher(); 
    
    //register the callback/subscriber 
    pub.EvenNumHandler += new Publisher.EvenNumberSeenHandler(EventHandler); 
    
    pub.RunNumbers(); 

    //unregister the callback/subscriber 
    pub.EvenNumHandler -= new Publisher.EvenNumberSeenHandler(EventHandler); 
    
    }

}

&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
import java.util.*;

class EvenNumberEvent extends EventObject{

    public int number; 

    public EvenNumberEvent(Object source, int number){
    
    super(source); 
    this.number = number;
    }

}

interface EvenNumberSeenListener{

    void evenNumberSeen(EvenNumberEvent ene); 

}

class Publisher{

    Vector subscribers = new Vector(); 
    

    private void OnEvenNumberSeen(int num){

    for(int i=0, size = subscribers.size(); i &amp;lt; size; i++)
        ((EvenNumberSeenListener)subscribers.get(i)).evenNumberSeen(new EvenNumberEvent(this, num));
    }
    

    public void addEvenNumberEventListener(EvenNumberSeenListener ensl){

    subscribers.add(ensl); 

    }

     public void removeEvenNumberEventListener(EvenNumberSeenListener ensl){

    subscribers.remove(ensl); 
    }

    //generates 20 random numbers between 1 and 20 then causes and 
    //event to occur if the current number is even. 
    public void RunNumbers(){
    
    Random r = new Random(System.currentTimeMillis()); 

    for(int i=0; i &amp;lt; 20; i++){     
        int current = (int) r.nextInt() % 20; 

        System.out.println(&quot;Current number is:&quot; + current);

        //check if number is even and if so initiate callback call
        if((current % 2) == 0)
        OnEvenNumberSeen(current);

    }//for
    
    }
    

}//Publisher


public class EventTest implements EvenNumberSeenListener{

    //callback function that will be called when even number is seen
    public void evenNumberSeen(EvenNumberEvent e){

    System.out.println(&quot;\t\tEven Number Seen:&quot; + ((EvenNumberEvent)e).number);
    
    }


    public static void main(String[] args){

    EventTest et = new EventTest();

    Publisher pub = new Publisher(); 
    
    //register the callback/subscriber 
    pub.addEvenNumberEventListener(et); 
    
    pub.RunNumbers(); 

    //unregister the callback/subscriber 
    pub.removeEvenNumberEventListener(et); 
    
    }

}

&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;interop&quot; name=&quot;interop&quot;&gt;Cross Language Interoperability&lt;/a&gt;&lt;/h3&gt;
Cross language interoperability is the ability to access constructs written   in one programming language from another. There are a number of ways cross   language interoperability works in Java. First of all, there is the Java   Native Interface (JNI) which is a mechanism that allows Java programs call   native methods written in C, C++ or assembly language. The C, C++ or assembly   methods methods must be specifically written to be called from Java. Native   methods can use JNI to access Java features such as calling Java language   methods, instantiating and modifying Java classes, throwing and catching   exceptions, performing runtime type checking, and loading Java classes   dynamically. To create a JNI program one performs the following steps:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Create a Java program that contains the declaration of the native     method(s) marked with the &lt;code&gt;native&lt;/code&gt; keyword.
&lt;li&gt;Write a main method that loads the library created in step 6 and uses     the native method(s).
&lt;li&gt;Compile the class containing the declaration of the native method(s) and     the main with the &lt;code&gt;javac&lt;/code&gt; compiler.
&lt;li&gt;Use the &lt;code&gt;javah&lt;/code&gt; compiler with the &lt;code&gt;-jni&lt;/code&gt; compiler     option to generate a header file for the native method(s).
&lt;li&gt;Write the native method in your language of choice (currently C, C++ or     assembly).
&lt;li&gt;Compile the header file and native source file into a shared library     (i.e. a .dll on Windows or a .so file on UNIX). &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;&lt;br /&gt;Java also has the ability to interact with distributed objects that use the   common object request broker architecture (CORBA) via Java IDL. CORBA is a   technology that allows developers to make procedure calls on objects in a   location and language agnostic manner. A CORBA application usually consists of   an object request broker (ORB), a client and a server. An ORB is responsible   for matching a requesting client to the server that will perform the request,   using an object reference to locate the target object. When the ORB examines   the object reference and checks if the target object is remote or not. If the   target of the call is local then the ORB performs an inter-process   communication (IPC) call. On calls to remote objects the ORB marshals the   arguments and routes the invocation out over the network to the remote   object&#39;s ORB. The remote ORB then invokes the method locally and sends the   results back to the client via the network. CORBA has a language-agnostic   interface definition language (IDL) which for which languages that support   CORBA have various mappings. Java IDL supports the mappings from Java objects   to CORBA IDL objects. Various ORBs support CORBA language bindings for a   number of languages including C, C++, Java, Python, Lisp, Perl, and  Scheme.&lt;br /&gt;
The most seamless way to do cross language interop in Java is when the   language is compiled directly to Java byte code. This means that objects in   that language are available to Java programs and Java objects are available to   programs written in the target language. A good example of this is the &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.jython.org/&quot;&gt;Jython&lt;/a&gt; scripting language which is a version   of the Python programming language that is integrated with the Java platform.   Below is an example of an interactive session with Jython shows how a user   could create an instance of the Java random number class (found in   java.util.Random) and then interact with that instance which was taken from   the &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.jython.org/docs/usejava.html&quot;&gt;Jython   Documentation&lt;/a&gt;&lt;br /&gt;
&lt;pre class=&quot;code&quot;&gt;C:\jython&amp;gt;jython
Jython 2.0 on java1.2.1
Type &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&amp;gt;&amp;gt;&amp;gt; from java.util import Random
&amp;gt;&amp;gt;&amp;gt; r = Random()
&amp;gt;&amp;gt;&amp;gt; r.nextInt()
-790940041
&amp;gt;&amp;gt;&amp;gt; for i in range(5):
...     print r.nextDouble()
...
0.23347681506123852
0.8526595592189546
0.3647833839988137
0.3384865260567278
0.5514469740469587
&amp;gt;&amp;gt;&amp;gt;
&lt;/pre&gt;
There are a number of projects in various degrees of completion that are   aimed at providing a similar degree of cross language interoperability within   the confines of the Java Virtual Machine. A &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://grunge.cs.tu-berlin.de/~tolk/vmlanguages.html&quot;&gt;list of languages   retargetted for the Java Virtual Machine&lt;/a&gt; is available on the webpage of   Dr. Robert Tolksdorf. Currently, Sun Microsystems (creators of the Java   language and platform) seems to be uninterested in this level of cross   language interoperability and has decided to leave this to independent   developers and researchers. &lt;br /&gt;&lt;br /&gt;With seamless cross langauge interoperability, objects can inherit   implementation from other types, instantiate and invoke methods defined on   other types, and otherwise interact with objects regardless of the language   the types are originally implemented in. Also tools such as class browsers,   debuggers, and profilers only need to understand one format (be it Java byte   codes or .NET instruction language) but can support a multitude of languages   as long as they target the appropriate runtime. Also error handling across   languages via exceptions is possible.&lt;br /&gt;
C# and the .NET runtime were created with seamless cross-language   interoperability as a design goal. A language targeting the .NET common   language runtime (CLR) is able to interact with other languages that conform   to the &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguidnf/html/cpconthecommontypesystem.asp&quot;&gt;common   type system&lt;/a&gt; and when compiled include certain &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguidnf/html/cpconmetadataoverview.asp?frame=true&quot;&gt;metadata&lt;/a&gt;.   The common type system defines how types are declared, used, and managed in   the .NET runtime thus creating a framework that allows for type safety and   ensures that objects written in various languages can share type information.   Metadata is binary information describing the &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#assemblies&quot;&gt;assemblies&lt;/a&gt;,   types and &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#attributes&quot;&gt;attributes&lt;/a&gt;   defined in the application that are stored either in a CLR portable executable   (PE) or in memory if the assembly has been loaded. Langauges that are   currently being developed to target the .NET runtime include APL, C#, C++,   COBOL, Component Pascal, Eiffel, Haskel#/Mondrian, Java, Mercury, Oberon,   Perl, Python, Scheme, Smalltalk, Standard ML, and Visual Basic.&lt;br /&gt;
Since it is very possible that certain features in one language have no   analog in another, the .NET Framework provides the &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguidnf/html/cpconwhatiscommonlanguagespecification.asp?frame=true&quot;&gt;Common   Language Specification&lt;/a&gt; (CLS), which describes a fundamental set of   language features and defines rules for how those features are used. The CLS   rules are a subset of the common type system that is aimed at ensuring   cross-language interoperability by defining a set of features that are most   common in programming languages. The C# compiler is a CLS compliant compiler   meaning that it can be used to generate code that complies with the CLS. The   C# compiler can check for CLS compliance and issues an error when a program   code uses functionality that is not supported by the CLS. To get the C#   compiler to check for the CLS compliance of a piece of code, mark it with the    &lt;code&gt;[CLSCompliantAttribute(true)]&lt;/code&gt; attribute.&lt;br /&gt;
Another aspect of cross language interoperability supported by C# is   interaction with COM based objects. There are mechanisms that allow developers   to use COM objects from C# code and vice versa.&lt;br /&gt;
C# objects can utilize COM objects if a wrapper class is first created that   defines the functions available in the COM object as well as some additional   information. The wrapper class can then be used as if it were a regular C#   object while the .NET runtime handles the complexities of marshalling   arguments and the like. Creating the wrapper class can be done automatically   using the &lt;code&gt;tlbimp&lt;/code&gt; utility. If the utility is unable to create a   type library then one must be written by hand with foreknowledge of the   coclasses and interfaces being defined as well as the type library-to-assembly   conversion rules.&lt;br /&gt;
For a COM object to utilize a C# object, a typelib must be created that   describes the C# object to COM aware applications. The &lt;code&gt;tlbexp&lt;/code&gt; can   be used to create a typelib that describes the C# object&#39;s interface in a   COM-like manner. Also the &lt;code&gt;regasm&lt;/code&gt; utility can be used to register   an &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#assemblies&quot;&gt;assembly&lt;/a&gt; so   it is available to COM. When COM objects interact with the C# object, the   runtime handles whatever marshalling of data that needs to occur between COM   and .NET automatically.&lt;br /&gt;
C# programs can also call almost any function in any DLL using a   combination of the &lt;code&gt;extern&lt;/code&gt; keyword and the DllImport attribute on   the method declaration. A major advantage of this is that the method being   called does not have to be specifically written to be called from C#, nor is   any &quot;wrapper&quot; necessary-so calling existing code in DLLs is relatively   simple.&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;different&quot; name=&quot;different&quot;&gt;Now For Something Completely  Different&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;idisposable&quot; name=&quot;idisposable&quot;&gt;Deterministic Object Cleanup&lt;/a&gt;&lt;/h3&gt;
To provide total control of releasing resources used by classes, C#   provides the &lt;code&gt;System.IDisposable&lt;/code&gt; interface which contains the   Dispose() method that can be called by users of the class to release resources   on completion of whatever task is at hand. Classes that manage resources such   as database or file handles benefit from being disposable. Being diposable   provides a deterministic way to release these resources when the class is no   longer in use, which is not the case with finalizers in Java or C#. It is   typical to call the SupressFinalize method of the GC class in the   implementation of the Dispose method since it is likely that finalization by   the runtime won&#39;t be needed since it will be provided explicitly via the   Dispose method. C# also has some syntactic sugar via the &lt;code&gt;using&lt;/code&gt;   keyword that makes releasing the resources used by classes occur in a more   deterministic manner via the Dispose method.&lt;br /&gt;
If a class is disposable, it is best to make usage of the Dispose() method   idempotent (i.e. multiple calls to Dispose() have no ill effects) which can be   done by providing a flag that is checked within the Dispose() method to see if   the class has already been disposed or not. The example below shows a program   where a class keeps a file open up until the Dispose() method is called which   indicates that the file no longer needs to be open.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System; 
using System.IO; 

public class MyClass : IDisposable {     

    bool disposed = false; 
    FileStream f; 
    StreamWriter sw; 
    private String name;
    private int numShowNameCalls = 0; 

    MyClass(string name){
             
        
    f = new FileStream(&quot;logfile.txt&quot;, FileMode.OpenOrCreate); 
    sw = new StreamWriter(f);
    this.name = name;
    Console.WriteLine(&quot;Created &quot; + name);   
    }


    ~MyClass(){

    Dispose(false); 
    }

     public void Dispose(){

    if(!disposed){
        Dispose(true);
    }

    }


    
    private void Dispose(bool disposing){

    lock(this){ /* prevents multiple threads from disposing simultaneously */ 
        
        /* disposing variable is used to indicate if this method was called from a 
         * Dispose() call or during finalization. Since finalization order is not 
         * deterministic, the StreamWriter may be finalized before this object in 
         * which case, calling Close() on it would be inappropriate so we try to 
         * avoid that. 
         */
        if(disposing){     
        Console.WriteLine(&quot;Finalizing &quot; + name);      
        sw.Close(); /* close file since object is done with */ 
        GC.SuppressFinalize(this);
        disposed = true; 
        }
        
    }

    }
    
   
    public string ShowName(){

    if(disposed)            
           throw new ObjectDisposedException(&quot;MyClass&quot;);

    numShowNameCalls++; 
    sw.Write(&quot;ShowName() Call #&quot; + numShowNameCalls.ToString() + &quot;\n&quot;);         
    
        return &quot;I am &quot; + name; 
    
    }

    public static void Main(string[] args){
    

    using (MyClass mc = new MyClass(&quot;A MyClass Object&quot;)){

        for(int i = 0; i &amp;lt; 10; i++){
      
        Console.WriteLine(mc.ShowName()); 
      
        } //for

    }/* runtime calls Dispose on MyClass object once &quot;using&quot; code block is exited, even if exception thrown  */ 
    
    }//Main 

}
&lt;/code&gt;
&lt;/pre&gt;
The above idiom is practically the same as having C++ style destructors   without the worry of having to deal with memory allocation woes, making it the   best of both worlds. The non-deterministic nature of finalization has long   been bemoaned by Java developers, it is a welcome change to see that this will   not be the case when using C#.&lt;br /&gt;&lt;br /&gt;NOTE: Calling the Dispose() method does   not request that the object is garbage collected , although it does speed up   collection by eliminating the need for finalization. .&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;delegates&quot; name=&quot;delegates&quot;&gt;Delegates&lt;/a&gt;&lt;/h3&gt;
Delegates are a mechanism for providing callback functions. Delegates are   akin to function pointers in C or functors in C++ and are useful in the same   kinds of situation. One use of delegates is passing operations to a generic   algorithm based on the types being used in the algorithm. The C function   qsort() is an example of this as are a variety of the C++ functions in   &lt;algorithm&gt; like replace_if() and transform(). Another use of delegates   is as a means to register handlers for a particular event (i.e. the   publish-subscribe model). To get the same functionality as C# delegates in   Java, once can create interfaces that specify the signature of the callback   method such as is done with the Comparable interface although this has the   drawback of forcing the method to be an instance method when it most likely   should be static.&lt;/algorithm&gt;&lt;br /&gt;
To use delegates, one first declares a delegate that has the return type   and accepts the same number of parameters as the methods one will want to   invoke as callback functions. Secondly one needs to define a method that   accepts an instance of the delegate as a parameter. Once this is done, a   method that has the same signature as the delegate (i.e. accepts same   parameters and returns the same type) &lt;span class=&quot;new&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;or has covariant return   types and contravariant parameter types (i.e return type is derived from the   return type of the delegate and the parameter types are ancestors of the   corresponding parameters) &lt;/span&gt;&lt;/span&gt;can be created and used to initialize an   instance of the delegate which can then be passed to the method that accepts   that delegate as a parameter. Note that the same delegate can refer to static   and instance methods, even at the same time, since delegates are multicast.   The example below shows the process of creating and using instance   delegates.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;

/* Mammal class hierarchy used to show return type covariance */
public class Mammal {
    public Mammal(){;}

    public virtual void Speak(){;} 
}

public class Cat : Mammal{
    public Cat(){;}

    public override void Speak(){
	Console.WriteLine(&quot;Meow&quot;);
    }
}

public class Dog : Mammal{
    public Dog(){;}

    public override void Speak(){
	Console.WriteLine(&quot;Woof&quot;);
    } 
}


public class Test {

    // delegate declaration, similar to a function pointer declaration
    public delegate Mammal CallbackFunction(Dog d);  
    
    public static Cat BarkAndScareCat(Dog d) 
    {
	d.Speak(); 
	Cat c = new Cat();
	c.Speak(); 
	return c; 
    }

     public static Mammal BarkAndReturnHome(Dog d) 
    {
	d.Speak(); 
	return d; 
    }
 
    public static void Main(string[] args){
    
    Dog dog            = new Dog(); 

    //create delegate using delegate object (old way)
    CallbackFunction myCallback = new CallbackFunction(BarkAndReturnHome); 
    myCallback(dog);

    //create delegate using delegate inference (new way) 
    CallbackFunction myCallback2 = BarkAndScareCat;
    myCallback2(dog);

    }
} 
&lt;/code&gt;
&lt;/pre&gt;
A delegate can be passed as a parameter to a method in the same way that a   function pointer is passed in languages like C and C++. The following code   sample shows how this is done. &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;

//delegate base
public class HasDelegates
{
       
    // delegate declaration, similar to a function pointer declaration
    public delegate bool CallbackFunction(string a, int b);
        
    //method that uses the delegate 
    public bool execCallback(CallbackFunction doCallback, string x, int y)
    {   
    Console.WriteLine(&quot;Executing Callback function...&quot;);
    return doCallback(x, y);                    
    }

}


public class FunctionDelegates
{
   
    public static readonly HasDelegates.CallbackFunction BarFuncCallback = 
        new HasDelegates.CallbackFunction(FunctionBar); 

    public static bool FunctionBar(string a, int b)
    {   
    Console.WriteLine(&quot;Bar: {0} {1}&quot;, b, a);
    return true;

    }

}

public class DelegateTest {

  
    public static void Main(string[] args){
    
    HasDelegates MyDel = new HasDelegates();

    // with static delegate, no need to know how to create delegate
    MyDel.execCallback(FunctionDelegates.BarFuncCallback, &quot;Thirty Three&quot;, 33);

    }
} // DelegateTest
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;#structs&quot; name=&quot;#structs&quot;&gt;Value Types (Structs)&lt;/a&gt;&lt;/h3&gt;
In both Java and C#, items on the heap have to be garbage collected to   reclaim the memory allocated to them when they are no longer in use while   stack based objects are automatically reclaimed by the system. Memory on the   stack is typically faster to allocate than heap based memory.&lt;br /&gt;
In Java, all classes are created on the heap while primitives are created   on the stack. This can lead to situations where objects that are used   similarly to primitives in a program tend to hang around and wait for garbage   collection thus adding overhead to the program. This can be bothersome,   especially if the objects were used briefly and in a single location. To avoid   the problem of allocating heap space for such classes and then having to   garbage collect them, C# has a mechanism that allows one to specify that   objects of a certain class should be stack based (In fact, C#&#39;s built-in types   such as int are actually implemented as structs in the runtime library).   Unlike classes, value types are always passed by value and are not garbage   collected. And arrays of value types contain the actual value type objects,   not references to dynamically-allocated objects-a savings of both memory and   time.&lt;br /&gt;
To specify stack based classes, one declares them using the keyword    &lt;code&gt;struct&lt;/code&gt; instead of &lt;code&gt;class&lt;/code&gt;. To create C# structs (also   known as value types) one uses the &lt;code&gt;new&lt;/code&gt; keyword to create it as is   done with classes. If the struct is instantiated with the default constructor   syntax then a struct with its fields zeroed out is created. However, it is not   possible to define a default constructor for a struct and override this   behavior.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System; 

struct Point {

    public int x; 
    public int y; 

    public Point( int x, int y){
  
    this.x = x; 
    this.y = y;

    }
  
    public override string ToString(){

    return String.Format(&quot;({0}, {1})&quot;, x, y); 

    }


    public static void Main(string[] args){

    Point start = new Point(5, 9); 
    Console.WriteLine(&quot;Start: &quot; + start);

    /* The line below wouldn&#39;t compile if Point was a class */ 
    Point end = new Point(); 
    Console.WriteLine(&quot;End: &quot; + end);

    }

} // Point
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;as&quot; name=&quot;as&quot;&gt;Run Time Type Identification (as operator)&lt;/a&gt;&lt;/h3&gt;
The C# &lt;code&gt;as&lt;/code&gt; operator is completely analogous to C++&#39;s    &lt;code&gt;dynamic_cast&lt;/code&gt; construct. The semantics of the &lt;code&gt;as&lt;/code&gt;   operator are that it attempts to perform an explict cast to a type and returns    &lt;code&gt;null&lt;/code&gt; if the operation was unsuccessful.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
MyClass mc = o as MyClass; 

if(mc !=  null)      //check if cast successful 
   mc.doStuff(); 

&lt;/code&gt;
&lt;/pre&gt;
NOTE: The &lt;code&gt;as&lt;/code&gt; operator cannot be used to convert to or from   value types.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;properties&quot; name=&quot;properties&quot;&gt;Properties&lt;/a&gt;&lt;/h3&gt;
Properties are a way to abstract away from directly accessing the members   of a class, similar to how accessors (getters) and modifiers (setters) are   used in the Java world. A property is accessed by users of a class as if it   was a field or member variable but in actuality is a method call. Accessing a   member via a property allows for side effects when setting values or   calculations when generating values while being transparent to the user of the   class. Properties thus provide an explicit way to decouple the implementation   of the member access from how it is actually used.&lt;br /&gt;
It is possible to create, read-only, write-only or read-write properties   depending on if the getter and setter are implemented or not. &lt;span class=&quot;new&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;In addition, it is possible to create a property whose getter and   setter have different visibility (e.g. a public getter but a private setter).    &lt;/span&gt;&lt;/span&gt;The example below shows different kinds of properties.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System; 

public class User {


    public User(string name){

    this.name = name;   

    }   

    private string name; 

    //property with public getter and private setter
    public string Name{

    get{
        return name; 
    }   

    private set { 
        name = value; 
    }
    }

    private static int minimum_age = 13;   

    //read-write property for class member, minimum_age
    public static int MinimumAge{
      
      get{
        return minimum_age; 
    }

    set{
      
      if(value &amp;gt; 0 &amp;amp;&amp;amp; value &amp;lt; 100)
        minimum_age = value; 
      else 
        Console.WriteLine(&quot;{0} is an invalid age, so minimum age remains at {1}&quot;, value, minimum_age);

    }
    }

    public static void Main(string[] args){
  
    User newuser = new User(&quot;Bob Hope&quot;); 

    User.MinimumAge = -5; /* prints error to screen since value invalid */ 
    User.MinimumAge = 18; 
    //newuser.Name = &quot;Kevin Nash&quot;; Causes compiler error since Name property is read-only 

    Console.WriteLine(&quot;Minimum Age: &quot; + User.MinimumAge);       
    Console.WriteLine(&quot;Name: {0}&quot;, newuser.Name);
    }
} // User

&lt;/code&gt;
&lt;/pre&gt;
The use of properties as an abstraction away from whether a member access   is a method call or not may fall apart if the property throws an exception.   When this occurs users of the object must then treat operations that look like   member accesses as if they were method calls which can lead to unintuitive   looking code. The example below shows code that sets the values for the fields   of a Clock class that where the setters throw an exception if the value is   invalid.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;

try{

myClock.Hours   = 28;  /* setter throws exception because 28 is an invalid hour value */
myClock.Minutes = 15;
myClock.Seconds = 39;

}catch(InvalidTimeValueException itve){
 
/* figure out which field was invalid and report error */ 

}

&lt;/code&gt;
&lt;/pre&gt;
To avoid situations like the one in the above example it is best that one   avoids throwing exceptions in properties and handle the exceptions that are   thrown by methods used in the property. If throwing an exception is avoidable   in some situations then the documentation for the property must adequately   describe the exceptions that can be thrown and the circumstances that lead to   them being thrown.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;multiarrays&quot; name=&quot;multiarrays&quot;&gt;Multidimensional Arrays&lt;/a&gt;&lt;/h3&gt;
C# makes the distinction between &lt;i&gt;multidimensional&lt;/i&gt; and &lt;i&gt;jagged&lt;/i&gt;   arrays. A multidimensional array is akin to a multidimensional array in C or   C++ that is a contiguous block containing members of the same type. A jagged   array is akin to an array in Java which is an array of arrays, meaning that it   contains references to other arrays which may contain members of the same type   or other arrays depending on how many levels the array has. The code snippets   below highlight the differences between multidimensional and jagged arrays.   The lack of true multidimensional arrays in Java has made it problematic to   use Java in certain aspects of technical computing which has lead to various   efforts to improve this position including &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.research.ibm.com/ninja/#sc99&quot;&gt;research efforts by IBM&lt;/a&gt;   which involved writing their own Array class to get around the shortcomings in   Java arrays.&lt;br /&gt;
The following code snippet emphasizes the differences between using   multidimensional arrays and jagged arrays in C#.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;


public class ArrayTest {

  
    public static void Main(string[] args){

    int[,] multi = { {0, 1}, {2, 3}, {4, 5}, {6, 7} };  

    for(int i=0, size = multi.GetLength(0); i &amp;lt; size; i++){

        for(int j=0, size2 = multi.GetLength(1); j &amp;lt; size2; j++){
        Console.WriteLine(&quot;multi[&quot; + i + &quot;,&quot; + j + &quot;] = &quot; + multi[i,j]);
        }

    }


    int[][] jagged = new int[4][];
    jagged[0] = new int[2]{0, 1};
    jagged[1] = new int[2]{2, 3};
    jagged[2] = new int[2]{4, 5};
    jagged[3] = new int[2]{6, 7};

    for(int i=0, size = jagged.Length; i &amp;lt; size; i++){

        for(int j=0, size2 = jagged[1].Length; j &amp;lt; size2; j++){
        Console.WriteLine(&quot;jagged[&quot; + i + &quot;][&quot; + j + &quot;] = &quot; + jagged[i][j]);
        }

    }
    }

} // ArrayTest
&lt;/code&gt;
&lt;/pre&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;indexers&quot; name=&quot;indexers&quot;&gt;Indexers&lt;/a&gt;&lt;/h3&gt;
An indexer is a special syntax for overloading the &lt;code&gt;[]&lt;/code&gt; operator   for a class. An indexer is useful when a class is a container for another kind   of object. Indexers are flexible in that they support any type, such as   integers or strings, as indexes. It is also possible to create indexers that   allow &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#multidimensionalarrays&quot;&gt;multidimensional   array&lt;/a&gt; syntax where one can mix and match different types as indexes.   Finally, indexers can be overloaded.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;
using System.Collections;

public class IndexerTest: IEnumerable, IEnumerator {

    private Hashtable list; 

    public IndexerTest (){

    index = -1; 
    list = new Hashtable();     
    }

    //indexer that indexes by number
    public object this[int column]{


    get{
    
        return list[column];
    
    }


    set{
      
        list[column] = value; 
    }

    }


    /* indexer that indexes by name */ 
    public object this[string name]{


    get{
    
        return this[ConvertToInt(name)];
    
    }

    set{
        this[ConvertToInt(name)] = value; 
    }

    }


    /* Convert strings to integer equivalents */
    private int ConvertToInt(string value){

    string loVal = value.ToLower(); 

    switch(loVal){
        
    case &quot;zero&quot;: return 0;
    case &quot;one&quot;: return 1;
    case &quot;two&quot;: return 2;
    case &quot;three&quot;:  return 3;
    case &quot;four&quot;: return 4;
    case &quot;five&quot;: return 5; 

    default:
        return 0; 
    }

    return 0; 

    }


    /** 
     * Needed to implement IEnumerable interface. 
     */
    public IEnumerator GetEnumerator(){ return (IEnumerator) this; }


    /** 
     * Needed for IEnumerator. 
     */ 
    private int index; 

    /** 
     * Needed for IEnumerator. 
     */ 
    public bool MoveNext(){

    index++;
    if(index &amp;gt;= list.Count)
        return false; 
    else
        return true; 
    }

    /** 
     * Needed for IEnumerator. 
     */ 
    public void Reset(){
    index = -1; 
    }


    /** 
     * Needed for IEnumerator. 
     */ 
    public object Current{

    get{
        return list[index];
    }
    }


    public static void Main(string[] args){

    IndexerTest it = new IndexerTest(); 
    it[0] = &quot;A&quot;; 
    it[1] = &quot;B&quot;;
    it[2] = &quot;C&quot;;
    it[3] = &quot;D&quot;; 
    it[4] = &quot;E&quot;;


    Console.WriteLine(&quot;Integer Indexing: it[0] = &quot; + it[0]);    
    Console.WriteLine(&quot;String  Indexing: it[\&quot;Three\&quot;] = &quot; + it[&quot;Three&quot;]);

    Console.WriteLine(&quot;Printing entire contents of object via enumerating through indexer :&quot;);

    foreach( string str in it){
        Console.WriteLine(str);
    }

    }

} // IndexerTest
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;preprocessor&quot; name=&quot;preprocessor&quot;&gt;Preprocessor Directives&lt;/a&gt;&lt;/h3&gt;
C# includes a preprocessor that has a limited subset of the functionality   of the C/C++ preprocessor. The C# preprocessor lacks the ability to    &lt;code&gt;#include&lt;/code&gt; files or perform textual substitutions using    &lt;code&gt;#define&lt;/code&gt;. The primary functionality that remains is the ability to    &lt;code&gt;#define&lt;/code&gt; and &lt;code&gt;#undef&lt;/code&gt; identifiers and also the ability   to select which sections of code to compile based on the validity of certain   expressions via &lt;code&gt;#if&lt;/code&gt;, &lt;code&gt;#elif&lt;/code&gt;, and &lt;code&gt;#else&lt;/code&gt;.   The &lt;code&gt;#error&lt;/code&gt; and &lt;code&gt;#warning&lt;/code&gt; directives cause the errors   or warnings messages following these directives to be printed on compilation.    &lt;span class=&quot;new&quot;&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;The &lt;code&gt;#pragma&lt;/code&gt; directive is used to supress compiler   warning messages.&lt;/span&gt;&lt;/span&gt; Finally, there is the &lt;code&gt;#line&lt;/code&gt; directive   that can be used to specify the source file and line number reported when the   compiler detects errors.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
#define DEBUG /* #define must be first token in file */ 
using System; 

#pragma warning disable 169 /* Disable &#39;field never used&#39; warning */

class PreprocessorTest{

    int unused_field; 

    public static void Main(string[] args){
    
    #if DEBUG
      Console.WriteLine(&quot;DEBUG Mode := On&quot;);
    #else
      Console.WriteLine(&quot;DEBUG Mode := Off&quot;);
    #endif

    }

}
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;aliases&quot; name=&quot;aliases&quot;&gt;Aliases&lt;/a&gt;&lt;/h3&gt;
The &lt;code&gt;using&lt;/code&gt; keyword can be used to alias the fully qualified   name for a type similar to the way &lt;code&gt;typedef&lt;/code&gt; is used in C and C++.   This is useful in creating readable code where the fully qualified name of a   class is needed to resolve namespace conflicts.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using Terminal = System.Console; 

class Test{

     public static void Main(string[] args){

       Terminal.WriteLine(&quot;Terminal.WriteLine is equivalent to System.Console.Writeline&quot;); 

     }

}

&lt;/code&gt;
&lt;/pre&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;reflectionemit&quot; name=&quot;reflectionemit&quot;&gt;Runtime Code Generation&lt;/a&gt;&lt;/h3&gt;
The &lt;code&gt;Reflection.Emit&lt;/code&gt; namespace contains classes that can be   used to generate .NET instruction language (IL) and use it to build classes in   memory at runtime or even write portable executable (PE) files to disk. This   is analagous to a Java library that would allow one to create Java classes at   runtime by generating Java byte codes which could then be written to disks or   loaded and used within the program.&lt;br /&gt;
It is expected that the primary users of the &lt;code&gt;Reflection.Emit&lt;/code&gt;   namespace will be authors of compilers and script engines. For instance, the   regular expression classes in &lt;code&gt;System.Text.RegularExpressions&lt;/code&gt; use   the &lt;code&gt;Reflection.Emit&lt;/code&gt; library to generate a custom matching engine   for each regular expression compiled.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;unsafe&quot; name=&quot;unsafe&quot;&gt;Pointers and Unsafe Code&lt;/a&gt;&lt;/h3&gt;
Although core C# is like Java in that there is no access to a pointer type   that is analogous to pointer types in C and C++, it is possible to have   pointer types if the C# code is executing in an &lt;code&gt;unsafe&lt;/code&gt; context.   When C# code is executing in an unsafe context, a lot of runtime checking is   disabled which means that the program must have full trust on the machine it   is running on.&lt;br /&gt;
Certain situations call for the use of unsafe code such as when interfacing   with the underlying operating system, during interactions with COM objects   that take structures that contain pointers, when accessing a memory-mapped   device or in situations where performance is critical. The syntax and   semantics for writing unsafe code is similar to the syntax and semantics for   using pointers in C and C++. To write unsafe code, the &lt;code&gt;unsafe&lt;/code&gt;   keyword must be used to specify the code block as unsafe and the program must   be compiled with the &lt;code&gt;/unsafe&lt;/code&gt; compiler switch.&lt;br /&gt;
Since garbage collection may relocate managed (i.e. safe) variables during   the execution of a program, the &lt;code&gt;fixed&lt;/code&gt; keyword is provided so that   the address of a managed variable is pinned during the execution of the parts   of the program within the &lt;code&gt;fixed&lt;/code&gt; block. Without the    &lt;code&gt;fixed&lt;/code&gt; keyword there would be little purpose in being able to   assign a pointer to the address of a managed variable since the runtime may   move the variable from that address as part of the mark &amp;amp; compact garbage   collection process.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System; 

class UnsafeTest{


    public static unsafe void Swap(int* a, int*b){

    int temp = *a; 
    *a = *b; 
    *b = temp; 
    }


    public static unsafe void Sort(int* array, int size){

    for(int i= 0; i &amp;lt; size - 1; i++)
        for(int j = i + 1; j &amp;lt; size; j++)
        if(array[i] &amp;gt; array[j])
            Swap(&amp;amp;array[i], &amp;amp;array[j]); 

    }

    public static unsafe void Main(string[] args){

    int[] array = {9, 1, 3, 6, 11, 99, 37, 17, 0, 12}; 

    Console.WriteLine(&quot;Unsorted Array:&quot;); 
    
    foreach(int x in array)
        Console.Write(x + &quot; &quot;); 

    fixed( int* iptr = array ){  // must use fixed to get address of array

        Sort(iptr, array.Length);
        
    }//fixed 
    
    Console.WriteLine(&quot;\nSorted Array:&quot;); 
    
    foreach(int x in array)
        Console.Write(x + &quot; &quot;); 

    }

}

&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;passbyref&quot; name=&quot;passbyref&quot;&gt;Pass by Reference&lt;/a&gt;&lt;/h3&gt;
In Java the arguments to a method are passed by value meaning that a method   operates on copies of the items passed to it instead of on the actual items.   In C#, as in C++ and in a sense C, it is possible to specify that the   arguments to a method actually be references to the items being passed to the   method instead of copies. This feature is particularly useful when one wants   to create a method that returns more than one object. In Java trying to return   multiple values from a method is not supported and leads to interesting   anomalies like the fact that a method that swaps two numbers which has been   the hallmark of freshman computer science classes for years is impossible to   do in Java without resorting to coding tricks.&lt;br /&gt;
The C# keywords used to specify that a parameter is being passed by   reference are &lt;code&gt;ref&lt;/code&gt; and &lt;code&gt;out&lt;/code&gt;. The difference between   the keywords is that parameters passed using &lt;code&gt;ref&lt;/code&gt; must be   initialized to some value while those passed using &lt;code&gt;out&lt;/code&gt; do not   have to be.&lt;br /&gt;
A more detailed explanation of Java&#39;s lack of Pass By Reference semantics   is available in the Javaworld article, &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.javaworld.com/javaworld/javaqa/2000-05/03-qa-0526-pass.html&quot;&gt;Does   Java pass by reference or pass by value? Why can&#39;t you swap in Java? &lt;/a&gt;by   Tony Sintes &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
class PassByRefTest{

    public static void changeMe(String s){

    s = &quot;Changed&quot;; 

    }

    public static void swap(int x, int y){

    int z = x;
    x = y;
    y = z;

    }

    public static void main(String[] args){

    int a = 5, b = 10; 
    String s = &quot;Unchanged&quot;; 

    swap(a, b); 
    changeMe(s); 

    System.out.println(&quot;a := &quot; + a + &quot;, b := &quot; + b + &quot;, s = &quot; + s);
    }
}

&lt;b&gt;OUTPUT&lt;/b&gt;
a := 5, b := 10, s = Unchanged

&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;

using System; 

class PassByRefTest{

    public static void ChangeMe(out string s){

    s = &quot;Changed&quot;; 

    }

    public static void Swap(ref int x, ref int y){

    int z = x;
    x = y;
    y = z;

    }

    public static void Main(string[] args){

    int a = 5, b = 10; 
    string s; 

    Swap(ref a, ref b); 
    ChangeMe(out s); 

    Console.WriteLine(&quot;a := &quot; + a + &quot;, b := &quot; + b + &quot;, s = &quot; + s);
    }
}

&lt;b&gt;OUTPUT&lt;/b&gt;
a := 10, b := 5, s = Changed
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;verbatim&quot; name=&quot;verbatim&quot;&gt;Verbatim Strings&lt;/a&gt;&lt;/h3&gt;
C# provides the ability to avoid the usage of escape sequences within   string constants and instead declare strings literally. Thus backslashes,   tabs, quotes and newlines can be part of a string without using escape   sequences. The only caveat is that double quotes that appear within verbatim   strings should be doubled. Verbatim strings are specified by prepending the    &lt;code&gt;@&lt;/code&gt; symbol to string declarations.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System; 

class VerbatimTest{

    public static void Main(){

    //verbatim string 
    string filename  = @&quot;C:\My Documents\My Files\File.html&quot;; 
    
    Console.WriteLine(&quot;Filename 1: &quot; + filename);

    //regular string 
    string filename2 =  &quot;C:\\My Documents\\My Files\\File.html&quot;; 

    Console.WriteLine(&quot;Filename 2: &quot; + filename2);

    string snl_celebrity_jeopardy_skit = @&quot;
        Darrell Hammond (Sean Connery) : I&#39;ll take &quot;&quot;Swords&quot;&quot; for $400
        Will Farrell    (Alex Trebek)  : That&#39;s S-Words, Mr Connery.
        &quot;;

    Console.WriteLine(snl_celebrity_jeopardy_skit);

    }

}
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;overflow&quot; name=&quot;overflow&quot;&gt;Overflow Detection&lt;/a&gt;&lt;/h3&gt;
C# provides the option to explicitly detect or ignore overflow conditions   in expressions and type conversions. Overflow conditions detected in code   throw a &lt;code&gt;System.OverFlowException&lt;/code&gt;. Since overflow detection causes   a performance hit it can be explicitly enabled by using the    &lt;code&gt;/checked+&lt;/code&gt; compiler option. One can also mandate code that must   always be checked for overflow conditions by placing it in a    &lt;code&gt;checked&lt;/code&gt; block or that must always be ignored with regards to   overflow detection by placing it in an &lt;code&gt;unchecked&lt;/code&gt; block.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System; 

class CheckedTest{


    public static void Main(){

    int num = 5000; 

    /* OVERFLOW I */
    byte a  = (byte) num; /* overflow detected only if /checked compiler option on */

    /* OVERFLOW II */
    checked{
                
        byte b = (byte) num; /* overflow ALWAYS detected */     
    }

    /* OVERFLOW III */
    unchecked{
                
        byte c = (byte) num; /* overflow NEVER detected */      
    }

    }//Main
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;explicitinterface&quot; name=&quot;explicitinterface&quot;&gt;Explicit Interface   Implementation&lt;/a&gt;&lt;/h3&gt;
Sometimes when a class implements an interface it is possible for there to   be namespace collisions with regards to method names. For instance, a   FileRepresentation class which has a graphical user interface may implement an   IWindow and an IFileHandler interface. Both of these classes may have a Close   method where in the case of IWindow it means to close the GUI window while in   the case of IFileHandler it means to close the file. In Java, there is no   solution to this problem besides writing one Close method that does the same   thing when invoked via an IWindow handle or an IFileHandler handle. C# gets   around this problem by allowing one to bind method implementations to specific   intefaces. Thus in the aformentioned example, the FileRepresentation class   would have different Close methods that would be invoked depending on whether   the class was being treated as an IWindow or an IFileHandler.&lt;br /&gt;
NOTE: Explicit interface methods are private and can only be accessed if   the object is cast to the required type before invoking the method.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;

interface IVehicle{
    
    //identify vehicle by model, make, year
    void IdentifySelf();    

}

interface IRobot{

    //identify robot by name
    void IdentifySelf();

}

class TransformingRobot : IRobot, IVehicle{

    string model; 
    string make;
    short  year; 
    string name;
    

    TransformingRobot(String name, String model, String make, short year){

    this.name  = name;
    this.model = model; 
    this.make  = make; 
    this.year  = year; 

    }

    
    void IRobot.IdentifySelf(){

    Console.WriteLine(&quot;My name is &quot; + this.name);
    }

    void IVehicle.IdentifySelf(){

    Console.WriteLine(&quot;Model:&quot; + this.model + &quot; Make:&quot; + this.make + &quot; Year:&quot; + this.year);
    }


    public static void Main(){

    TransformingRobot tr = new TransformingRobot(&quot;SedanBot&quot;, &quot;Toyota&quot;, &quot;Corolla&quot;, 2001); 

    // tr.IdentifySelf(); ERROR 

    IVehicle v = (IVehicle) tr; 

    IRobot r   = (IRobot) tr; 

    v.IdentifySelf(); 
    
    r.IdentifySelf();   
   
   }
}

&lt;b&gt;OUTPUT&lt;/b&gt;
Model:Toyota Make:Corolla Year:2001
My name is SedanBot
&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;friends&quot; name=&quot;friends&quot;&gt;Friend Assemblies&lt;/a&gt;&lt;/h3&gt;
The friend assembly feature allows an internal type or internal member of   an assembly to be accessed from another assembly. To give one assembly access   to another assembly&#39;s internal types and members, the    &lt;code&gt;[InternalsVisibleToAttribute]&lt;/code&gt; attribute is used. &lt;br /&gt;
The following code sample shows 2 source files which are compiled into   friend_assembly_test.dll and friend_assembly_test_2.exe which utilize the   friend&#39;s assembly feature &lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
// friend_assembly_test.cs
// compile with: /target:library
using System.Runtime.CompilerServices;
using System;

[assembly:InternalsVisibleTo(&quot;friend_assembly_test_2&quot;)]

// internal by default
class Friend 
{
    public void Hello() 
    {
        Console.WriteLine(&quot;Hello World!&quot;);
    }
}

// public type with internal member
public class Friend2 
{
 internal string secret = &quot;I like jelly doughnuts&quot;;  
}

&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code 2&lt;/span&gt;&lt;/b&gt;
// friend_assembliy_test_2.cs
// compile with: /reference:friend_assembly_test.dll /out:friend_assembly_test_2.exe
using System;

public class FriendFinder 
{
    static void Main() 
    {
        // access an internal type
        Friend f = new Friend();
        f.Hello();

        Friend2 f2 = new Friend2();
        // access an internal member of a public type
        Console.WriteLine(f2.secret);
    }
}

&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;globalnamespace&quot; name=&quot;globalnamespace&quot;&gt;The Namespace  Qualifier&lt;/a&gt;&lt;/h3&gt;
The larger a project gets, the more likely it is that namespace collisions   will occur. C# has the &lt;code&gt;::&lt;/code&gt; operator which is used for specifying   at what scope a namespace should be resolved. The left operand indicates the   scope at which to resolve the name while the right operand is the name to   resolve. The left operand can either be the keyword &lt;code&gt;global&lt;/code&gt; which   refers to the global scope or a namespace alias as shown below. &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;
using sys = System; 

namespace TestLib{

class Test{

 public class System {} 

 static DateTime Console = DateTime.Now;   

    public static void Main(){
    //Console.WriteLine(&quot;Hello world&quot;); doesn&#39;t work due to static member variable named &#39;Console&#39;
    //System.Console.WriteLine(&quot;Hello world&quot;); doesn&#39;t work due to nested class named &#39;System&#39;
        
    global::System.Console.WriteLine(&quot;The time is &quot; + Console); 

    sys::Console.WriteLine(&quot;Hello again&quot;); 
    }
 }
}
&lt;/code&gt;&lt;/pre&gt;
NOTE: The &lt;code&gt;extern alias&lt;/code&gt; statement can be used to attach an   alias to an assembly which can then be used as the left operand of the    &lt;code&gt;::&lt;/code&gt; operator. When this is done the scope used for name resolution   is the top level namespace(s) within the assembly. &lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;iterators&quot; name=&quot;iterators&quot;&gt;Iterators (Continuations)&lt;/a&gt;&lt;/h3&gt;
For a data structure to support being a target of the &lt;code&gt;foreach&lt;/code&gt;   loop it must implement or return an instance of    &lt;code&gt;System.Collections.IEnumerable&lt;/code&gt;. However writing an Enumerator can   be somewhat cumbersome which is where the &lt;code&gt;yield&lt;/code&gt; keyword comes in.   The &lt;code&gt;yield&lt;/code&gt; keyword enables one to convert any method or property   into an iterator. In an iterator, one simply traverses the data structure and   returns its contents one by one using the &lt;code&gt;yield return&lt;/code&gt; statement   and indicates the end of the sequence of values with the &lt;code&gt;yield   break&lt;/code&gt; statement. The method or property must return one of IEnumerable,   IEnumerable&lt;t&gt;, IEnumerator or IEnumerator&lt;t&gt;. &lt;/t&gt;&lt;/t&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;
using System.Collections;

class Test{

 public static string[] fruit = {&quot;banana&quot;, &quot;apple&quot;, &quot;orange&quot;, &quot;pear&quot;, &quot;grape&quot;};
 public static string[] vegetables = {&quot;lettuce&quot;, &quot;cucumber&quot;, &quot;peas&quot;, &quot;carrots&quot;};

 public static IEnumerable FruitAndVeg{
 
  get{
   
   foreach(string f in fruit){
    yield return f; 
   }

   foreach(string v in vegetables){
    yield return v; 
   }

   yield break; //optional
  }
 
 }

 public static void Main(){
 
   foreach (string produce in Test.FruitAndVeg){
     Console.WriteLine(produce);
   }
 }

}
&lt;/code&gt;&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;partial&quot; name=&quot;partial&quot;&gt;Partial Types&lt;/a&gt;&lt;/h3&gt;
The partial types feature   enables one to define a single class, struct or interface across multiple   source files. This is particularly useful when dealing with automatically   generated code. Prior to the existence of this feature,it was problematic to   make changes to a class that contained automatically generated code because   any change that required regeneration of the code could alter or remove parts   of the code written by hand. With this feature the automatically generated   parts of a class can live in one source file while the user generated parts of   the class can live in another. This makes it less likely that changes to one   will affect the other negatively and vice versa.    &lt;br /&gt;
A partial class is specified by prefixing the keyword &lt;code&gt;partial&lt;/code&gt;   to the class declaration. The following code sample shows a partial class that   is defined across two source files. Note how methods and properties from one   source file can reference members defined in another. &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;

partial class Test{

 public static string[] fruit = {&quot;banana&quot;, &quot;apple&quot;, &quot;orange&quot;, &quot;pear&quot;, &quot;grape&quot;};
 public static string[] vegetables = {&quot;lettuce&quot;, &quot;cucumber&quot;, &quot;peas&quot;, &quot;carrots&quot;};
 
 public static void Main(){
 
   foreach (string produce in Test.FruitAndVeg){
     Console.WriteLine(produce);
   }
 }

}
&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code 2&lt;/span&gt;&lt;/b&gt;
using System;
using System.Collections; 

partial class Test{

 public static IEnumerable FruitAndVeg{
 
  get{
   foreach(string f in fruit){
    yield return f; 
   }
   foreach(string v in vegetables){
    yield return v; 
   }
  }
 
 }
&lt;/code&gt;&lt;/pre&gt;
It should be noted that all of the class attributes are merged across all   definitions of a class. This means that contradictory attributes (e.g. class   declared as &lt;code&gt;private&lt;/code&gt; in one file and &lt;code&gt;public&lt;/code&gt; in   another) are disallowed. &lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;staticclasses&quot; name=&quot;staticclasses&quot;&gt;Static Classes&lt;/a&gt;&lt;/h3&gt;
A static class is a class that has no instance members, no instance   constructors and cannot be used as a base class. A static class should be used   to define types for which instances don&#39;t make sense such as the    &lt;code&gt;System.Environment&lt;/code&gt; and &lt;code&gt;System.Math&lt;/code&gt; classes. &lt;br /&gt;
A static class is specified by prefixing the class declaration with the   keyword &lt;code&gt;static&lt;/code&gt;. &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;

public static class StaticClass{

 public static void HelloWorld(){
   Console.WriteLine(&quot;Hello World&quot;);
 } 

}

public class Test{

 public static void Main(string[] args){
 StaticClass.HelloWorld(); 
 }

}
&lt;/code&gt;&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;nullable&quot; name=&quot;nullable&quot;&gt;Nullable Types&lt;/a&gt;&lt;/h3&gt;
A nullable types is an instance of the &lt;code&gt;System.Nullable&lt;/code&gt; type. A   nullable type can represent the normal range of values for an underlying value   type as well as the &lt;code&gt;null&lt;/code&gt; value. For example, the type    &lt;code&gt;Nullable&lt;bool&gt;&lt;/bool&gt;&lt;/code&gt; can represent the values &lt;code&gt;true&lt;/code&gt;,    &lt;code&gt;false&lt;/code&gt; and &lt;code&gt;null&lt;/code&gt;. A nullable type can be declared by   appending the operator &#39;?&#39; to the name of a value type when declaring the   variable. This means that &lt;code&gt;bool?&lt;/code&gt; is equivalent to    &lt;code&gt;Nullable&lt;bool&gt;&lt;/bool&gt;&lt;/code&gt;. Each nullable type has a boolean HasValue   property which indicates whether it represents a valid value type or the value    &lt;code&gt;null&lt;/code&gt;. The actual value of the nullable type is stored in its   Value property. There is also the GetValueOrDefault() method which either   returns the value of the nullable type or the default value of the underlying   value type if it is &lt;code&gt;null&lt;/code&gt;. &lt;br /&gt;
Nullable types are particularly useful when mapping C# objects to   relational database schemas since &lt;code&gt;null&lt;/code&gt; is a valid value for all   data types in SQL databases. &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;

public class Test{

 public static void Main(string[] args){

  int? x = 5; 
 
  if(x.HasValue){
   Console.WriteLine(&quot;The value of x is &quot; + x.Value);
  }

  x = null; 

  //prints 0 
  Console.WriteLine(x.GetValueOrDefault());
 }

}
&lt;/code&gt;&lt;/pre&gt;
The &lt;code&gt;??&lt;/code&gt; operator is called the &lt;i&gt;null coalescing operator&lt;/i&gt;   and is used for testing the value of a nullable type and returning its value   or an alternate if its value is null. Thus &lt;code&gt;x ?? y&lt;/code&gt; is equivalent   to &lt;code&gt;x == (null ? y : x)&lt;/code&gt;. &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;

public class Test{

 public static void Main(string[] args){

  int? x = null; 
  int  y = x ?? 5;

  //prints 5 
  Console.WriteLine(y);
 }

}
&lt;/code&gt;&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;anonymousmethods&quot; name=&quot;anonymousmethods&quot;&gt;Anonymous Methods&lt;/a&gt; &lt;/h3&gt;
Anonymous methods are a companion feature to &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#delegates&quot;&gt;delegates&lt;/a&gt;.   An anonymous method is a code block that can be used where a delegate method   is expected. This simplifies code that uses delegates by not requiring a   separate method to implement the delegate&#39;s functionality. The following code   sample compares the anonymous method approach to using a named delegate&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;
using System;

public class Test {

    // delegate declaration, similar to a function pointer declaration
    public delegate void CallbackFunction(string a, int b);
  
    public static void PrintString(string a, int b){
      for(int i = 0; i &amp;lt; b ; i++)
	Console.WriteLine(&quot;{0}.) {1}&quot;, i + 1, a);
    }

    public static void Main(string[] args){
    
    /* anonymous code block */
    CallbackFunction cf = delegate (string a, int b){ 
                             for(int i = 0; i &amp;lt; b ; i++)
                               Console.WriteLine(&quot;{0}.) {1}&quot;, i + 1, a);
                          };

    cf(&quot;Thirty Three&quot;, 10); 


    /* using a named delegate function */
    CallbackFunction cf2 = new CallbackFunction(Test.PrintString); 
    cf2(&quot;Twenty Two&quot;, 5); 
    }
}
&lt;/code&gt;&lt;/pre&gt;
There are a number of restrictions to anonymous methods that must be kept   in mind. For one, jump statements like &lt;code&gt;break&lt;/code&gt;, &lt;code&gt;goto&lt;/code&gt;   and &lt;code&gt;continue&lt;/code&gt; cannot be used o jump into an anonymous method from   outside the code block or vice versa. Also anonymous methods cannot refer to    &lt;code&gt;ref&lt;/code&gt; or &lt;code&gt;out&lt;/code&gt; parameters that are defined outside the   scope of the method. &lt;br /&gt;
&lt;br /&gt;&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;wishlist&quot; name=&quot;wishlist&quot;&gt;Wish You Were Here&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;checked&quot; name=&quot;checked&quot;&gt;Checked Exceptions&lt;/a&gt;&lt;/h3&gt;
Before the advent of exceptions, most error handling was done via return   codes. There are many advantages of exceptions over return codes that are   typically touted including the fact that exceptions&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;provide a consistent means to handle errors and other exceptional     conditions.
&lt;li&gt;enable an error to propagate up the call stack if not handled in the     current context.
&lt;li&gt;allow developers to seperate error handling code from general     application logic. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
Java creates an additional wrinkle by possessing both checked and unchecked   exceptions. Checked exceptions are exceptions that the calling method must   handle either by catching the exception or declaring that the exception should   be handled by its calling method via the &lt;code&gt;throws&lt;/code&gt; clause. On the   other hand, unchecked exceptions (also called runtime exceptions) do not have   to be caught or declared in the &lt;code&gt;throws&lt;/code&gt; clause. In a sense   unchecked exceptions are similar to return codes in that they can be ignored   without warnings or errors being issued by the compiler. Although if an   exception is ignored at runtime, your program will terminate.&lt;br /&gt;
Checked exceptions are typically used to indicate to a calling method that   the callee failed in its task as well as pass information as to how and why it   failed. One must either catch a checked exception or declare it in the    &lt;code&gt;throws&lt;/code&gt; clause of the method or the Java compiler will issue an   error. The reasoning behind the fact that the exception must be declared in   the &lt;code&gt;throws&lt;/code&gt; clause is that handling whatever errors that can occur   when the method is used is just as important as knowing what parameters it   accepts and the kind of type it returns.&lt;br /&gt;
Unchecked exceptions are typically exceptions that can occur in most parts   of the program and thus the overhead of explicitly checking for them outweighs   their usefulness due to the massive code bloat that would ensue. Examples of   situations that throw unchecked exceptions are accessing a null object   reference, trying to access an out of bounds index of an array or a division   by zero. In all of the aforementioned cases it would be cumbersome to put   try...catch blocks around every the code (for instance a try...catch block   around every object access or every array access) and they are better off as   unchecked exceptions.&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;In C#, all exceptions are unchecked and there is no analog to the    &lt;code&gt;throws&lt;/code&gt; clause. One major side effect of this is that unless the   creator of the API explicitly documents the exceptions thrown then it is not   possible for the users of the API to know what exceptions to catch in their   code leading to unrobust applications that can fail unexpectedly. Thus users   of C# are reliant on the documentation skill of programmers as their primary   error handling mechanism which is a less than optimal situation.&lt;br /&gt;
For instance in the following code snippet, the only way to know what   exceptions can be thrown by the method below is to either have the source code   for all the methods called within it or if the developer of the method   documents all the exceptions thrown by all the methods called within it   (meaning that the developers of those methods must have done the same ad   infinitum).&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;csharpk&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;C# Code&lt;/span&gt;&lt;/b&gt;


public string GetMessageFromServer(string server) 
 {
    //Set up variables and String to write to the server
    Encoding ASCII = Encoding.ASCII;
    string Get = &quot;GET / HTTP/1.1\r\nHost: &quot; + server + 
                 &quot;\r\nConnection: Close\r\n\r\n&quot;;
    Byte[] ByteGet = ASCII.GetBytes(Get);
    Byte[] RecvBytes = new Byte[256];
    String strRetPage = null;
 
    // IPAddress and IPEndPoint represent the endpoint that will
    //   receive the request
    // Get first IPAddress in list return by DNS
    IPAddress hostadd = Dns.Resolve(server).AddressList[0];
    IPEndPoint EPhost = new IPEndPoint(hostadd, 80);
 
    //Create the Socket for sending data over TCP
    Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
       ProtocolType.Tcp );
 
    // Connect to host using IPEndPoint
    s.Connect(EPhost);
    if (!s.Connected)
    {
       strRetPage = &quot;Unable to connect to host&quot;;
       return strRetPage;
    }
 
    // Sent the GET text to the host
    s.Send(ByteGet, ByteGet.Length, 0);
 
    // Receive the page, loop until all bytes are received
    Int32 bytes = s.Receive(RecvBytes, RecvBytes.Length, 0);
    strRetPage = &quot;Default HTML page on &quot; + server + &quot;:\r\n&quot;;
    strRetPage = strRetPage + ASCII.GetString(RecvBytes, 0, bytes);
 
    while (bytes &amp;gt; 0)
    {
       bytes = s.Receive(RecvBytes, RecvBytes.Length, 0);
       strRetPage = strRetPage + ASCII.GetString(RecvBytes, 0, bytes);
    }
 
    return strRetPage;
 }


&lt;/code&gt;
&lt;/pre&gt;
The above code snippet is from the .NET Framework Beta 2 documentation for   the Socket class. Note how there no exceptions caught in the code. If this was   a method in a real application as opposed to a sample, it would be    &lt;b&gt;impossible&lt;/b&gt; for the users of this method to know what exceptions to   catch without access to the source code or without the author of the method   painstakingly checking what exceptions are thrown by every single method   called and then documenting them. Below is the list of exceptions that could   be thrown within the method according to their entries in the Microsoft .NET   framework Beta 2 documentation.&lt;br /&gt;
&lt;table border=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;Method&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Exception(s) thrown&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Encoding.GetBytes&lt;/td&gt;&lt;td&gt;ArgumentNullException&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Dns.Resolve&lt;/td&gt;&lt;td&gt;ArgumentNullException, SocketException&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;IPEndPoint constructor&lt;/td&gt;&lt;td&gt;ArgumentException&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Socket constructor&lt;/td&gt;&lt;td&gt;SocketException&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Socket.Connect&lt;/td&gt;&lt;td&gt;ArgumentNullException, SocketException&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Socket.Receive&lt;/td&gt;&lt;td&gt;ArgumentNullException, SocketException&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;ASCII.GetString&lt;/td&gt;&lt;td&gt;[undocumented as of Beta 2]&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
If the author of the method does not have time to document the exceptions   that may be thrown from this method or happens to leave out an important one,   such as the SocketException in this case, then the users of the method could   have their applications fail unexpectedly without an elegant means of recovery   in place. In the above case, the main exception of interest to users would   probably be the SocketException since the others are all related to the   internal workings of the method and don&#39;t really have anything to do with the   caller and in fact would probably be unchecked exceptions if they existed in   Java. In practice the GetMessageFromServer method would check the validity of   its string parameter and throw ArgumentNException or one of its subclasses   depending the results of the check.&lt;br /&gt;
The rationale for excluding checked exceptions from C# has never been fully   explained by Microsoft but &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://discuss.develop.com/archives/wa.exe?A2=ind0011A&amp;amp;L=DOTNET&amp;amp;P=R32820&quot;&gt;this   message from Eric Gunnerson of the C# team&lt;/a&gt; sheds some light on the   reasoning behind this decision. The primary reason for this choice according   to Gunnerson is that examination of small programs led to the conclusion that   using checked exceptions could both enhance developer productivity and enhance   code quality. On the other hand experience with large software projects   suggested that using checked exceptions decreased productivity with little or   no increase in code quality.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;[updated 12/5/2001]&lt;/b&gt; &lt;i&gt;It should be   noted that there is agreement amongst some Java developers with Eric   Gunnerson&#39;s assertion that checked exceptions have certain disadvantages. Alan   Griffiths wrote an excellent article entitled &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.octopull.demon.co.uk/java/ExceptionalJava.html&quot;&gt;Exceptional   Java&lt;/a&gt; where he notes that checked exceptions lead to breaking   encapsulation, loss of information and information overload. Bruce Eckel,   author of &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.mindview.net/Books/TIJ/&quot;&gt;Thinking In Java&lt;/a&gt;   and &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html&quot;&gt;Thinking In   C++&lt;/a&gt;, also questions the wisdom of checked exceptions in his article   entitled &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.mindview.net/Etc/Discussions/CheckedExceptions&quot;&gt;Does Java   need Checked Exceptions?&lt;/a&gt;.&lt;/i&gt;&lt;br /&gt;
The lack of checked exceptions in C# will be very unsettling for Java   developers and may lead to program designs which are flawed. One only has to   remember the anecdote about how originally a considerable amount of the   exceptions in the Java API were unchecked but upon changing them to checked   exceptions a number of bugs and design flaws were found in the API. Hopefully   this will be remedied in later versions of C# or a third party could develop a   static source code analysis tool such as &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://cplus.about.com/cs/lint/&quot;&gt;lint&lt;/a&gt;. Meanwhile C# developers must   take care to document all exceptions thrown from their methods that callers   should be aware of as a matter of consideration. This is not to say that   documentation should not typically exist but since it is the &lt;b&gt;only&lt;/b&gt; means   to ensure exception safe C# code then its importance is now a much  greater.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;wora&quot; name=&quot;wora&quot;&gt;Cross Platform Portability (Write Once, Run   Anywhere)&lt;/a&gt;&lt;/h3&gt;
A major selling point of Java™ technologies is that applications written in   Java are portable across a number of operating systems and platforms. Sun   officially supports Linux, Windows and Solaris but other vendors have   implemented Java on &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://java.sun.com/cgi-bin/java-ports.cgi&quot;&gt;a   large range of platforms&lt;/a&gt; including OS/2, AIX and MacOS. Binary   compatibility across platforms using similar Java versions is the norm except   for situations involving bugs in various VM implementations.&lt;br /&gt;
At the time of this writing C# is only available on Windows. Efforts are   currently in place to port it to other platforms, including Linux and FreeBSD.   Linux porting is being done as part of the &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.go-mono.com/&quot;&gt;Mono project&lt;/a&gt; developed by &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.ximian.com/&quot;&gt;Ximian&lt;/a&gt; while the FreeBSD implementation is a   Microsoft project codenamed &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.microsoft.com/NET/sharedsourceclifaq.asp&quot;&gt;rotor&lt;/a&gt;.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;extensions&quot; name=&quot;extensions&quot;&gt;Extensions&lt;/a&gt;&lt;/h3&gt;
The Java extension mechanism enables developers to extend the abilities of   the core Java platform. Developers can create classes and packages which are   treated by the Java runtime as if they are core Java classes and packages like    &lt;code&gt;java.lang, java.util, java.net,&lt;/code&gt;etc. This means that extensions do   not have to be placed on the class path since they are treated as if they are   part of the core libraries such as those in the Java runtime library,    &lt;code&gt;rt.jar&lt;/code&gt;. Extensions are contained within JAR files and once   installed are available to all applications running on the target  platform.&lt;br /&gt;
A C# parallel would be the ability to create assemblies that are treated as   if they are part of the &lt;code&gt;System&lt;/code&gt; namespace contained in the   System.dll assembly.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;strictfp&quot; name=&quot;strictfp&quot;&gt;strictfp&lt;/a&gt;&lt;/h3&gt;
In Java,    &lt;code&gt;strictfp&lt;/code&gt; is a modifier that can be used for class, method or   interface declarations to ensure strict floating point arithmetic that   conforms to behavior specified in the &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://cch.loria.fr/documentation/IEEE754/&quot;&gt;IEEE standard 754 for binary   floating-point arithmetic&lt;/a&gt; (IEEE 754). Within an FP-strict expression, all   intermediate values must be members of the float or double value set,   depending on whether the expression is evaluating floats or doubles. Within   expressions that are not FP-strict, it is allowable for the JVM implementation   to use an extended exponent range to represent intermediate results. The   example below clarifies the difference between FP-strict and non-FP-strict   expressions. &lt;pre&gt;&lt;code&gt;&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;

public class FPTest {

    static strictfp double halfOfSquareFP(double n){

    return n * 4.0  * 0.5;
    }

    static double halfOfSquareNFP(double n){

    return n * 4.0 * 0.5;
    }

    public static void main(String[] args) {
    
    double d = 6.6e+307;
    
    System.out.println(halfOfSquareFP(d));

    System.out.println(halfOfSquareNFP(d)); 
    }

}//FPTest
&lt;/code&gt;
&lt;/pre&gt;
In the above example the value printed by calling halfOfSquareFP() will be   &quot;Infinity&quot; regardless of what JVM the application is run on. This is because   Java enforces left-to-right evaluation of arguments and &lt;code&gt;6.6e+307&lt;/code&gt;   multiplied by &lt;code&gt;4.0&lt;/code&gt; exceeds the maximum value for a double thus   leading to all subsequent operations yielding Infinity. On the other hand the   value printed on calling halfOfSquareNFP() may not be the same on different   JVMs depending on whether the target platform and JVM implementation support   storing intermediate values in an extended format that has a larger range than   that of doubles. Thus on some platforms the value &lt;code&gt;1.32E308&lt;/code&gt; is   printed as the value returned by halfOfSquareNFP() while on others &quot;Infinity&quot;   is printed.&lt;br /&gt;
Section 4.1.5 of the C# specification covers floating point numbers and   states that due to the excessive performance costs of enforcing that certain   architectures perform operations with &lt;i&gt;less&lt;/i&gt; precision than is possible,   there is no way to enforce FP-strictness in C#.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;classloading&quot; name=&quot;classloading&quot;&gt;Dynamic Class Loading&lt;/a&gt;&lt;/h3&gt;
The ability to dynamically load classes at runtime in Java is a very   powerful feature especially when combined with a remote procedure call   mechanism. Dynamic class loading enables Java applications to download the   class files (i.e. byte codes) of classes that do not exist on the target   machine. An object type that only exists on one machine can be transferred to   other machines in a seamless and transparent manner. Thus new types can be   introduced on a remote machine which allows the behavior of remote   applications to be significantly extended at runtime. The following example   shows an example of a remote application that accepts types that implement a   certain interface, IStockTicker.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;

public class MyRMIServer extends UnicastRemoteObject
    implements SomeInterface {
    
    public MyRMIServer() throws RemoteException{ super();}

      
    public String obtainName(IStockTicker ticker){

    String stock_ticker = ticker.getTicker(); 

    if(stock_ticker.equalsIgnoreCase(&quot;MSFT&quot;))
        return &quot;Microsoft Corporation&quot;; 
    else  if(stock_ticker.equalsIgnoreCase(&quot;SUNW&quot;)) 
            return &quot;Sun Microsystems&quot;; 
    else
            return &quot;Unknown Stock Ticker&quot;; 

    }/* obtainName(IStockTicker) */
    
}

&lt;/code&gt;
&lt;/pre&gt;
The obtainName() remote method in the above class accepts types that   implement the IStockTicker interface. It is possible for this method to be   invoked from a remote client which then passes a type that implements   IStockTicker, for example NASDAQStock, that does not exist on the server where   the MyRMIServer class lives. In this case the entire code needed for   NASDAQStock class is transmitted from the client to the remote server   automatically. &lt;br /&gt;&lt;br /&gt;C# and the .NET Remoting mechanism also enable remotely downloading classes   from one machine to the other but the client has to publish the assembly and   the server can then load it via a URL.&lt;br /&gt;
For information on Java Remote Method Invokation (RMI) read the &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://java.sun.com/docs/books/tutorial/rmi/index.html&quot;&gt;Java tutorial on   RMI&lt;/a&gt;. Information on .NET Remoting with C# is explained in this &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/introremoting.asp&quot;&gt;introduction   to .NET remoting&lt;/a&gt; and this &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/hawkremoting.asp&quot;&gt;technical   overview on MSDN&lt;/a&gt;.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;interfacefields&quot; name=&quot;interfacefields&quot;&gt;Interfaces That Contain   Fields&lt;/a&gt;&lt;/h3&gt;
In Java it is possible for constants to be declared in interfaces which are   then available to implementing classes while in C# this is not allowed. This   may not be a big issue in C# since the primary usage of constants declared in   interfaces is as a poor emulation of &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.25hoursaday.com/CsharpVsJava.html#enums&quot;&gt;enumerations&lt;/a&gt;.&lt;br /&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;anoninnerclasses&quot; name=&quot;anoninnerclasses&quot;&gt;Anonymous Inner   Classes&lt;/a&gt;&lt;/h3&gt;
An anonymous inner class is a class declaration that occurs at the same   point where an instance of that class is created. Anonymous inner classes are   typically used where only one instance of a type will exist in the   application. The most popular usage of anonymous inner classes is for   specifying callbacks especially in the Java GUI libraries but there are other   situations where anonymous inner classes are beneficial as well. Below is an   example of using anonymous inner classes to implement the &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://exciton.cs.rice.edu/JavaResources/DesignPatterns/StatePat.htm&quot;&gt;State   Design Pattern&lt;/a&gt;.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;

 /* An instance of this class represents the current state of a ClientView GUI. */
  
public abstract class ClientState{

     // This instance of the class is used to signify that the user is not logged in.
     // The only thing a user can do in this state is login and exit.  
     
    public static ClientState NOT_LOGGED_IN = new ClientState() {
        public void setMenuState(ClientView cv) {
            
        cv.setMenuEnabledState(false); /* disable all menus */
        cv.menuLogin.setEnabled(true); 
        cv.menuExit.setEnabled(true); 

        //can&#39;t type 
        cv.textArea.setEnabled(false); 
        }

        public String toString(){
        return &quot;ClientState: NOT_LOGGED_IN&quot;; 
        }
    };
    
    
     // This instance of the class is used to signify that the user is logged in
     // but has not yet created a document to work with. The user cannot type or save 
     // anything in this mode. 
     
    public static ClientState NO_OPEN_DOCUMENT = new ClientState() {
        public void setMenuState(ClientView cv) {
            
        cv.setMenuEnabledState(false); /* disable all menus */
        cv.menuLogin.setEnabled(true); 
        cv.menuExit.setEnabled(true); 
        cv.menuOpenFile.setEnabled(true);
        cv.menuNewFile.setEnabled(true);

        //can&#39;t type 
        cv.textArea.setEnabled(false); 

        }

        public String toString(){
        return &quot;ClientState: NO_OPEN_DOCUMENT&quot;; 
        }
    }; 
    
    
     // This instance of the class is used to signify that the user is editting a file. 
     // In this mode the user can use any functionality he/she sees fit. 
     
    public static ClientState EDITTING_DOCUMENT = new ClientState() {
        public void setMenuState(ClientView cv) {
            
        cv.setMenuEnabledState(true);   /* enable all menus             
        cv.textArea.setEnabled(true); 
        }

        public String toString(){
        return &quot;ClientState:EDITTING_DOCUMENT&quot;; 
        }
    }; 

   
     
     // Default constructor private to stop people from directly creating instances 
     // of the class.        
    private ClientState() {;}

    
     // This disables various elements of the ClientView&#39;s menu dependent on which
     // ClientState object this is.      
    public abstract void setMenuState(ClientView cv);

} // ClientState

&lt;/code&gt;
Below is an example of the code that would utilize the above ClientState class.  
 &lt;code&gt; 
    bool loginUser(String username, String passwd) {

        //check if already logged in
        if(myGUI.state == ClientState.NOT_LOGGED_IN)  
          return true; 

        //enable parts of the GUI if the user authenticates
        if(userAuthenticated(username, passwd)){

              myGUI.state = ClientState.NO_OPEN_DOCUMENT; 
              myGUI.state.setMenuState(myView); 
              return true; 

    }

        return false; 
    
 
   }/* loginUser(String, String) */

&lt;/code&gt;
&lt;/pre&gt;
&lt;li&gt;&lt;h3&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;staticimports&quot; name=&quot;staticimports&quot;&gt;Static Imports&lt;/a&gt;&lt;/h3&gt;
The static import feature makes it possible to access static members of a   class without having specify the class name. This feature is intended to   reduce the verbosity of code that frequently access the static members of a   particular class (e.g. constants defined in a particular helper class). &lt;br /&gt;
A static import similar to a regular &lt;code&gt;import&lt;/code&gt; statement except   that the keyword &lt;code&gt;static&lt;/code&gt; is used and instead of importing a   package, a specific class is imported. &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;b class=&quot;javak&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;Java Code&lt;/span&gt;&lt;/b&gt;
import static java.awt.Color.*; 

public class Test{

    public static void main(String[] args) throws Exception{

	//constants not qualified thanks to static import
	System.out.println(RED + &quot; plus &quot; + YELLOW + &quot; is &quot; + ORANGE);
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;conclusion2k1&quot; name=&quot;conclusion2k1&quot;&gt;Conclusion (2001)&lt;/a&gt;&lt;/h2&gt;
Most developers, especially those with a background in C or C++, would  probably agree that features like operator overloading, pointers, preprocessor  directives, delegates and deterministic object cleanup make C# more expressive  than Java in a number of cases. Similarly, Java developers who learn C# will be  pleasantly surprised at features that are missing in Java that will seem glaring  in their absence once one uses them in C#, such as boxing, enumerations and pass  by reference. On the other hand the lack of checked exceptions, inner classes,  cross platform portability or the fact that a class is not the smallest unit of  distribution of code makes the choice of C# over Java not a clearcut case of  choosing more language features without having to make any compromises.&lt;br /&gt;
It is my opinion that both languages are similar enough that they could be  made to mirror each other without significant effort if so required by either  user base. In this case, C# would have it easier than Java in that C# has less  to borrow from Java than Java would have to borrow from C#. However, the true  worth of a programming language that is intended for use outside of academia is  how quickly the language evolves to adapt to the changing technological  landscape and what kind of community surrounds the language. Some programming  languages are akin to the French language under the &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://www.academie-francaise.fr/immortels&quot;&gt;Les Immortels of the Acad¨¦mie  Française&lt;/a&gt; in France. Les immortels are charged with dictating what  constitutes the official French language but they have been slow to adapt to the  information age thus their edicts on what constitutes the proper French versions  of new words, especially those related to technology, are usually ignored  especially since they either conflict with what the general French public would  rather call them and show up long after the unsanctioned words have already  entered the lexicon. C++ is an example of a language that has undergone a  process of balkanization closely resembling the French language under the Les  Immortels of the Acad¨¦mie Française while Java under Sun Microsystems can be  considered to be a language that has evolved with the times similar to how the  English language has done.&lt;br /&gt;
Thus the question really becomes, which of these languages looks like it will  evolve with the times and be easiest to adapt to new situations as they arise?  So far, Sun has done a great job with Java although a lack of versioning support  and the non-existence of a framework that enables extensibility of the language  built into the platform makes drastic evolution difficult. C# with its support  for versioning via the .NET framework and the existence of attributes which can  be used to extend the features of the language looks like it would in the long  run be the more adaptable language. Only time will tell however if this  prediction is accurate.&lt;br /&gt;
&lt;h2&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;conclusion2k7&quot; name=&quot;conclusion2k7&quot;&gt;Conclusion (2007)&lt;/a&gt;&lt;/h2&gt;
As predicted in the original conclusion to this paper, a number of features  have become common across both C# and Java since 2001. These features include  generics, foreach loops, enumerations, boxing, variable length parameter lists  and metadata annotations. However after years of convergence it seems that C#  and Java are about to go in radically different directions. The current plans  for C# 3.0 are highlighted in the &lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://msdn.microsoft.com/data/ref/linq/&quot;&gt;Language Integrated Query (LINQ)  Project&lt;/a&gt; which encompasses integrating a number of data oriented features  including query, set operations, transformations and type inferencing directly  into the C# language. In combination with some of C#&#39;s existing features like  anonymous methods and nullable types, the differences between C# and Java will  become more stark over the next few years in contrast to the feature convergence  that has been happening over the past few years. &lt;br /&gt;
&lt;h2&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;resources&quot; name=&quot;resources&quot;&gt;Resources&lt;/a&gt;&lt;/h2&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;Eckel, Bruce. &lt;u&gt;Thinking In Java.&lt;/u&gt; Prentice Hall, 2000.&lt;br /&gt;&lt;br /&gt;
&lt;li&gt;Gunnerson, Eric. &lt;u&gt;A Programmer&#39;s Introduction To C#.&lt;/u&gt; Apress,   2001.&lt;br /&gt;&lt;br /&gt;
&lt;li&gt;Sun Microsystems. &lt;u&gt;The Java™ Tutorial.&lt;/u&gt;&amp;lt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://java.sun.com/docs/books/tutorial/&quot;&gt;http://java.sun.com/docs/books/tutorial/&lt;/a&gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;
&lt;li&gt;Microsoft Corporation. &lt;u&gt;.NET Framework Programming.&lt;/u&gt; &amp;lt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://msdn2.microsoft.com/en-us/library/ms229284(VS.80).aspx&quot;&gt;   http://msdn2.microsoft.com/en-us/library/ms229284(VS.80).aspx&lt;/a&gt;&amp;gt; &lt;br /&gt;&lt;br /&gt;
&lt;li&gt;Microsoft Corporation. &lt;u&gt;C# Language Reference.&lt;/u&gt; &amp;lt;&lt;a href=&quot;http://www.25hoursaday.com/web/20130119011220/http://msdn2.microsoft.com/en-us/library/618ayhy6(VS.80).aspx&quot;&gt;   http://msdn2.microsoft.com/en-us/library/618ayhy6(VS.80).aspx&lt;/a&gt;&amp;gt; &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
&lt;a href=&quot;https://www.blogger.com/null&quot; id=&quot;acknowledgements&quot; name=&quot;acknowledgements&quot;&gt;Acknowledgements&lt;/a&gt;&lt;/h2&gt;
&lt;div align=&quot;center&quot;&gt;
The following people helped in reviewing and proofreading this  article: Paul Johns, David Dagon, Dr. Yannis Smaragdakis , Dmitri Alperovitch,  Dennis Lu and Sanjay Bhatia.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/3045763115898066110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2014/04/a-comparison-of-microsofts-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/3045763115898066110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/3045763115898066110'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2014/04/a-comparison-of-microsofts-c.html' title='A COMPARISON OF MICROSOFT&#39;S C# PROGRAMMING LANGUAGE TO SUN MICROSYSTEMS&#39; JAVA PROGRAMMING LANGUAGE'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-3411489087556691288</id><published>2014-01-25T11:12:00.003+03:00</published><updated>2014-04-12T15:31:14.433+03:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><title type='text'>Introduction to Object-oriented Programming (OOP)</title><content type='html'>&lt;div id=&quot;content&quot;&gt;
&lt;div class=&quot;article&quot;&gt;
&lt;div id=&quot;blog-submitted&quot;&gt;
Posted by &lt;a href=&quot;https://www.blogger.com/blog/potty&quot;&gt;potty&lt;/a&gt; on January 20, 
2014 at 11:52 PM PST&lt;/div&gt;
&lt;h3&gt;
Why do we need to program?&lt;/h3&gt;
Technology is part of our life. The world is changing daily and everything is 
getting automated. Learn to program is the creative way we can take our ideas to 
the next level and express solutions to society. By designing programs, we learn 
several abilities like critical reading, analytical thinking and create 
synthesis. The programmer defines the problem, plans a solution, codes the 
program, test the proposal and documents the features. But we can&#39;t program all 
the solutions with the same method, that&#39;s why programming paradigms 
appears.&lt;br /&gt;
&lt;h3&gt;
Overview of Programming Paradigms&lt;/h3&gt;
According to Vasappanavara, a programming paradigm &quot;it is the manner in which 
programming elements such as functions, objects and variables are exploited to 
produce the desired output&quot;. It is important to understand that programming 
paradigms are not programming languages.&lt;br /&gt;
The following are typical examples of programming paradigms (according to 
Bhave):&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8jh_qbjvxBA6W__3REWVRNThQPERUJBue3WlD9A0loZMGPhwaGxQ5xGsMcBb-eoT5DnUTJN_OTULqNVrxzpSgxPbGMp8rwf_pgv6RjHWmi51FeH_f5wsvgzIyQ_bN_kHwj4C7M-eQFw/s1600/table_1_0.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8jh_qbjvxBA6W__3REWVRNThQPERUJBue3WlD9A0loZMGPhwaGxQ5xGsMcBb-eoT5DnUTJN_OTULqNVrxzpSgxPbGMp8rwf_pgv6RjHWmi51FeH_f5wsvgzIyQ_bN_kHwj4C7M-eQFw/s1600/table_1_0.png&quot; height=&quot;85&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;
What is Object-oriented Programming (OOP)?&lt;/h3&gt;
The object-oriented is a programming paradigm where the program logic and 
data are weaved. As stated by Phil Ballard, it is a way of conceptualizing a 
program&#39;s data into discrete &quot;things&quot; referred to as objects, each having its 
own properties and methods. &lt;br /&gt;
Let&#39;s see an example. Suppose your friend is a bank manager and he wants you 
to help improving their system. The first object you might design is the 
general-purpose &lt;code class=&quot;prettyprint&quot;&gt;&lt;span class=&quot;typ&quot;&gt;Account&lt;/span&gt;&lt;/code&gt;. 
The &lt;code class=&quot;prettyprint&quot;&gt;&lt;span class=&quot;typ&quot;&gt;Account&lt;/span&gt;&lt;/code&gt; object has 
properties and methods. For each client your friend&#39;s bank have, you would have 
to create an &lt;code class=&quot;prettyprint&quot;&gt;&lt;span class=&quot;typ&quot;&gt;Account&lt;/span&gt;&lt;/code&gt; 
object.&lt;br /&gt;
&lt;h3&gt;
Characteristics&lt;/h3&gt;
As follows the most important features of object-oriented programming:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Encapsulation&lt;/b&gt;. Capability to hide data and instructions 
inside an object.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Inheritance&lt;/b&gt;. Ability to create one object from 
another.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Polymorphism&lt;/b&gt;. The design of new classes is based on a 
single class.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Message Passing&lt;/b&gt;. It is the way objects communicate with 
each other.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Garbage Collection&lt;/b&gt;. Automatic memory management that 
destroys objects that are no longer in use by the program.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
Benefits&lt;/h3&gt;
As follows some benefits of using object-oriented programming:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Re-usability&lt;/b&gt;. You can write a program using a previous 
developed code.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Code Sharing&lt;/b&gt;. You are able to standardize the way your are 
programming with your colleagues.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Rapid Modeling&lt;/b&gt;. You can prototype the classes and their 
interaction through a diagram.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
Drawbacks&lt;/h3&gt;
As follows the disadvantages of using object-oriented programming:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Size&lt;/b&gt;. Are larger than other programs, consuming more memory 
and disk space.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Effort&lt;/b&gt;. Require a lot of work to create, including the 
diagramming on the planning phase and the coding on the execution 
phase.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
Basic Concepts&lt;/h3&gt;
&lt;b&gt;Class&lt;/b&gt;&lt;br /&gt;
Basic template that specifies the properties and 
behaviours of something (real life or abstract).&lt;br /&gt;
&lt;b&gt;Object&lt;/b&gt;&lt;br /&gt;
Particular instance of a class that responds 
consequently to events.&lt;br /&gt;
&lt;b&gt;Attribute&lt;/b&gt;&lt;br /&gt;
Characteristics of the class. Often called 
instance variables.&lt;br /&gt;
&lt;b&gt;Method&lt;/b&gt;&lt;br /&gt;
Algorithm associate to an class that represent a 
thing that the object does.&lt;br /&gt;
&lt;b&gt;Subclass&lt;/b&gt;&lt;br /&gt;
Class based on another class.&lt;br /&gt;
&lt;b&gt;Inheritance&lt;/b&gt;&lt;br /&gt;
Process where the subclass gets the 
attributes and methods from its parent class.&lt;br /&gt;
&lt;b&gt;Interface&lt;/b&gt;&lt;br /&gt;
Specific template that enforces certain 
attributes and methods of a class.&lt;br /&gt;
&lt;b&gt;Package&lt;/b&gt;&lt;br /&gt;
Namespace that organizes a set of related classes 
and interfaces.&lt;br /&gt;
&lt;b&gt;Event&lt;/b&gt;&lt;br /&gt;
Alert the application when there is a state change 
of the object.&lt;br /&gt;
&lt;h3&gt;
References&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Vasappanavara, R. &lt;b&gt;Object-oriented Programming Using C++ and 
Java.&lt;/b&gt; &lt;i&gt;Chapter 1. Object-oriented Programming Basics. Section 1.3. 
Programming Paradigms.&lt;/i&gt; Pearson Education. India. May, 2011.&lt;/li&gt;
&lt;li&gt;Bhave, M. &lt;b&gt;Object Oriented Programming with C++, Second 
Edition.&lt;/b&gt; &lt;i&gt;Chapter 4. Object Orientation: An Introduction. Section 
4.1. Programming Paradigms.&lt;/i&gt; Pearson Education. India. May, 2012.&lt;/li&gt;
&lt;li&gt;Ballard, P. &lt;b&gt;Sams Teach Yourself JavaScript in 24 Hours, Fifth 
Edition.&lt;/b&gt; &lt;i&gt;Hour 7. What is Object Oriented Programming (OOP)?.&lt;/i&gt; 
Pearson Education, Inc. United States. November, 2012.&lt;/li&gt;
&lt;/ol&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/3411489087556691288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2014/01/introduction-to-object-oriented.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/3411489087556691288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/3411489087556691288'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2014/01/introduction-to-object-oriented.html' title='Introduction to Object-oriented Programming (OOP)'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8jh_qbjvxBA6W__3REWVRNThQPERUJBue3WlD9A0loZMGPhwaGxQ5xGsMcBb-eoT5DnUTJN_OTULqNVrxzpSgxPbGMp8rwf_pgv6RjHWmi51FeH_f5wsvgzIyQ_bN_kHwj4C7M-eQFw/s72-c/table_1_0.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-1707839607975781395</id><published>2013-07-18T22:40:00.001+03:00</published><updated>2014-04-12T15:31:37.246+03:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><title type='text'>Performance Tips and Tricks in .NET Applications</title><content type='html'>Thanks &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms973839.aspx&quot;&gt;Microsoft MSDN&lt;/a&gt; &lt;br /&gt;
Emmanuel Schanzer&lt;br /&gt;
Microsoft Corporation&lt;br /&gt;
&lt;br /&gt;
August 2001&lt;br /&gt;
&lt;br /&gt;
&lt;b class=&quot;le&quot;&gt;Summary:&lt;/b&gt; This article is for developers who want to tweak their applications for optimal performance in the managed world. Sample code, explanations and design guidelines are addressed for Database, Windows Forms and ASP applications, as well as language-specific tips for Microsoft Visual Basic and Managed C++. (25 printed pages)&lt;br /&gt;
&lt;br /&gt;
&lt;h4 class=&quot;dtH1&quot;&gt;
Contents&lt;/h4&gt;
&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms973839.aspx#dotnetperftips_topic1&quot;&gt;Overview&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms973839.aspx#dotnetperftips_topic2&quot;&gt;Performance Tips for All Applications&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms973839.aspx#dotnetperftips_topic3&quot;&gt;Tips for Database Access&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms973839.aspx#dotnetperftips_topic4&quot;&gt;Performance Tips for ASP.NET Applications&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms973839.aspx#dotnetperftips_topic5&quot;&gt;Tips for Porting and Developing in Visual Basic&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms973839.aspx#dotnetperftips_topic6&quot;&gt;Tips for Porting and Developing in Managed C++&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms973839.aspx#dotnetperftips_topic7&quot;&gt;Additional Resources&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms973839.aspx#dotnetperftips_topic8&quot;&gt;Appendix: Cost of Virtual Calls and Allocations&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h2 class=&quot;dtH1&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;dotnetperftips_topic1&quot;&gt;&lt;/a&gt;Overview&lt;/h2&gt;
&lt;br /&gt;
This white paper is designed as a reference for developers writing applications for .NET and looking for various ways to improve performance. If you are a developer who is new to .NET, you should be familiar with both the platform and your language of choice. This paper strictly builds on that knowledge, and assumes that the programmer already knows enough to get the program running. If you are porting an existing application to .NET, it&#39;s worth reading this document before you begin the port. Some of the tips here are helpful in the design phase, and provide information you should be aware of before you begin the port.&lt;br /&gt;
&lt;br /&gt;
This paper is divided into segments, with tips organized by project and developer type. The first set of tips is a must-read for writing in any language, and contains advice that will help you with any target language on the Common Language Runtime (CLR). A related section follows with ASP-specific tips. The second set of tips is organized by language, dealing with specific tips about using Managed C++ and Microsoft® Visual Basic®. &lt;br /&gt;
&lt;br /&gt;
Due to schedule limitations, the version 1 (v1) run time had to target the broadest functionality first, and then deal with special-case optimizations later. This results in a few pigeonhole cases where performance becomes an issue. As such, this paper covers several tips that are designed to avoid this case. These tips will not be relevant in the next version (vNext), as these cases are systematically identified and optimized. I&#39;ll point them out as we go, and it is up to you to decide whether it is worth the effort.&lt;br /&gt;
&lt;br /&gt;
&lt;h2 class=&quot;dtH1&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;dotnetperftips_topic2&quot;&gt;&lt;/a&gt;Performance Tips for All Applications&lt;/h2&gt;
&lt;br /&gt;
There are a few tips to remember when working on the CLR in any language. These are relevant to everyone, and should be the first line of defense when dealing with performance issues.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Throw Fewer Exceptions&lt;/h3&gt;
&lt;br /&gt;
Throwing exceptions can be very expensive, so make sure that you don&#39;t throw a lot of them. Use Perfmon to see how many exceptions your application is throwing. It may surprise you to find that certain areas of your application throw more exceptions than you expected. For better granularity, you can also check the exception number programmatically by using Performance Counters. &lt;br /&gt;
&lt;br /&gt;
Finding and designing away exception-heavy code can result in a decent perf win. Bear in mind that this has nothing to do with try/catch blocks: &lt;i&gt;you only incur the cost when the actual exception is thrown. &lt;/i&gt;You can use as many try/catch blocks as you want. Using exceptions gratuitously is where you lose performance. For example, you should stay away from things like using exceptions for control flow.&lt;br /&gt;
&lt;br /&gt;
Here&#39;s a simple example of how expensive exceptions can be: we&#39;ll simply run through a &lt;b&gt;For&lt;/b&gt; loop, generating thousands or exceptions and then terminating. Try commenting out the throw statement to see the difference in speed: those exceptions result in tremendous overhead.&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-1&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_b6a63784-72e9-433f-8298-a22e06a3911d&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_b6a63784-72e9-433f-8298-a22e06a3911d&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;public static void Main(string[] args){
  int j = 0;
  for(int i = 0; i &amp;lt; 10000; i++){
    try{   
      j = i;
      throw new System.Exception();
    } catch {}
  }
  System.Console.Write(j);
  return;   
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;Beware! The run time can throw exceptions on its own! For example, &lt;b&gt;Response.Redirect()&lt;/b&gt; throws a &lt;b&gt;ThreadAbort&lt;/b&gt; exception. Even if you don&#39;t explicitly throw exceptions, you may use functions that do. Make sure you check Perfmon to get the real story, and the debugger to check the source.&lt;/li&gt;
&lt;li&gt;To Visual Basic developers: Visual Basic turns on int checking by default, to make sure that things like overflow and divide-by-zero throw exceptions. You may want to turn this off to gain performance.&lt;/li&gt;
&lt;li&gt;If you use COM, you should keep in mind that HRESULTS can return as exceptions. Make sure you keep track of these carefully.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Make Chunky Calls&lt;/h3&gt;
&lt;br /&gt;
A chunky call is a function call that performs several tasks, such as a method that initializes several fields of an object. This is to be viewed against chatty calls, that do very simple tasks and require multiple calls to get things done (such as setting every field of an object with a different call). It&#39;s important to make chunky, rather than chatty calls across methods where the overhead is higher than for simple, intra-AppDomain method calls. P/Invoke, interop and remoting calls all carry overhead, and you want to use them sparingly. In each of these cases, you should try to design your application so that it doesn&#39;t rely on small, frequent calls that carry so much overhead. &lt;br /&gt;
&lt;br /&gt;
A transition occurs whenever managed code is called from unmanaged code, and vice versa. The run time makes it extremely easy for the programmer to do interop, but this comes at a performance price. When a transition happens, the following steps needs to be taken:&lt;br /&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;Perform data marshalling&lt;/li&gt;
&lt;li&gt;Fix Calling Convention&lt;/li&gt;
&lt;li&gt;Protect callee-saved registers&lt;/li&gt;
&lt;li&gt;Switch thread mode so that GC won&#39;t block unmanaged threads&lt;/li&gt;
&lt;li&gt;Erect an Exception Handling frame on calls into managed code&lt;/li&gt;
&lt;li&gt;Take control of thread (optional)&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
To speed up transition time, try to make use of P/Invoke when you can. The overhead is as little as 31 instructions plus the cost of marshalling if data marshalling is required, and only 8 otherwise. COM interop is much more expensive, taking upwards of 65 instructions.&lt;br /&gt;
&lt;br /&gt;
Data marshalling isn&#39;t always expensive. Primitive types require almost no marshalling at all, and classes with explicit layout are also cheap. The real slowdown occurs during data translation, such as text conversion from ASCI to Unicode. Make sure that data that gets passed across the managed boundary is only converted if it needs to be: it may turn out that simply by agreeing on a certain datatype or format across your program you can cut out a lot of marshalling overhead. &lt;br /&gt;
&lt;br /&gt;
The following types are called &lt;i&gt;blittable&lt;/i&gt;, meaning they can be copied directly across the managed/unmanaged boundary with no marshalling whatsoever: sbyte, byte, short, ushort, int, uint, long, ulong, float and double. You can pass these for free, as well as ValueTypes and single-dimensional arrays containing blittable types. The &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa720205.aspx&quot;&gt;gritty details of marshalling&lt;/a&gt; can be explored further on the MSDN Library. I recommend reading it carefully if you spend a lot of your time marshalling.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Design with ValueTypes&lt;/h3&gt;
&lt;br /&gt;
Use simple structs when you can, and when you don&#39;t do a lot of boxing and unboxing. Here&#39;s a simple example to demonstrate the speed difference:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;normal&quot;&gt;
using System;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;normal&quot;&gt;
namespace ConsoleApplication{ &lt;/div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-2&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_7e120889-bec9-469f-b74f-86bd00e57fc9&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_7e120889-bec9-469f-b74f-86bd00e57fc9&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;  public struct foo{
    public foo(double arg){ this.y = arg; }
    public double y;
  }
  public class bar{
    public bar(double arg){ this.y = arg; }
    public double y;
  }
  class Class1{
    static void Main(string[] args){
      System.Console.WriteLine(&quot;starting struct loop...&quot;);
      for(int i = 0; i &amp;lt; 50000000; i++)
      {foo test = new foo(3.14);}
      System.Console.WriteLine(&quot;struct loop complete. 
                                starting object loop...&quot;);
      for(int i = 0; i &amp;lt; 50000000; i++)
      {bar test2 = new bar(3.14); }
      System.Console.WriteLine(&quot;All done&quot;);
    }
  }
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
When you run this example, you&#39;ll see that the struct loop is orders of magnitude faster. However, it is important to beware of using ValueTypes when you treat them like objects. This adds extra boxing and unboxing overhead to your program, and can end up costing you more than it would if you had stuck with objects! To see this in action, modify the code above to use an array of foos and bars. You&#39;ll find that the performance is more or less equal.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;dtBlock&quot;&gt;
&lt;b class=&quot;le&quot;&gt;Tradeoffs  &lt;/b&gt;  ValueTypes are far less flexible than Objects, and end up hurting performance if used incorrectly. You need to be very careful about when and how you use them. &lt;/blockquote&gt;
&lt;br /&gt;
Try modifying the sample above, and storing the foos and bars inside arrays or hashtables. You&#39;ll see the speed gain disappear, just with &lt;i&gt;one&lt;/i&gt; boxing and unboxing operation.&lt;br /&gt;
&lt;br /&gt;
You can keep track of how heavily you box and unbox by looking at GC allocations and collections. This can be done using either Perfmon externally or Performance Counters in your code.&lt;br /&gt;
&lt;br /&gt;
See the in-depth discussion of ValueTypes in &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms973838.aspx&quot;&gt;Performance Considerations of Run-Time Technologies in the .NET Framework&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Use AddRange to Add Groups&lt;/h3&gt;
&lt;br /&gt;
Use &lt;b&gt;AddRange&lt;/b&gt; to add a whole collection, rather than adding each item in the collection iteratively. Nearly all windows controls and collections have both &lt;b&gt;Add&lt;/b&gt; and &lt;b&gt;AddRange&lt;/b&gt; methods, and each is optimized for a different purpose. &lt;b&gt;Add&lt;/b&gt; is useful for adding a single item, whereas &lt;b&gt;AddRange&lt;/b&gt; has some extra overhead but wins out when adding multiple items. Here are just a few of the classes that support &lt;b&gt;Add&lt;/b&gt; and &lt;b&gt;AddRange&lt;/b&gt;:&lt;br /&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;StringCollection, TraceCollection, etc.&lt;/li&gt;
&lt;li&gt;HttpWebRequest&lt;/li&gt;
&lt;li&gt;UserControl&lt;/li&gt;
&lt;li&gt;ColumnHeader&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Trim Your Working Set&lt;/h3&gt;
&lt;br /&gt;
Minimize the number of assemblies you use to keep your working set small. If you load an entire assembly just to use one method, you&#39;re paying a tremendous cost for very little benefit. See if you can duplicate that method&#39;s functionality using code that you already have loaded.&lt;br /&gt;
&lt;br /&gt;
Keeping track of your working set is difficult, and could probably be the subject of an entire paper. Here are some tips to help you out:&lt;br /&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;Use vadump.exe to track your working set. This is discussed in another white paper covering various tools for the managed environment.&lt;/li&gt;
&lt;li&gt;Look at Perfmon or Performance Counters. They can give you detail feedback about the number of classes that you load, or the number of methods that get JITed. You can get readouts for how much time you spend in the loader, or what percent of your execution time is spent paging.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Use For Loops for String Iteration—version 1&lt;/h3&gt;
&lt;br /&gt;
In C#, the &lt;b&gt;foreach&lt;/b&gt; keyword allows you to walk across items in a list, string, etc. and perform operations on each item. This is a very powerful tool, since it acts as a general-purpose enumerator over many types. The tradeoff for this generalization is speed, and if you rely heavily on string iteration you should use a &lt;b&gt;For&lt;/b&gt; loop instead. Since strings are simple character arrays, they can be walked using much less overhead than other structures. The JIT is smart enough (in many cases) to optimize away bounds-checking and other things inside a &lt;b&gt;For&lt;/b&gt; loop, but is prohibited from doing this on &lt;b&gt;foreach&lt;/b&gt; walks. The end result is that in version 1, a &lt;b&gt;For&lt;/b&gt; loop on strings is up to five times faster than using &lt;b&gt;foreach&lt;/b&gt;. This will change in future versions, but for version 1 this is a definite way to increase performance.&lt;br /&gt;
&lt;br /&gt;
Here&#39;s a simple test method to demonstrate the difference in speed. Try running it, then removing the &lt;b&gt;For&lt;/b&gt; loop and uncommenting the &lt;b&gt;foreach&lt;/b&gt; statement. On my machine, the &lt;b&gt;For&lt;/b&gt; loop took about a second, with about 3 seconds for the &lt;b&gt;foreach&lt;/b&gt; statement.&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-3&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_304bf21e-ae43-4c27-ad3b-2389dcdec936&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_304bf21e-ae43-4c27-ad3b-2389dcdec936&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;public static void Main(string[] args) {
  string s = &quot;monkeys!&quot;;
  int dummy = 0;

  System.Text.StringBuilder sb = new System.Text.StringBuilder(s);
  for(int i = 0; i &amp;lt; 1000000; i++)
    sb.Append(s);
  s = sb.ToString();
  //foreach (char c in s) dummy++;
  for (int i = 0; i &amp;lt; 1000000; i++)
    dummy++;
  return;   
  }
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote class=&quot;dtBlock&quot;&gt;
&lt;b class=&quot;le&quot;&gt;Tradeoffs &lt;/b&gt;  &lt;b&gt;Foreach&lt;/b&gt;&lt;code&gt; &lt;/code&gt;is far more readable, and in the future it will become as fast as a &lt;b&gt;For&lt;/b&gt; loop for special cases like strings. Unless string manipulation is a real performance hog for you, the slightly messier code may not be worth it.&lt;/blockquote&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;dotnetperftips_topic2a&quot;&gt;&lt;/a&gt;Use StringBuilder for Complex String Manipulation&lt;/h3&gt;
&lt;br /&gt;
When a string is modified, the run time will create a new string and return it, leaving the original to be garbage collected. Most of the time this is a fast and simple way to do it, but when a string is being modified repeatedly it begins to be a burden on performance: all of those allocations eventually get expensive. Here&#39;s a simple example of a program that appends to a string 50,000 times, followed by one that uses a &lt;b&gt;StringBuilder&lt;/b&gt; object to modify the string in place. The &lt;b&gt;StringBuilder&lt;/b&gt; code is much faster, and if you run them it becomes immediately obvious.  &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;tablediv&quot;&gt;
&lt;table class=&quot;dtTABLE&quot;&gt; &lt;tbody&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;td width=&quot;50%&quot;&gt;&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-4&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_1f22f0cc-e78b-4f2c-ac3d-6bd79fdc0e1b&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_1f22f0cc-e78b-4f2c-ac3d-6bd79fdc0e1b&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;namespace ConsoleApplication1.Feedback{
  using System;
  
  public class Feedback{
    public Feedback(){
      text = &quot;You have ordered: \n&quot;;
    }

    public string text;

    public static int Main(string[] args) {
      Feedback test = new Feedback();
      String str = test.text;
      for(int i=0;i&lt;50000 0=&quot;&quot; blue_toothbrush=&quot;&quot; done=&quot;&quot; i=&quot;&quot; pre=&quot;&quot; return=&quot;&quot; str=&quot;str&quot; system.console.out.writeline=&quot;&quot;&gt;&lt;!--50000--&gt;&lt;/50000&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt; &lt;td width=&quot;50%&quot;&gt;&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-6&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_a0623d86-c885-4c35-bd28-29a72ee700e1&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_a0623d86-c885-4c35-bd28-29a72ee700e1&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;namespace ConsoleApplication1.Feedback{
  using System;

  public class Feedback{
    public Feedback(){
      text = &quot;You have ordered: \n&quot;;
    }

    public string text;

    public static int Main(string[] args) {
      Feedback test = new Feedback();
      System.Text.StringBuilder SB = 
        new System.Text.StringBuilder(test.text);
      for(int i=0;i&lt;50000 0=&quot;&quot; blue_toothbrush=&quot;&quot; done=&quot;&quot; i=&quot;&quot; pre=&quot;&quot; return=&quot;&quot; sb.append=&quot;&quot; system.console.out.writeline=&quot;&quot;&gt;&lt;!--50000--&gt;&lt;/50000&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;
Try looking at Perfmon to see how much time is saved without allocating thousands of strings. Look at the &quot;% time in GC&quot; counter under the .NET CLR Memory list. You can also track the number of allocations you save, as well as collection statistics.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;dtBlock&quot;&gt;
&lt;b class=&quot;le&quot;&gt;Tradeoffs   &lt;/b&gt;There is some overhead associated with creating a &lt;b&gt;StringBuilder&lt;/b&gt; object, both in time and memory. On a machine with fast memory, a &lt;b&gt;StringBuilder&lt;/b&gt; becomes worthwhile if you&#39;re doing about five operations. As a rule of thumb, I would say 10 or more string operations is a justification for the overhead on any machine, even a slower one.&lt;/blockquote&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Precompile Windows Forms Applications&lt;/h3&gt;
&lt;br /&gt;
Methods are JITed when they are first used, which means that you pay a larger startup penalty if your application does a lot of method calling during startup. Windows Forms use a lot of shared libraries in the OS, and the overhead in starting them can be much higher than other kinds of applications. While not always the case, precompiling Windows Forms applications usually results in a performance win. In other scenarios it&#39;s usually best to let the JIT take care of it, but if you are a Windows Forms developer you might want to take a look. &lt;br /&gt;
&lt;br /&gt;
Microsoft allows you to precompile an application by calling &lt;code class=&quot;ce&quot;&gt;ngen.exe&lt;/code&gt;. You can choose to run ngen.exe during install time or before you distribute you application. It definitely makes the most sense to run ngen.exe during install time, since you can make sure that the application is optimized for the machine on which it is being installed. If you run ngen.exe before you ship the program, you limit the optimizations to the ones available on &lt;i&gt;your&lt;/i&gt; machine. To give you an idea of how much precompiling can help, I&#39;ve run an informal test on my machine. Below are the cold startup times for ShowFormComplex, a winforms application with roughly a hundred controls.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;tablediv&quot;&gt;
&lt;table class=&quot;dtTABLE&quot;&gt; &lt;tbody&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;th width=&quot;67%&quot;&gt;Code State&lt;/th&gt; &lt;th width=&quot;33%&quot;&gt;Time&lt;/th&gt; &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;td class=&quot;normal&quot; width=&quot;67%&quot;&gt;Framework JITed &lt;br /&gt;
&lt;div class=&quot;normal&quot;&gt;
ShowFormComplex JITed&lt;/div&gt;
&lt;/td&gt; &lt;td class=&quot;normal&quot; width=&quot;33%&quot;&gt;3.4 sec&lt;/td&gt; &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;td class=&quot;normal&quot; width=&quot;67%&quot;&gt;Framework Precompiled, ShowFormComplex JITed&lt;/td&gt; &lt;td class=&quot;normal&quot; width=&quot;33%&quot;&gt;2.5 sec&lt;/td&gt; &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;td class=&quot;normal&quot; width=&quot;67%&quot;&gt;Framework Precompiled, ShowFormComplex Precompiled&lt;/td&gt; &lt;td class=&quot;normal&quot; width=&quot;33%&quot;&gt;2.1sec&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;
Each test was performed after a reboot. As you can see, Windows Forms applications use a lot of methods up front, making it a substantial performance win to precompile.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Use Jagged Arrays—Version 1&lt;/h3&gt;
&lt;br /&gt;
The v1 JIT optimizes jagged arrays (simply &#39;arrays-of-arrays&#39;) more efficiently than rectangular arrays, and the difference is quite noticeable. Here is a table demonstrating the performance gain resulting from using jagged arrays in place of rectangular ones in both C# and Visual Basic (higher numbers are better):&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;tablediv&quot;&gt;
&lt;table class=&quot;dtTABLE&quot;&gt; &lt;tbody&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;th width=&quot;52%&quot;&gt;&lt;/th&gt; &lt;th width=&quot;19%&quot;&gt;C#&lt;/th&gt; &lt;th width=&quot;29%&quot;&gt;Visual Basic 7&lt;/th&gt; &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;td class=&quot;normal&quot; width=&quot;52%&quot;&gt;Assignment (jagged)&lt;br /&gt;
&lt;div class=&quot;normal&quot;&gt;
Assignment (rectangular)&lt;/div&gt;
&lt;/td&gt; &lt;td class=&quot;normal&quot; width=&quot;19%&quot;&gt;14.16&lt;br /&gt;
&lt;div class=&quot;normal&quot;&gt;
8.37&lt;/div&gt;
&lt;/td&gt; &lt;td class=&quot;normal&quot; width=&quot;29%&quot;&gt;12.24&lt;br /&gt;
&lt;div class=&quot;normal&quot;&gt;
8.62&lt;/div&gt;
&lt;/td&gt; &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;td class=&quot;normal&quot; width=&quot;52%&quot;&gt;Neural Net (jagged)&lt;br /&gt;
&lt;div class=&quot;normal&quot;&gt;
Neural net (rectangular)&lt;/div&gt;
&lt;/td&gt; &lt;td class=&quot;normal&quot; width=&quot;19%&quot;&gt;4.48&lt;br /&gt;
&lt;div class=&quot;normal&quot;&gt;
3.00&lt;/div&gt;
&lt;/td&gt; &lt;td class=&quot;normal&quot; width=&quot;29%&quot;&gt;4.58&lt;br /&gt;
&lt;div class=&quot;normal&quot;&gt;
3.13&lt;/div&gt;
&lt;/td&gt; &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;td class=&quot;normal&quot; width=&quot;52%&quot;&gt;Numeric Sort (jagged)&lt;br /&gt;
&lt;div class=&quot;normal&quot;&gt;
Numeric Sort (rectangular)&lt;/div&gt;
&lt;/td&gt; &lt;td class=&quot;normal&quot; width=&quot;19%&quot;&gt;4.88&lt;br /&gt;
&lt;div class=&quot;normal&quot;&gt;
2.05&lt;/div&gt;
&lt;/td&gt; &lt;td class=&quot;normal&quot; width=&quot;29%&quot;&gt;5.07&lt;br /&gt;
&lt;div class=&quot;normal&quot;&gt;
2.06&lt;/div&gt;
&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;
The assignment benchmark is a simple assignment algorithm, adapted from the step-by-step guide found in &lt;i&gt;Quantitative Decision Making for Business&lt;/i&gt; (Gordon, Pressman, and Cohn; Prentice-Hall; out of print). The neural net test runs a series of patterns over a small neural network, and the numeric sort is self-explanatory. Taken together, these benchmarks represent a good indication of real-world performance.&lt;br /&gt;
&lt;br /&gt;
As you can see, using jagged arrays can result in fairly dramatic performance increases. The optimizations made to jagged arrays will be added to future versions of the JIT, but for v1 you can save yourself a lot of time by using jagged arrays.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Keep IO Buffer Size Between 4KB and 8KB&lt;/h3&gt;
&lt;br /&gt;
For nearly every application, a buffer between 4KB and 8KB will give you the maximum performance. For very specific instances, you may be able to get an improvement from a larger buffer (loading large images of a predictable size, for example), but in 99.99% of cases it will only waste memory. All buffers derived from BufferedStream allow you to set the size to anything you want, but in most cases 4 and 8 will give you the best performance.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Be on the Lookout for Asynchronous IO Opportunities&lt;/h3&gt;
&lt;br /&gt;
In rare cases, you may be able to benefit from Asynchronous IO. One example might be downloading and decompressing a series of files: you can read the bits in from one stream, decode them on the CPU and write them out to another. It takes a lot of effort to use Asynchronous IO effectively, and it can result in a performance &lt;i&gt;loss&lt;/i&gt; if it&#39;s not done right. The advantage is that when applied correctly, Asynchronous IO can give you as much as ten times the performance.&lt;br /&gt;
&lt;br /&gt;
An excellent &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa719596.aspx&quot;&gt;example of a program using Asynchronous IO&lt;/a&gt; is available on the MSDN Library. &lt;br /&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;One thing to note is that there is a small security overhead for asynchronous calls: Upon invoking an async call, the security state of the caller&#39;s stack is captured and transferred to the thread that&#39;ll actually execute the request. This may not be a concern if the callback executes lot of code, or if async calls aren&#39;t used excessively&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;h2 class=&quot;dtH1&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;dotnetperftips_topic3&quot;&gt;&lt;/a&gt;Tips for Database Access &lt;/h2&gt;
&lt;br /&gt;
The philosophy of tuning for database access is to use only the functionality that you need, and to design around a &#39;disconnected&#39; approach: make several connections in sequence, rather than holding a single connection open for a long time. You should take this change into account and design around it.&lt;br /&gt;
&lt;br /&gt;
Microsoft recommends an &lt;i&gt;N&lt;/i&gt;-Tier strategy for maximum performance, as opposed to a direct client-to-database connection. Consider this as part of your design philosophy, as many of the technologies in place are optimized to take advantage of a multi-tired scenario.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Use the Optimal Managed Provider&lt;/h3&gt;
&lt;br /&gt;
Make the correct choice of managed provider, rather than relying on a generic accessor. There are managed providers written specifically for many different databases, such as SQL (System.Data.SqlClient). If you use a more generic interface such as System.Data.Odbc when you could be using a specialized component, you will lose performance dealing with the added level of indirection. Using the optimal provider can also have you speaking a different language: the Managed SQL Client speaks TDS to a SQL database, providing a dramatic improvement over the generic OleDbprotocol.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Pick Data Reader Over Data Set When You Can&lt;/h3&gt;
&lt;br /&gt;
Use a data reader whenever when you don&#39;t need to keep the data lying around. This allows a fast read of the data, which can be cached if the user desires. A reader is simply a stateless stream that allows you to read data as it arrives, and then drop it without storing it to a dataset for more navigation. The stream approach is faster and has less overhead, since you can start using data immediately. You should evaluate how often you need the same data to decide if the caching for navigation makes sense for you. Here&#39;s a small table demonstrating the difference between DataReader and DataSet on both ODBC and SQL providers when pulling data from a server (higher numbers are better):&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;tablediv&quot;&gt;
&lt;table class=&quot;dtTABLE&quot;&gt; &lt;tbody&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;th width=&quot;33%&quot;&gt;&lt;/th&gt; &lt;th width=&quot;33%&quot;&gt;ADO&lt;/th&gt; &lt;th width=&quot;34%&quot;&gt;SQL&lt;/th&gt; &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;td width=&quot;33%&quot;&gt;DataSet&lt;/td&gt; &lt;td width=&quot;33%&quot;&gt;801&lt;/td&gt; &lt;td width=&quot;34%&quot;&gt;2507&lt;/td&gt; &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;td width=&quot;33%&quot;&gt;DataReader&lt;/td&gt; &lt;td width=&quot;33%&quot;&gt;1083&lt;/td&gt; &lt;td width=&quot;34%&quot;&gt;4585&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;
As you can see, the highest performance is achieved when using the optimal managed provider along with a data reader. When you don&#39;t need to cache your data, using a data reader can provide you with an enormous performance boost.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Use Mscorsvr.dll for MP Machines&lt;/h3&gt;
&lt;br /&gt;
For stand-alone middle-tier and server applications, make sure &lt;code class=&quot;ce&quot;&gt;mscorsvr&lt;/code&gt; is being used for multiprocessor machines. Mscorwks is not optimized for scaling or throughput, while the server version has several optimizations that allow it to scale well when more than one processor is available.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Use Stored Procedures Whenever Possible&lt;/h3&gt;
&lt;br /&gt;
Stored procedures are highly optimized tools that result in excellent performance when used effectively. Set up stored procedures to handle inserts, updates, and deletes with the data adapter. Stored procedures do not have to be interpreted, compiled or even transmitted from the client, and cut down on both network traffic and server overhead. Be sure to use CommandType.StoredProcedure instead of CommandType.Text&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Be Careful About Dynamic Connection Strings&lt;/h3&gt;
&lt;br /&gt;
Connection pooling is a useful way to reuse connections for multiple requests, rather than paying the overhead of opening and closing a connection for each request. It&#39;s done implicitly, but you get &lt;i&gt;one pool per unique connection string&lt;/i&gt;. If you&#39;re generating connection strings dynamically, make sure the strings are identical each time so pooling occurs. Also be aware that if delegation is occurring, you&#39;ll get one pool per user. There are a lot of options that you can set for the connection pool, and you can track the performance of the pool by using the Perfmon to keep track of things like response time, transactions/sec, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Turn Off Features You Don&#39;t Use&lt;/h3&gt;
&lt;br /&gt;
Turn off automatic transaction enlistment if it&#39;s not needed. For the SQL Managed Provider, it&#39;s done via the connection string: &lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-8&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_21855893-56e4-470f-895f-f3636378d397&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_21855893-56e4-470f-895f-f3636378d397&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;SqlConnection conn = new SqlConnection(
&quot;Server=mysrv01;
Integrated Security=true;
Enlist=false&quot;);
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
When filling a dataset with the data adapter, don&#39;t get primary key information if you don&#39;t have to (e.g. don&#39;t set MissingSchemaAction.Add with key):&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-9&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_ee46afe3-cc7e-4ac7-8223-c0cbeddf60f1&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_ee46afe3-cc7e-4ac7-8223-c0cbeddf60f1&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;public DataSet SelectSqlSrvRows(DataSet dataset,string connection,string query){
    SqlConnection conn = new SqlConnection(connection);
    SqlDataAdapter adapter = new SqlDataAdapter();
    adapter.SelectCommand = new SqlCommand(query, conn);
    adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
    adapter.Fill(dataset);
    return dataset;
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Avoid Auto-Generated Commands&lt;/h3&gt;
&lt;br /&gt;
When using a data adapter, avoid auto-generated commands. These require additional trips to the server to retrieve meta data, and give you a lower level of interaction control. While using auto-generated commands is convenient, it&#39;s worth the effort to do it yourself in performance-critical applications. &lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Beware ADO Legacy Design&lt;/h3&gt;
&lt;br /&gt;
Be aware that when you execute a command or call fill on the adapter, every record specified by your query is returned. &lt;br /&gt;
&lt;br /&gt;
If server cursors are absolutely required, they can be implemented through a stored procedure in t-sql. Avoid where possible because server cursor-based implementations don&#39;t scale very well. &lt;br /&gt;
&lt;br /&gt;
If needed, implement paging in a stateless and connectionless manner. You can add additional records to the dataset by:&lt;br /&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;Making sure PK info is present&lt;/li&gt;
&lt;li&gt;Changing the data adapter&#39;s select command as appropriate, and &lt;/li&gt;
&lt;li&gt;Calling Fill &lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Keep Your Datasets Lean&lt;/h3&gt;
&lt;br /&gt;
Only put the records you need into the dataset. Remember that the dataset stores all of its data in memory, and that the more data you request, the longer it will take to transmit across the wire. &lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Use Sequential Access as Often as Possible&lt;/h3&gt;
&lt;br /&gt;
With a data reader, use CommandBehavior.SequentialAccess. This is essential for dealing with blob data types since it allows data to be read off of the wire in small chunks. While you can only work with one piece of the data at a time, the latency for loading a large data type disappears. If you don&#39;t need to work the whole object at once, using Sequential Access will give you much better performance. &lt;br /&gt;
&lt;br /&gt;
&lt;h2 class=&quot;dtH1&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;dotnetperftips_topic4&quot;&gt;&lt;/a&gt;Performance Tips for ASP.NET Applications&lt;/h2&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Cache Aggressively&lt;/h3&gt;
&lt;br /&gt;
When designing an app using ASP.NET, make sure you design with an eye on caching. On server versions of the OS, you have a lot of options for tweaking the use of caches on the server and client side. There are several features and tools in ASP that you can make use of to gain performance.&lt;br /&gt;
&lt;br /&gt;
Output Caching—Stores the static result of an ASP request. Specified using the &lt;code&gt;&amp;lt;@% OutputCache %&amp;gt;&lt;/code&gt; directive:&lt;br /&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;Duration—Time item exists in the cache&lt;/li&gt;
&lt;li&gt;VaryByParam—Varies cache entries by Get/Post params&lt;/li&gt;
&lt;li&gt;VaryByHeader—Varies cache entries by Http header&lt;/li&gt;
&lt;li&gt;VaryByCustom—Varies cache entries by browser&lt;/li&gt;
&lt;li&gt;Override to vary by whatever you want:&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;Fragment Caching—When it is not possible to store an entire page (privacy, personalization, dynamic content), you can use fragment caching to store parts of it for quicker retrieval later.a) VaryByControl—Varies the cached items by values of a control&lt;/li&gt;
&lt;li&gt;Cache API—Provides extremely fine granularity for caching by keeping a hashtable of cached objects in memory (System.web.UI.caching). It also:a) Includes Dependencies (key, file, time)&lt;br /&gt;
b) Automatically expires unused items&lt;br /&gt;
c) Supports Callbacks&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Caching intelligently can give you excellent performance, and it&#39;s important to think about what kind of caching you need. Imagine a complex e-commerce site with several static pages for login, and then a slew of dynamically-generated pages containing images and text. You might want to use Output Caching for those login pages, and then Fragment Caching for the dynamic pages. A toolbar, for example, could be cached as a fragment. For even better performance, you could cache commonly used images and boilerplate text that appear frequently on the site using the Cache API. For detailed information on caching (with sample code), check out the &lt;a href=&quot;http://www.gotdotnet.com/quickstart/aspplus/&quot;&gt;ASP. NET&lt;/a&gt; Web site.  &lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Use Session State Only If You Need To&lt;/h3&gt;
&lt;br /&gt;
One extremely powerful feature of ASP.NET is its ability to store session state for users, such as a shopping cart on an e-commerce site or a browser history. Since this is on by default, you pay the cost in memory even if you don&#39;t use it. If you&#39;re not using Session State, turn it off and save yourself the overhead by adding &lt;b&gt;&amp;lt;@% EnabledSessionState = false %&amp;gt;&lt;/b&gt; to your asp. This comes with several other options, which are explained at the &lt;a href=&quot;http://www.gotdotnet.com/quickstart/aspplus/&quot;&gt;ASP. NET&lt;/a&gt; Web site.&lt;br /&gt;
&lt;br /&gt;
For pages that only read session state, you can choose &lt;b&gt;EnabledSessionState=readonly&lt;/b&gt;. This carries less overhead than full read/write session state, and is useful when you need only part of the functionality and don&#39;t want to pay for the write capabilities.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Use View State Only If You Need To &lt;/h3&gt;
&lt;br /&gt;
An example of View State might be a long form that users must fill out: if they click &lt;b&gt;Back&lt;/b&gt; in their browser and then return, the form will remain filled. When this functionality isn&#39;t used, this state eats up memory and performance. Perhaps the largest performance drain here is that a round-trip signal must be sent across the network each time the page is loaded to update and verify the cache. Since it is on by default, you will need to specify that you do not want to use View State with &amp;lt;@% EnabledViewState = false %&amp;gt;. You should read more about View State on the the &lt;a href=&quot;http://www.gotdotnet.com/quickstart/aspplus/&quot;&gt;ASP. NET&lt;/a&gt; Web site to learn about some of the other options and settings to which you have access.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Avoid STA COM&lt;/h3&gt;
&lt;br /&gt;
Apartment COM is designed to deal with threading in unmanaged environments. There are two kinds of Apartment COM: single-threaded and multithreaded. MTA COM is designed to handle multithreading, whereas STA COM relies on the messaging system to serialize thread requests. The managed world is free-threaded, and using Single Threaded Apartment COM requires that all unmanaged threads essentially share a single thread for interop. This results in a &lt;i&gt;massive&lt;/i&gt; performance hit, and should be avoided whenever possible. If you can&#39;t port the Apartment COM object to the managed world, use &lt;b&gt;&amp;lt;@%AspCompat = &quot;true&quot; %&amp;gt;&lt;/b&gt; for pages that use them. For a more &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms809311.aspx&quot;&gt;detailed explanation of STA COM&lt;/a&gt;, see the MSDN Library.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Batch Compile&lt;/h3&gt;
&lt;br /&gt;
Always batch compile before deploying a large page into the Web. This can be initiated by doing one request to a page per directory and waiting until the CPU idles again. This prevents the Web server from being bogged down with compilations while also trying to serve out pages. &lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Remove Unnecessary Http Modules&lt;/h3&gt;
&lt;br /&gt;
Depending on the features used, remove unused or unnecessary http modules from the pipeline. Reclaiming the added memory and wasted cycles can provide you with a small speed boost.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Avoid the Autoeventwireup Feature&lt;/h3&gt;
&lt;br /&gt;
Instead of relying on &lt;b&gt;autoeventwireup&lt;/b&gt;, override the events from Page. For example, instead of writing a &lt;b&gt;Page_Load()&lt;/b&gt; method, try overloading the public &lt;b&gt;void OnLoad()&lt;/b&gt; method. This allows the run time from having to do a &lt;b&gt;CreateDelegate()&lt;/b&gt; for every page.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Encode Using ASCII When You Don&#39;t Need UTF&lt;/h3&gt;
&lt;br /&gt;
By default, ASP.NET comes configured to encode requests and responses as UTF-8. If ASCII is all your application needs, eliminated the UTF overhead can give you back a few cycles. Note that this can only be done on a per-application basis.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Use the Optimal Authentication Procedure&lt;/h3&gt;
&lt;br /&gt;
&lt;div class=&quot;normal&quot;&gt;
There are several different ways to authenticate a user and some of more expensive than others (in order of increasing cost: None, Windows, Forms, Passport). Make sure you use the cheapest one that best fits your needs.&lt;/div&gt;
&lt;br /&gt;
&lt;h2 class=&quot;dtH1&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;dotnetperftips_topic5&quot;&gt;&lt;/a&gt;Tips for Porting and Developing in Visual Basic&lt;/h2&gt;
&lt;br /&gt;
A lot has changed under the hood from Microsoft® Visual Basic® 6 to Microsoft® Visual Basic® 7, and the performance map has changed with it. Due to the added functionality and security restrictions of the CLR, some functions are simply unable to run as quickly as they did in Visual Basic 6. In fact, there are several areas where Visual Basic 7 gets trounced by its predecessor. Fortunately, there are two pieces of good news:&lt;br /&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;Most of the worst slowdowns occur during one-time functions, such as loading a control for the first time. The cost is there, but you only pay it once.&lt;/li&gt;
&lt;li&gt;There are a lot of areas where Visual Basic 7 is faster, and these areas tend to lie in functions that are repeated during run time. This means that the benefit grows over time, and in several cases will outweigh the one-time costs.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
The majority of the performance issues come from areas where the run time does not support a feature of Visual Basic 6, and it has to be added to preserve the feature in Visual Basic 7. Working outside of the run time is slower, making some features far more expensive to use. The bright side is that you can avoid these problems with a little effort. There are two main areas that require work to optimize for performance, and few simple tweaks you can do here and there. Taken together, these can help you step around performance drains, and take advantage of the functions that are much faster in Visual Basic 7.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Error Handling&lt;/h3&gt;
&lt;br /&gt;
The first concern is error handling. This has changed a lot in Visual Basic 7, and there are performance issues related to the change. Essentially, the logic required to implement &lt;b&gt;OnErrorGoto&lt;/b&gt; and &lt;b&gt;Resume&lt;/b&gt; is extremely expensive. I suggest taking a quick look at your code, and highlighting all the areas where you use the &lt;b&gt;Err&lt;/b&gt; object, or any error-handling mechanism. Now look at each of these instances, and see if you can rewrite them to use &lt;b&gt;try/catch&lt;/b&gt;. A lot of developers will find that they can convert to &lt;b&gt;try/catch&lt;/b&gt; easily for most of these cases, and they should see a good performance improvement in their program. The rule of thumb is &quot;if you can easily see the translation, do it.&quot;&lt;br /&gt;
&lt;br /&gt;
Here&#39;s an example of a simple Visual Basic program that uses &lt;b&gt;On Error Goto&lt;/b&gt; compared with the &lt;b&gt;try/catch&lt;/b&gt; version.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;tablediv&quot;&gt;
&lt;table class=&quot;dtTABLE&quot;&gt; &lt;tbody&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;td width=&quot;50%&quot;&gt;&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-10&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_00e28a5b-d536-4a72-a5fc-0ff57de612ce&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_00e28a5b-d536-4a72-a5fc-0ff57de612ce&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;Sub SubWithError()
  On Error Goto SWETrap
  Dim x As Integer
  Dim y As Integer
  x = x / y
SWETrap:
  Exit Sub
  End Sub
 

Sub SubWithErrorResumeLabel()
  On Error Goto SWERLTrap
  Dim x As Integer
  Dim y As Integer
  x = x / y 
SWERLTrap:
  Resume SWERLExit
  End Sub

SWERLExit:
  Exit Sub

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt; &lt;td width=&quot;50%&quot;&gt;&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-12&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_b98732f7-4a8e-473d-833e-dcf2e4723fb4&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_b98732f7-4a8e-473d-833e-dcf2e4723fb4&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;Sub SubWithError()
  Dim x As Integer
  Dim y As Integer
  Try
    x = x / y
  Catch
    Return
  End Try
  End Sub
 
Sub SubWithErrorResumeLabel()
  Dim x As Integer
  Dim y As Integer
  Try
    x = x / y
  Catch
  Goto SWERLExit
  End Try
 
SWERLExit:
  Return
  End Sub

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;
The speed increase is noticeable. &lt;b&gt;SubWithError()&lt;/b&gt; takes 244 milliseconds using &lt;b&gt;OnErrorGoto&lt;/b&gt;, and only 169 milliseconds using &lt;b&gt;try/catch&lt;/b&gt;. The second function takes 179 milliseconds compared to 164 milliseconds for the optimized version.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Use Early Binding&lt;/h3&gt;
&lt;br /&gt;
The second concern deals with objects and typecasting. Visual Basic 6 does a lot of work under the hood to support casting of objects, and many programmers aren&#39;t even aware of it. In Visual Basic 7, this is an area that out of which you can squeeze a lot of performance. When you compile, use &lt;i&gt;early binding&lt;/i&gt;. This tells the compiler to insert a &lt;b&gt;Type Coercion&lt;/b&gt; is only done when explicitly mentioned. This has two major effects:&lt;br /&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;Strange errors become easier to track down.&lt;/li&gt;
&lt;li&gt;Unneeded coercions are eliminated, leading to substantial performance improvements.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
When you use an object as if it were of a different type, Visual Basic will coerce the object for you if you don&#39;t specify. This is handy, since the programmer has to worry about less code. The downside is that these coercions can do unexpected things, and the programmer has no control over them. &lt;br /&gt;
&lt;br /&gt;
There are instances when you have to use late binding, but most of the time if you&#39;re not sure then you can get away with early binding. For Visual Basic 6 programmers, this can be a bit awkward at first, since you have to worry about types more than in the past. This should be easy for new programmers, and people familiar with Visual Basic 6 will pick it up in no time.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Turn On Option Strict and Explicit&lt;/h3&gt;
&lt;br /&gt;
With Option Strict on, you protect yourself from inadvertent late binding and enforce a higher level of coding discipline. For a list of the restrictions present with Option Strict, see the MSDN Library. The caveat to this is that all narrowing type coercions must be explicitly specified. However, this in itself may uncover other sections of your code that are doing more work than you had previously thought, and it may help you stomp some bugs in the process.&lt;br /&gt;
&lt;br /&gt;
Option Explicit is less restrictive than Option Strict, but it still forces programmers to provide more information in their code. Specifically, you must declare a variable before using it. This moves the type-inference from the run time into compile time. This eliminated check translates into added performance for you.&lt;br /&gt;
&lt;br /&gt;
I recommend that you start with Option Explicit, and then turn on Option Strict. This will protect you from a deluge of compiler errors, and allow you to gradually start working in the stricter environment. When both of these options are used, you ensure maximum performance for your application.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Use Binary Compare for Text&lt;/h3&gt;
&lt;br /&gt;
When comparing text, use binary compare instead of text compare. At run time, the overhead is much lighter for binary. &lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Minimize the Use of Format()&lt;/h3&gt;
&lt;br /&gt;
When you can, use &lt;b&gt;toString()&lt;/b&gt; instead of &lt;b&gt;format()&lt;/b&gt;. In most cases, it will provide you with the functionality you need, with much less overhead.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Use Charw&lt;/h3&gt;
&lt;br /&gt;
Use charw instead of char. The CLR uses Unicode internally, and char&lt;code&gt; &lt;/code&gt;must be translated at run time if it is used. This can result in a substantial performance loss, and specifying that your characters are a full word long (using charw&lt;code&gt;)&lt;/code&gt; eliminates this conversion. &lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Optimize Assignments&lt;/h3&gt;
&lt;br /&gt;
Use &lt;b&gt;exp += val&lt;/b&gt; instead of &lt;b&gt;exp = exp + val&lt;/b&gt;. Since &lt;b&gt;exp&lt;/b&gt;&lt;code&gt; &lt;/code&gt;can be arbitrarily complex, this can result in lots of unnecessary work. This forces the JIT to evaluate both copies of &lt;b&gt;exp&lt;/b&gt;, and many times this is not needed. The first statement can be optimized far better than the second, since the JIT can avoid evaluating the &lt;b&gt;exp&lt;/b&gt; twice.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Avoid Unnecessary Indirection&lt;/h3&gt;
&lt;br /&gt;
When you use &lt;b&gt;byRef&lt;/b&gt;, you pass pointers instead of the actual object. Many times this makes sense (side-effecting functions, for example), but you don&#39;t always need it. Passing pointers results in more indirection, which is slower than accessing a value that is on the stack. When you don&#39;t need to go through the heap, it is best to avoid it.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Put Concatenations in One Expression&lt;/h3&gt;
&lt;br /&gt;
If you have multiple concatenations on multiple lines, try to stick them all on one expression. The compiler can optimize by modifying the string in place, providing a speed and memory boost. If the statements are split into multiple lines, the Visual Basic compiler will not generate the Microsoft Intermediate Language (MSIL) to allow in-place concatenation. See the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms973839.aspx#dotnetperftips_topic2a&quot;&gt;StringBuilder example&lt;/a&gt; discussed earlier.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Include Return Statements&lt;/h3&gt;
&lt;br /&gt;
Visual Basic allows a function to return a value without using the &lt;b&gt;return&lt;/b&gt; statement. While Visual Basic 7 supports this, explicitly using &lt;b&gt;return&lt;/b&gt; allows the JIT to perform slightly more optimizations. Without a return statement, each function is given several local variables on stack to transparently support returning values without the keyword. Keeping these around makes it harder for the JIT to optimize, and can impact the performance of your code. Look through your functions and insert &lt;b&gt;return&lt;/b&gt; as needed. It doesn&#39;t change the semantics of the code at all, and it can help you get more speed from your application.&lt;br /&gt;
&lt;br /&gt;
&lt;h2 class=&quot;dtH1&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;dotnetperftips_topic6&quot;&gt;&lt;/a&gt;Tips for Porting and Developing in Managed C++&lt;/h2&gt;
&lt;br /&gt;
Microsoft is targeting Managed C++ (MC++) at a specific set of developers. MC++ is &lt;i&gt;not the best tool for every job&lt;/i&gt;. After reading this document, you may decide that C++ is not the best tool, and that the tradeoff costs are not worth the benefits. If you aren&#39;t sure about MC++, there are many good &lt;a href=&quot;http://msdn.microsoft.com/vstudio/techinfo/articles/upgrade/managedext.asp&quot;&gt;resources&lt;/a&gt; to help you make your decision This section is targeted at developers who have already decided that they want to use MC++ in some way, and want to know about the performance aspects of it.&lt;br /&gt;
&lt;br /&gt;
For C++ developers, working Managed C++ requires that several decisions be made. Are you porting some old code? If so, do you want to move the entire thing to managed space or are you instead planning to implement a wrapper? I&#39;m going to focus on the &#39;port-everything&#39; option or deal with writing MC++ from scratch for the purposes of this discussion, since those are the scenarios where the programmer will notice a performance difference.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Benefits of the Managed World&lt;/h3&gt;
&lt;br /&gt;
The most powerful feature of Managed C++ is the ability to mix and match managed and unmanaged code at the &lt;i&gt;expression level&lt;/i&gt;. No other language allows you to do this, and there are some powerful benefits you can get from it if used properly. I&#39;ll walk through some examples of this later on.&lt;br /&gt;
&lt;br /&gt;
The managed world also gives you huge design wins, in that a lot of common problems are taken care of for you. Memory management, thread scheduling and type coercions can be left to the run time if you desire, allowing you to focus your energies on the parts of the program that need it. With MC++, you can choose exactly how much control you want to keep. &lt;br /&gt;
&lt;br /&gt;
MC++ programmers have the luxury of being able to use the Microsoft Visual C® 7 (VC7) backend when compiling to IL, and then using the JIT on top of that. Programmers that are used to working with the Microsoft C++ compiler are used to things being lightning-fast. The JIT was designed with different goals, and has a different set of strengths and weaknesses. The VC7 compiler, not bound by the time restrictions of the JIT, can perform certain optimizations that the JIT cannot, such as whole-program analysis, more aggressive inlining and enregistration. There are also some optimizations that can be performed only in typesafe environments, leaving more room for speed than C++ allows.&lt;br /&gt;
&lt;br /&gt;
Because of the different priorities in the JIT, some operations are faster than before while others are slower. There are tradeoffs you make for safety and language flexibility, and some of them aren&#39;t cheap. Fortunately, there are things a programmer can do to minimize the costs.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Porting: All C++ Code Can Compile to MSIL&lt;/h3&gt;
&lt;br /&gt;
Before we go any further, it&#39;s important to note that you can compile &lt;i&gt;any &lt;/i&gt;C++ code into MSIL. Everything will work, but there&#39;s no guarantee of type-safety and you pay the marshalling penalty if you do a lot of interop. Why is it helpful to compile to MSIL if you don&#39;t get any of the benefits? In situations where you are porting a large code base, this allows you to gradually port your code in pieces. You can spend your time porting more code, rather than writing special wrappers to glue the ported and not-yet-ported code together if you use MC++, and that can result in a big win. It makes porting applications a very clean process. To learn more about compiling C++ to MSIL, take a look at the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.xml.xmlvalidatingreader.readtypedvalue.aspx&quot;&gt;/clr compiler option&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
However, simply compiling your C++ code to MSIL doesn&#39;t give you the security or flexibility of the managed world. You need to write in MC++, and in v1 that means giving up a few features. The list below is not supported in the current version of the CLR, but may be in the future. Microsoft chose to support the most common features first, and had to cut some others in order to ship. There is nothing that prevents them from being added later, but in the meantime you will need to do without them:&lt;br /&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;Multiple Inheritance&lt;/li&gt;
&lt;li&gt;Templates&lt;/li&gt;
&lt;li&gt;Deterministic Finalization&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
You can always interoperate with unsafe code if you need those features, but you will pay the performance penalty of marshalling data back and forth. And bear in mind that those features can only be used inside the unmanaged code. The managed space has no knowledge of their existence. If you are deciding to port your code, think about how much you rely on those features in your design. In a few cases, the redesign is too expensive and you will want to stick with unmanaged code. This is the first decision you should make, before you start hacking.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Advantages of MC++ Over C# or Visual Basic&lt;/h3&gt;
&lt;br /&gt;
Coming from an unmanaged background, MC++ preserves a lot of the ability to handle unsafe code. MC++&#39;s ability to mix managed and unmanaged code smoothly provides the developer with a lot of power, and you can choose where on the gradient you want to sit when writing your code. On one extreme, you can write everything in straight, unadulterated C++ and just compile with &lt;b&gt;/clr&lt;/b&gt;. On the other, you can write everything as managed objects and deal with the language limitations and performance problems mentioned above.&lt;br /&gt;
&lt;br /&gt;
But the real power of MC++ comes when you choose somewhere in between. MC++ allows you to tweak some of the performance hits inherent in managed code, by giving you precise control over when to use unsafe features. C# has some of this functionality in the &lt;b&gt;unsafe&lt;/b&gt; keyword, but it&#39;s not an integral part of the language and it is far less useful than MC++. Let&#39;s step through some examples showing the finer granularity available in MC++, and we&#39;ll talk about the situations where it comes in handy.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Generalized &quot;byref&quot; pointers&lt;/h3&gt;
&lt;br /&gt;
In C# you can only take the address of some member of a class by passing it to a &lt;b&gt;ref &lt;/b&gt;parameter. In MC++, a byref pointer is a first-class construct. You can take the address of an item in the middle of an array and return that address from a function:&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-14&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_25a8bc1b-7dc2-458c-96e2-0c713b7e5244&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_25a8bc1b-7dc2-458c-96e2-0c713b7e5244&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;Byte* AddrInArray( Byte b[] ) {
   return &amp;amp;b[5];
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
We exploit this feature for returning a pointer to the &quot;characters&quot; in a System.String via our helper routine, and we can even loop through arrays using these pointers:&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-15&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_da8133f2-2c2d-4bcb-9633-570e8f38bb78&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_da8133f2-2c2d-4bcb-9633-570e8f38bb78&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;System::Char* PtrToStringChars(System::String*);   
for( Char*pC = PtrToStringChars(S&quot;boo&quot;);
  pC != NULL;
  pC++ )
{
      ... *pC ...
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
You can also do a linked-list traversal with injection in MC++ by taking the address of the &quot;next&quot; field (which you cannot do in C#):&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-16&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_765cd98d-f679-445d-a7c0-a2eda26bc1f6&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_765cd98d-f679-445d-a7c0-a2eda26bc1f6&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;Node **w = &amp;amp;Head;
while(true) {
  if( *w == 0 || val &amp;lt; (*w)-&amp;gt;val ) {
    Node *t = new Node(val,*w);
    *w = t;
    break;
  }
  w = &amp;amp;(*w)-&amp;gt;next;
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
In C#, you can&#39;t point to &quot;Head&quot;, or take the address of the &quot;next&quot; field, so you have make a special-case where you&#39;re inserting at the first location, or if &quot;Head&quot; is null. Moreover, you have to look one node ahead all the time in the code. Compare this to what a good C# would produce:&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-17&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_a1a5adc8-2734-4ffe-bb30-e1c92fd3b34a&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_a1a5adc8-2734-4ffe-bb30-e1c92fd3b34a&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;if( Head==null || val &amp;lt; Head.val ) {
  Node t = new Node(val,Head);
  Head = t;
}else{
  // we know at least one node exists,
  // so we can look 1 node ahead
  Node w=Head;
while(true) {
  if( w.next == null || val &amp;lt; w.next.val ){
    Node t = new Node(val,w.next.next);
    w.next = t;
    break;
  }
  w = w.next;
  }
}         
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
User Access to Boxed Types&lt;/h3&gt;
&lt;br /&gt;
A performance problem common with OO languages is the time spent boxing and unboxing values. MC++ gives you a lot more control over this behavior, so you won&#39;t have to dynamically (or statically) unbox to access values. This is another performance enhancement. Just place &lt;b&gt;__box &lt;/b&gt;keyword before any type to represent its boxed form:&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-18&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_e1f471d8-b233-4296-beaa-0af196b10d73&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_e1f471d8-b233-4296-beaa-0af196b10d73&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;__value struct V {
  int i;
};
int main() {
  V v = {10};
  __box V *pbV = __box(v);
  pbV-&amp;gt;i += 10;           // update without casting
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
In C# you have to unbox to a &quot;v&quot;, then update the value and re-box back to an Object:&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-19&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_cad05b52-9253-4539-9433-3b4a5dc2c30c&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_cad05b52-9253-4539-9433-3b4a5dc2c30c&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;struct B { public int i; }
static void Main() {
  B b = new B();
  b.i = 5;
  object o = b;         // implicit box
  B b2 = (B)o;            // explicit unbox
  b2.i++;               // update
  o = b2;               // implicit re-box
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
STL Collections vs. Managed Collections—v1&lt;/h3&gt;
&lt;br /&gt;
The bad news: In C++, using the STL Collections was often just as fast as writing that functionality by hand. The CLR frameworks are very fast, but they suffer from boxing and unboxing issues: everything is an object, and without template or generic support, all actions have to be checked at run time.&lt;br /&gt;
&lt;br /&gt;
The good news: In the long term, you can bet that this problem will go away as generics are added to the run time. Code you deploy today will experience the speed boost without any changes. In the short term, you can use static casting to prevent the check, but this is no longer safe. I recommend using this method in tight code where performance is absolutely critical, and you&#39;ve identified two or three hot spots.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Use Stack Managed Objects&lt;/h3&gt;
&lt;br /&gt;
In C++, you specify that an object should be managed by the stack or the heap. You can still do this in MC++, but there are restrictions you should be aware of. The CLR uses ValueTypes for all stack-managed objects, and there are limitations to what ValueTypes can do (no inheritance, for example). &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa735672.aspx&quot;&gt;More information&lt;/a&gt; is available on the MSDN Library.&lt;br /&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Corner Case: Beware Indirect Calls Within Managed Code—v1&lt;/h3&gt;
&lt;br /&gt;
In the v1 run time, all indirect function calls are made natively, and therefore require a transition into unmanaged space. Any indirect function call can only be made from native mode, which means that all indirect calls from managed code need a managed-to-unmanaged transition. This is a serious problem when the table returns a managed function, since a &lt;i&gt;second&lt;/i&gt; transition must then be made to execute the function. When compared to the cost of executing a single &lt;b&gt;Call&lt;/b&gt; instruction, the cost is fifty- to one hundred times&lt;b&gt; &lt;/b&gt;slower than in C++!&lt;br /&gt;
&lt;br /&gt;
Fortunately, when you are calling a method that resides within a garbage-collected class, optimization removes this. However, in the specific case of a regular C++ file that has been compiled using &lt;b&gt;/clr&lt;/b&gt;, the method return will be considered managed. Since this cannot be removed by optimization, you are hit with the full double-transition cost. Below is an example of such a case.&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-20&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_af684424-a9ab-44eb-b4a6-8ee9483d79c6&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_af684424-a9ab-44eb-b4a6-8ee9483d79c6&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;//////////////////////// a.h:    //////////////////////////
class X {
public:
   void mf1();
   void mf2();
};

typedef void (X::*pMFunc_t)();


////////////// a.cpp: compiled with /clr  /////////////////
#include &quot;a.h&quot;

int main(){
   pMFunc_t pmf1 = &amp;amp;X::mf1;
   pMFunc_t pmf2 = &amp;amp;X::mf2;

   X *pX = new X();
   (pX-&amp;gt;*pmf1)();
   (pX-&amp;gt;*pmf2)();

   return 0;
}


////////////// b.cpp: compiled without /clr /////////////////
#include &quot;a.h&quot;

void X::mf1(){}


////////////// c.cpp: compiled with /clr ////////////////////
#include &quot;a.h&quot;
void X::mf2(){}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
There are several ways to avoid this:&lt;br /&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;Make the class into a managed class (&quot;__gc&quot;)&lt;/li&gt;
&lt;li&gt;Remove the indirect call, if possible&lt;/li&gt;
&lt;li&gt;Leave the class compiled as unmanaged code (e.g. do not use &lt;b&gt;/clr&lt;/b&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Minimize Performance Hits—version 1&lt;/h3&gt;
&lt;br /&gt;
There are several operations or features that are simply more expensive in MC++ under version 1 JIT. I&#39;ll list them and give some explanation, and then we&#39;ll talk about what you can do about them.&lt;br /&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;Abstractions—This is an area where the beefy, slow C++ backend compiler wins heavily over the JIT. If you wrap an int inside a class for abstraction purposes, and you access it strictly as an int, the C++ compiler can reduce the overhead of the wrapper to practically nothing. You can add many levels of abstraction to the wrapper, without increasing the cost. The JIT is unable to take the time necessary to eliminate this cost, making deep abstractions more expensive in MC++.&lt;/li&gt;
&lt;li&gt;Floating Point—The v1 JIT does not currently perform all the FP-specific optimizations that the VC++ backend does, making floating point operations more expensive for now.&lt;/li&gt;
&lt;li&gt;Multidimensional Arrays—The JIT is better at handling jagged arrays than multidimensional ones, so use jagged arrays instead.&lt;/li&gt;
&lt;li&gt;64 bit Arithmetic—In future versions, 64-bit optimizations will be added to the JIT.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
What You Can Do&lt;/h3&gt;
&lt;br /&gt;
At every phase of development, there are several things you can do. With MC++, the design phase is perhaps the most important area, as it will determine how much work you end up doing and how much performance you get in return. When you sit down to write or port an application, you should consider the following things:&lt;br /&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;Identify areas where you use multiple inheritance, templates, or deterministic finalization. You will have to get rid of these, or else leave that part of your code in unmanaged space. Think about the cost of redesigning, and identify areas that can be ported.&lt;/li&gt;
&lt;li&gt;Locate performance hot spots, such as deep abstractions or virtual function calls across managed space. These will also require a design decision.&lt;/li&gt;
&lt;li&gt;Look for objects that have been specified as stack-managed. Make sure they can be converted into ValueTypes. Mark the others for conversion to heap-managed objects.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
During the coding stage, you should be aware of the operations that are more expensive and the options you have in dealing with them. One of the nicest things about MC++ is that you come to grips with all the performance issues up front, before you start coding: this is helpful in paring down work later on. However, there are still some tweaks you can perform while you code and debug.&lt;br /&gt;
&lt;br /&gt;
Determine which areas make heavy use of floating point arithmetic, multidimensional arrays or library functions. Which of these areas are performance critical? Use profilers to pick the fragments where the overhead is costing you most, and pick which option seems best:&lt;br /&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;Keep the whole fragment in unmanaged space.&lt;/li&gt;
&lt;li&gt;Use static casts on the library accesses.&lt;/li&gt;
&lt;li&gt;Try tweaking boxing/unboxing behavior (explained later).&lt;/li&gt;
&lt;li&gt;Code your own structure.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Finally, work to minimize the number of transitions you make. If you have some unmanaged code or an interop call sitting in a loop, make the entire loop unmanaged. That way you&#39;ll only pay the transition cost twice, rather than for each iteration of the loop. &lt;br /&gt;
&lt;br /&gt;
&lt;h2 class=&quot;dtH1&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;dotnetperftips_topic7&quot;&gt;&lt;/a&gt;Additional Resources&lt;/h2&gt;
&lt;br /&gt;
Related topics on performance in the .NET Framework include: &lt;br /&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms973838.aspx&quot;&gt;Performance Considerations of Run-Time Technologies in the .NET Framework&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Watch for future articles currently under development, including an overview of design, architectural and coding philosophies, a walkthrough of performance analysis tools in the managed world, and a performance comparison of .NET to other enterprise applications available today.&lt;br /&gt;
&lt;br /&gt;
&lt;h2 class=&quot;dtH1&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;dotnetperftips_topic8&quot;&gt;&lt;/a&gt;Appendix: Cost of Virtual Calls and Allocations&lt;/h2&gt;
&lt;br /&gt;
&lt;div class=&quot;tablediv&quot;&gt;
&lt;table class=&quot;dtTABLE&quot;&gt; &lt;tbody&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;th width=&quot;60%&quot;&gt;Call Type&lt;/th&gt; &lt;th width=&quot;40%&quot;&gt;# Calls/sec&lt;/th&gt; &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;td width=&quot;60%&quot;&gt;ValueType Non-Virtual Call&lt;/td&gt; &lt;td width=&quot;40%&quot;&gt;809971805.600&lt;/td&gt; &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;td width=&quot;60%&quot;&gt;Class Non-Virtual Call&lt;/td&gt; &lt;td width=&quot;40%&quot;&gt;268478412.546&lt;/td&gt; &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;td width=&quot;60%&quot;&gt;Class Virtual Call&lt;/td&gt; &lt;td width=&quot;40%&quot;&gt;109117738.369&lt;/td&gt; &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;td width=&quot;60%&quot;&gt;ValueType Virtual (Obj Method) Call&lt;/td&gt; &lt;td width=&quot;40%&quot;&gt;3004286.205&lt;/td&gt; &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;td width=&quot;60%&quot;&gt;ValueType Virtual (Overridden Obj Method) Call&lt;/td&gt; &lt;td width=&quot;40%&quot;&gt;2917140.844&lt;/td&gt; &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;td width=&quot;60%&quot;&gt;Load Type by Newing (Non-Static)&lt;/td&gt; &lt;td width=&quot;40%&quot;&gt;1434.720&lt;/td&gt; &lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt; &lt;td width=&quot;60%&quot;&gt;Load Type by Newing (Virtual Methods)&lt;/td&gt; &lt;td width=&quot;40%&quot;&gt;1369.863&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;fineprint&quot;&gt;
Note   The test machine is a PIII 733Mhz, running Windows 2000 Professional with Service Pack 2.&lt;/div&gt;
&lt;br /&gt;
This chart compares the cost associated with different types of method calls, as well as the cost of instantiating a type that contains virtual methods. The higher the number, the more calls/instantiations-per-second can be performed. While these numbers will certainly vary on different machines and configurations, the relative cost of performing one call over another remains significant. &lt;br /&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;ValueType Non-Virtual Call: This test calls an empty non-virtual method contained within a ValueType.&lt;/li&gt;
&lt;li&gt;Class Non-Virtual Call: This test calls an empty non-virtual method contained within a class.&lt;/li&gt;
&lt;li&gt;Class Virtual Call: This test calls an empty virtual method contained within a class.&lt;/li&gt;
&lt;li&gt;ValueType Virtual (Obj Method) Call: This test calls &lt;b&gt;ToString()&lt;/b&gt; (a virtual method) on a ValueType, which resorts to the default object method.&lt;/li&gt;
&lt;li&gt;ValueType Virtual (Overridden Obj Method) Call: This test calls &lt;b&gt;ToString()&lt;/b&gt; (a virtual method) on a ValueType that has overridden the default. &lt;/li&gt;
&lt;li&gt;Load Type by Newing (Static): This test allocates space for a class with only static methods.&lt;/li&gt;
&lt;li&gt;Load Type by Newing (Virtual Methods): This test allocates space for a class with virtual methods.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
One conclusion you can draw is that &lt;b&gt;Virtual Function&lt;/b&gt; calls are about two times as expensive as regular calls when you&#39;re calling a method in a class. Bear in mind that calls are cheap to begin with, so I wouldn&#39;t remove all virtual calls. You should always use virtual methods when it makes sense to do so.&lt;br /&gt;
&lt;ul type=&quot;disc&quot;&gt;
&lt;li&gt;The JIT cannot inline virtual methods, so you lose a potential optimization if you get rid of non-virtual methods.&lt;/li&gt;
&lt;li&gt;Allocating space for an object that has virtual methods is slightly slower than the allocation for an object without them, since extra work must be done to find space for the virtual tables.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Notice that calling a non-virtual method within a ValueType is more than three times as fast as in a class, but once you treat it &lt;i&gt;as a class&lt;/i&gt; you lose terribly. This is characteristic of ValueTypes: treat them like structs and they&#39;re lighting fast. Treat them like classes and they&#39;re painfully slow. &lt;b&gt;ToString()&lt;/b&gt; is a virtual method, so before it can be called, the struct must be converted to an object on the heap. Instead of being twice as slow, calling a virtual method on a ValueType is now eighteen times as slow! The moral of the story? Don&#39;t treat ValueTypes as classes.</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/1707839607975781395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2013/07/performance-tips-and-tricks-in-net.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/1707839607975781395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/1707839607975781395'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2013/07/performance-tips-and-tricks-in-net.html' title='Performance Tips and Tricks in .NET Applications'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-1693208260453032867</id><published>2013-06-30T22:23:00.002+03:00</published><updated>2013-06-30T22:23:41.818+03:00</updated><title type='text'>Generate insert statements from a specific table data using SQL Server 2005</title><content type='html'>&lt;h1 class=&quot;fn&quot; id=&quot;ctl00_ArticleTitle&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Generate insert statements from a specific table data using SQL Server 2005&lt;/span&gt;&lt;/h1&gt;
&lt;div class=&quot;entry&quot;&gt;
      Thanks &lt;span class=&quot;author&quot;&gt;&lt;a href=&quot;http://www.codeproject.com/script/Membership/View.aspx?mid=9709891&quot; rel=&quot;author&quot;&gt;Tharaka MTR&lt;/a&gt;&lt;/span&gt;,&amp;nbsp;&lt;span class=&quot;date&quot;&gt;by Code Project&lt;/span&gt;&lt;/div&gt;
&lt;!-- Tables. Yes. I&#39;m weak --&gt;&lt;form action=&quot;/Articles/598148/Generate-insert-statements-from&quot; id=&quot;aspnetForm&quot; method=&quot;post&quot; name=&quot;aspnetForm&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;
&lt;/form&gt;
&lt;br /&gt;
&lt;div class=&quot;text&quot; id=&quot;contentdiv&quot;&gt;
When you are deploying your application, sometimes you may want to &lt;span class=&quot;search-highlight&quot;&gt;generate&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;script&lt;/span&gt; with the &lt;span class=&quot;search-highlight&quot;&gt;insert&lt;/span&gt; statement of the specific &lt;span class=&quot;search-highlight&quot;&gt;data&lt;/span&gt;base &lt;span class=&quot;search-highlight&quot;&gt;table&lt;/span&gt;. In this article I will show you two easiest ways to do this with &lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Server&lt;/span&gt; and &lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Server&lt;/span&gt; tools.&lt;br /&gt;
1. Using &lt;span class=&quot;search-highlight&quot;&gt;Data&lt;/span&gt;base Publishing Wizard (“&lt;span class=&quot;search-highlight&quot;&gt;Sql&lt;/span&gt;PubWiz.exe”)&lt;br /&gt;
If you install Visual studio 2008 / Visual Studio 2008 Express full version, it will automatically install the Microsoft &lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Server&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Data&lt;/span&gt; Publishing Wizard on the following location.&lt;br /&gt;&lt;strong&gt;&lt;em&gt;&lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Server&lt;/span&gt; Installation Location]\90\Tools\Publishing\[version]\ &lt;span class=&quot;search-highlight&quot;&gt;Sql&lt;/span&gt;PubWiz.exe&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;
If it is not there you can download it from the following URL&lt;br /&gt;&lt;a href=&quot;http://go.microsoft.com/fwlink/?LinkId=119368&quot;&gt;http://go.microsoft.com/fwlink/?LinkId=119368&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 370px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image002.jpg&quot;&gt;&lt;img alt=&quot;SQLPubWiz location&quot; border=&quot;0&quot; height=&quot;365&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image002_thumb.jpg?w=360&amp;amp;h=365&quot; title=&quot;SQLPubWiz location&quot; width=&quot;360&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt;PubWiz location&lt;/div&gt;
&lt;/div&gt;
When you run the “&lt;span class=&quot;search-highlight&quot;&gt;Sql&lt;/span&gt;PubWiz.exe”, it will open the &lt;span class=&quot;search-highlight&quot;&gt;data&lt;/span&gt;base publishing wizard&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 375px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image004.jpg&quot;&gt;&lt;img alt=&quot;Database Publishing Wizard&quot; border=&quot;0&quot; height=&quot;333&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image004_thumb.jpg?w=365&amp;amp;h=333&quot; title=&quot;Database Publishing Wizard&quot; width=&quot;365&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;Data&lt;/span&gt;base Publishing Wizard&lt;/div&gt;
&lt;/div&gt;
Click next and enter the &lt;span class=&quot;search-highlight&quot;&gt;data&lt;/span&gt;base &lt;span class=&quot;search-highlight&quot;&gt;server&lt;/span&gt; connection information accordingly.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 378px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image006.jpg&quot;&gt;&lt;img alt=&quot;Database Publishing Wizard - Database Server Connection&quot; border=&quot;0&quot; height=&quot;332&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image006_thumb.jpg?w=368&amp;amp;h=332&quot; title=&quot;Database Publishing Wizard - Database Server Connection&quot; width=&quot;368&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;Data&lt;/span&gt;base Publishing Wizard – &lt;span class=&quot;search-highlight&quot;&gt;Data&lt;/span&gt;base &lt;span class=&quot;search-highlight&quot;&gt;Server&lt;/span&gt; Connection&lt;/div&gt;
&lt;/div&gt;
Click next, and it will ask you to select the &lt;span class=&quot;search-highlight&quot;&gt;data&lt;/span&gt;base, which you want to &lt;span class=&quot;search-highlight&quot;&gt;generate&lt;/span&gt; the &lt;span class=&quot;search-highlight&quot;&gt;data&lt;/span&gt; from&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 379px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image008.jpg&quot;&gt;&lt;img alt=&quot;Database Publishing Wizard - Select Database&quot; border=&quot;0&quot; height=&quot;332&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image008_thumb.jpg?w=369&amp;amp;h=332&quot; title=&quot;Database Publishing Wizard - Select Database&quot; width=&quot;369&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;Data&lt;/span&gt;base Publishing Wizard – Select &lt;span class=&quot;search-highlight&quot;&gt;Data&lt;/span&gt;base&lt;/div&gt;
&lt;/div&gt;
Next screen will ask to select the Object type. You can use this &lt;span class=&quot;search-highlight&quot;&gt;data&lt;/span&gt;base publishing wizard to &lt;span class=&quot;search-highlight&quot;&gt;generate&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;data&lt;/span&gt; and schema both. In here I consider only for the &lt;span class=&quot;search-highlight&quot;&gt;data&lt;/span&gt; generation part. Now choose “&lt;span class=&quot;search-highlight&quot;&gt;Table&lt;/span&gt;s” as an option and click next. (Make sure to uncheck “&lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt; all objects in the selected &lt;span class=&quot;search-highlight&quot;&gt;data&lt;/span&gt;base”)&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 379px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image010.jpg&quot;&gt;&lt;img alt=&quot;Database Publishing Wizard - Choose Object Type&quot; border=&quot;0&quot; height=&quot;335&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image010_thumb.jpg?w=369&amp;amp;h=335&quot; title=&quot;Database Publishing Wizard - Choose Object Type&quot; width=&quot;369&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;Data&lt;/span&gt;base Publishing Wizard – Choose Object Type&lt;/div&gt;
&lt;/div&gt;
Then, the next ask to select the &lt;span class=&quot;search-highlight&quot;&gt;table&lt;/span&gt; which you want to &lt;span class=&quot;search-highlight&quot;&gt;generate&lt;/span&gt; the &lt;span class=&quot;search-highlight&quot;&gt;data&lt;/span&gt; from. Select whatever the &lt;span class=&quot;search-highlight&quot;&gt;table&lt;/span&gt; you want and click next.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 388px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image012.jpg&quot;&gt;&lt;img alt=&quot;Database Publishing Wizard - Choose Tables&quot; border=&quot;0&quot; height=&quot;341&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image012_thumb.jpg?w=378&amp;amp;h=341&quot; title=&quot;Database Publishing Wizard - Choose Tables&quot; width=&quot;378&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;Data&lt;/span&gt;base Publishing Wizard – Choose &lt;span class=&quot;search-highlight&quot;&gt;Table&lt;/span&gt;s&lt;/div&gt;
&lt;/div&gt;
Next step ask to specify the output location. You can enter the file name and the location there.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 395px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image014.jpg&quot;&gt;&lt;img alt=&quot;Database Publishing Wizard - Select an Output Location&quot; border=&quot;0&quot; height=&quot;350&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image014_thumb.jpg?w=385&amp;amp;h=350&quot; title=&quot;Database Publishing Wizard - Select an Output Location&quot; width=&quot;385&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;Data&lt;/span&gt;base Publishing Wizard – Select an Output Location&lt;/div&gt;
&lt;/div&gt;
By clicking Next, It shows to select the publishing options. There are three publishing types, &lt;strong&gt;Schema only&lt;/strong&gt;, &lt;strong&gt;&lt;span class=&quot;search-highlight&quot;&gt;Data&lt;/span&gt; only&lt;/strong&gt;, or &lt;strong&gt;Schema and &lt;span class=&quot;search-highlight&quot;&gt;data&lt;/span&gt;. &lt;/strong&gt;Here you have to select&lt;strong&gt; “&lt;span class=&quot;search-highlight&quot;&gt;Data&lt;/span&gt; only”.&lt;/strong&gt;&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 395px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image016.jpg&quot;&gt;&lt;img alt=&quot;Database Publishing Wizard - Select Publishing Option&quot; border=&quot;0&quot; height=&quot;348&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image016_thumb.jpg?w=385&amp;amp;h=348&quot; title=&quot;Database Publishing Wizard - Select Publishing Option&quot; width=&quot;385&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;Data&lt;/span&gt;base Publishing Wizard – Select Publishing Option&lt;/div&gt;
&lt;/div&gt;
Click next and it will &lt;span class=&quot;search-highlight&quot;&gt;generate&lt;/span&gt; the &lt;span class=&quot;search-highlight&quot;&gt;insert&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;script&lt;/span&gt; for you.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 396px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image018.jpg&quot;&gt;&lt;img alt=&quot;Database Publishing Wizard - Publishing Progress&quot; border=&quot;0&quot; height=&quot;349&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image018_thumb.jpg?w=386&amp;amp;h=349&quot; title=&quot;Database Publishing Wizard - Publishing Progress&quot; width=&quot;386&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;Data&lt;/span&gt;base Publishing Wizard – Publishing Progress&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 401px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image019.png&quot;&gt;&lt;img alt=&quot;Database Publishing Wizard - Generated Script&quot; border=&quot;0&quot; height=&quot;136&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image019_thumb.png?w=391&amp;amp;h=136&quot; title=&quot;Database Publishing Wizard - Generated Script&quot; width=&quot;391&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;Data&lt;/span&gt;base Publishing Wizard – &lt;span class=&quot;search-highlight&quot;&gt;Generate&lt;/span&gt;d &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
2. Using &lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Server&lt;/span&gt; &lt;em&gt;&lt;span class=&quot;search-highlight&quot;&gt;Generate&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt;&lt;/em&gt; wizard&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 401px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image021.jpg&quot;&gt;&lt;img alt=&quot;SQL Server Generate Script&quot; border=&quot;0&quot; height=&quot;415&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image021_thumb.jpg?w=391&amp;amp;h=415&quot; title=&quot;SQL Server Generate Script&quot; width=&quot;391&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Server&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Generate&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
When you select “&lt;span class=&quot;search-highlight&quot;&gt;Generate&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt;” menu item, it will open the &lt;span class=&quot;search-highlight&quot;&gt;Generate&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Server&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt;s Wizard dialog.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 397px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image023.jpg&quot;&gt;&lt;img alt=&quot;SQL Server Generate Script - Wizard Dialog&quot; border=&quot;0&quot; height=&quot;350&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image023_thumb.jpg?w=387&amp;amp;h=350&quot; title=&quot;SQL Server Generate Script - Wizard Dialog&quot; width=&quot;387&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Server&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Generate&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt; – Wizard Dialog&lt;/div&gt;
&lt;/div&gt;
By clicking next, it asks to select the &lt;span class=&quot;search-highlight&quot;&gt;data&lt;/span&gt;base which you want to &lt;span class=&quot;search-highlight&quot;&gt;generate&lt;/span&gt; the &lt;span class=&quot;search-highlight&quot;&gt;script&lt;/span&gt;.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 398px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image025.jpg&quot;&gt;&lt;img alt=&quot;SQL Server Generate Script Wizard - Select Database&quot; border=&quot;0&quot; height=&quot;351&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image025_thumb.jpg?w=388&amp;amp;h=351&quot; title=&quot;SQL Server Generate Script Wizard - Select Database&quot; width=&quot;388&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Server&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Generate&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt; Wizard – Select &lt;span class=&quot;search-highlight&quot;&gt;Data&lt;/span&gt;base&lt;/div&gt;
&lt;/div&gt;
By clicking Next, It shows to select the &lt;span class=&quot;search-highlight&quot;&gt;script&lt;/span&gt; options dialog box. In here, you change the “&lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Data&lt;/span&gt;” as “True” and click the next button&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 402px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image027.jpg&quot;&gt;&lt;img alt=&quot;SQL Server Generate Script Wizard - Choose Script Option&quot; border=&quot;0&quot; height=&quot;355&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image027_thumb.jpg?w=392&amp;amp;h=355&quot; title=&quot;SQL Server Generate Script Wizard - Choose Script Option&quot; width=&quot;392&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Server&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Generate&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt; Wizard – Choose &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt; Option&lt;/div&gt;
&lt;/div&gt;
Next screen will ask to select the Object type. Now choose “&lt;span class=&quot;search-highlight&quot;&gt;Table&lt;/span&gt;s” as an option and click next.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 407px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image029.jpg&quot;&gt;&lt;img alt=&quot;SQL Server Generate Script Wizard - Choose Object Type&quot; border=&quot;0&quot; height=&quot;359&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image029_thumb.jpg?w=397&amp;amp;h=359&quot; title=&quot;SQL Server Generate Script Wizard - Choose Object Type&quot; width=&quot;397&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Server&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Generate&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt; Wizard – Choose Object Type&lt;/div&gt;
&lt;/div&gt;
Next screen ask you to select the &lt;span class=&quot;search-highlight&quot;&gt;table&lt;/span&gt;s which you want to &lt;span class=&quot;search-highlight&quot;&gt;generate&lt;/span&gt; the &lt;span class=&quot;search-highlight&quot;&gt;data&lt;/span&gt; from. Select whatever the &lt;span class=&quot;search-highlight&quot;&gt;table&lt;/span&gt;s and click next&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 411px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image031.jpg&quot;&gt;&lt;img alt=&quot;SQL Server Generate Script Wizard - Choose Tables&quot; border=&quot;0&quot; height=&quot;363&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image031_thumb.jpg?w=401&amp;amp;h=363&quot; title=&quot;SQL Server Generate Script Wizard - Choose Tables&quot; width=&quot;401&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Server&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Generate&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt; Wizard – Choose &lt;span class=&quot;search-highlight&quot;&gt;Table&lt;/span&gt;s&lt;/div&gt;
&lt;/div&gt;
Next step ask to specify the output options. If you select “&lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt; to file” as an option, then you can enter the file name and the location there.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 415px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image033.jpg&quot;&gt;&lt;img alt=&quot;SQL Server Generate Script Wizard - Output Option&quot; border=&quot;0&quot; height=&quot;367&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image033_thumb.jpg?w=405&amp;amp;h=367&quot; title=&quot;SQL Server Generate Script Wizard - Output Option&quot; width=&quot;405&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Server&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Generate&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt; Wizard – Output Option&lt;/div&gt;
&lt;/div&gt;
Next two steps are very strait forward. It shows the &lt;span class=&quot;search-highlight&quot;&gt;script&lt;/span&gt; generation summary, and by clicking next it will &lt;span class=&quot;search-highlight&quot;&gt;generate&lt;/span&gt; the &lt;span class=&quot;search-highlight&quot;&gt;script&lt;/span&gt; with &lt;span class=&quot;search-highlight&quot;&gt;insert&lt;/span&gt; statements for the selected &lt;span class=&quot;search-highlight&quot;&gt;table&lt;/span&gt;s.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 419px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image035.jpg&quot;&gt;&lt;img alt=&quot;SQL Server Generate Script Wizard - Script Summary&quot; border=&quot;0&quot; height=&quot;370&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image035_thumb.jpg?w=409&amp;amp;h=370&quot; title=&quot;SQL Server Generate Script Wizard - Script Summary&quot; width=&quot;409&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Server&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Generate&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt; Wizard – &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt; Summary&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 416px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image037.jpg&quot;&gt;&lt;img alt=&quot;SQL Server Generate Script Wizard - Script Progress&quot; border=&quot;0&quot; height=&quot;367&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image037_thumb.jpg?w=406&amp;amp;h=367&quot; title=&quot;SQL Server Generate Script Wizard - Script Progress&quot; width=&quot;406&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Server&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Generate&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt; Wizard – &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt; Progress&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;wp-caption alignnone&quot; style=&quot;width: 417px;&quot;&gt;
&lt;a href=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image039.jpg&quot;&gt;&lt;img alt=&quot;SQL Server Generate Script Wizard - Generated Script&quot; border=&quot;0&quot; height=&quot;234&quot; src=&quot;http://tharakaweb.files.wordpress.com/2013/05/clip_image039_thumb.jpg?w=407&amp;amp;h=234&quot; title=&quot;SQL Server Generate Script Wizard - Generated Script&quot; width=&quot;407&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;SQL&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Server&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Generate&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt; Wizard – &lt;span class=&quot;search-highlight&quot;&gt;Generate&lt;/span&gt;d &lt;span class=&quot;search-highlight&quot;&gt;Script&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/1693208260453032867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2013/06/generate-insert-statements-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/1693208260453032867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/1693208260453032867'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2013/06/generate-insert-statements-from.html' title='Generate insert statements from a specific table data using SQL Server 2005'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-1264927403754876544</id><published>2013-05-27T23:11:00.001+03:00</published><updated>2013-05-27T23:11:13.649+03:00</updated><title type='text'>How to Put an iPhone Into DFU Mode</title><content type='html'>&lt;br /&gt;
DFU means Device Firmware Update. If a restore using Recovery Mode doesn&#39;t work you will want to use DFU Mode as a last resort. When placing your iPhone into DFU Mode it does not load the OS before attempting the restore&lt;br /&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;a href=&quot;http://www.iclarified.com/player/desktopplayer.swf?enid=1034&amp;amp;meid=7242&quot; rel=&quot;shadowbox;width=720;height=482&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;167&quot; src=&quot;http://www.iclarified.com/images/entry/videothumb.png&quot; style=&quot;float: left; padding: 3px 20px 0px 3px;&quot; width=&quot;250&quot; /&gt;&lt;/a&gt;&lt;b&gt;Watch the Video!&lt;/b&gt;&lt;br /&gt;For your convenience this tutorial is available in video format also.  Click the Watch It button to view the tutorial!&lt;/div&gt;
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To put the iPhone into DFU mode so you can do an iTunes firmware restore follow these steps:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Step One&lt;/b&gt;&lt;br /&gt;Open iTunes and connect the iPhone to your Mac.&lt;br /&gt;&lt;a class=&quot;lightview&quot; data-lightview-group=&quot;iclarified&quot; data-lightview-options=&quot;skin: &#39;mac&#39;&quot; href=&quot;http://www.iclarified.com/entry/lightview.php?location=/images/tutorials/1034/4984/4984.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;128&quot; src=&quot;http://www.iclarified.com/images/tutorials/1034/4984/4984.png&quot; width=&quot;128&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Step Two&lt;/b&gt;&lt;br /&gt;Press and hold the Home button and the Sleep/Wake button at the same time.&lt;br /&gt;&lt;a class=&quot;lightview&quot; data-lightview-group=&quot;iclarified&quot; data-lightview-options=&quot;skin: &#39;mac&#39;&quot; href=&quot;http://www.iclarified.com/entry/lightview.php?location=/images/tutorials/1034/4985/4985.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;127&quot; src=&quot;http://www.iclarified.com/images/tutorials/1034/4985/4985-500.png&quot; width=&quot;500&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Step Three&lt;/b&gt;&lt;br /&gt;After exactly 10 seconds release the Sleep/Wake button. Continue holding the home button until you iTunes pops up a message telling you that it has detected an iPhone in recovery mode.&lt;br /&gt;&lt;a class=&quot;lightview&quot; data-lightview-group=&quot;iclarified&quot; data-lightview-options=&quot;skin: &#39;mac&#39;&quot; href=&quot;http://www.iclarified.com/entry/lightview.php?location=/images/tutorials/1034/4986/4986.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;204&quot; src=&quot;http://www.iclarified.com/images/tutorials/1034/4986/4986-500.png&quot; width=&quot;500&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The iPhone screen will remain black like this:&lt;br /&gt;&lt;a class=&quot;lightview&quot; data-lightview-group=&quot;iclarified&quot; data-lightview-options=&quot;skin: &#39;mac&#39;&quot; href=&quot;http://www.iclarified.com/entry/lightview.php?location=/images/tutorials/1034/4987/4987.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;250&quot; src=&quot;http://www.iclarified.com/images/tutorials/1034/4987/4987.png&quot; width=&quot;133&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;NOTE***:  It may take a few attempts to get your iPhone into DFU mode.   Generally, I hold down both buttons then release the Home button just before I think the Apple logo would appear.  If you are still holding both buttons down and you see the Apple logo you are holding them down for too long!&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; </content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/1264927403754876544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2013/05/how-to-put-iphone-into-dfu-mode.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/1264927403754876544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/1264927403754876544'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2013/05/how-to-put-iphone-into-dfu-mode.html' title='How to Put an iPhone Into DFU Mode'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-3811304392496560387</id><published>2013-05-16T09:35:00.002+03:00</published><updated>2013-05-16T09:35:52.919+03:00</updated><title type='text'>Best Practices to Improve ASP.Net Web Application Performance</title><content type='html'>&lt;br /&gt;
Introduction &lt;br /&gt;
Performance tuning can be tricky. It&#39;s especially tough in Internet-related projects with lots of components running around, like HTML client, HTTP network, Web server, middle-tier components, database components, resource-management components, TCP/IP networks, and database servers. Performance tuning depends on a lot of parameters and sometimes, by changing a single parameter, performance can increase drastically.&lt;br /&gt;
This document lists out some tips for optimizing ASP.Net Web applications and many traps and pitfalls are discussed as follows : &lt;br /&gt;
&lt;br /&gt;
Tips For Web Application&lt;br /&gt;
&lt;br /&gt;
1) Turn off Tracing unless until required &lt;br /&gt;
&lt;br /&gt;
Tracing is one of the wonderful features which enable us to track the application&#39;s trace and the sequences. However, again it is useful only for developers and you can set this to &quot;false&quot; unless you require monitoring the trace logging. &lt;br /&gt;
&lt;br /&gt;
How it affects performance: &lt;br /&gt;
&lt;br /&gt;
Enabling tracing adds performance overhead and might expose private information, so it should be enabled only while an application is being actively analyzed. &lt;br /&gt;
&lt;br /&gt;
Solution: &lt;br /&gt;
&lt;br /&gt;
When not needed, tracing can be turned off using &lt;br /&gt;
&lt;br /&gt;
&lt;trace enabled=&quot;false&quot; localonly=&quot;”true”&quot; pageoutput=&quot;”false”&quot; requestlimit=&quot;”10”&quot; tracemode=&quot;”SortByTime”&quot;&gt; &lt;/trace&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Turn off Session State, if not required &lt;br /&gt;
&lt;br /&gt;
One extremely powerful feature of ASP.NET is its ability to store session state for users, such as a shopping cart on an e-commerce site or a browser history. &lt;br /&gt;
&lt;br /&gt;
How it affects performance: &lt;br /&gt;
&lt;br /&gt;
Since ASP.NET Manages session state by default, you pay the cost in memory even if you don&#39;t use it. I.e. whether you store your data in in-process or on state server or in a Sql Database, session state requires memory and it&#39;s also time consuming when you store or retrieve data from it. &lt;br /&gt;
&lt;br /&gt;
Solution: &lt;br /&gt;
&lt;br /&gt;
You may not require session state when your pages are static or when you do not need to store information captured in the page. &lt;br /&gt;
&lt;br /&gt;
In such cases where you need not use session state, disable it on your web form using the directive, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;@%Page EnableSessionState=&quot;false&quot;%&amp;gt; &lt;br /&gt;
&lt;br /&gt;
In case you use the session state only to retrieve data from it and not to update it, make the session state read only by using the directive, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;@%Page EnableSessionState =&quot;ReadOnly&quot;%&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) Disable View State of a Page if possible &lt;br /&gt;
&lt;br /&gt;
View state is a fancy name for ASP.NET storing some state data in a hidden input field inside the generated page. When the page is posted back to the server, the server can parse, validate, and apply this view state data back to the page&#39;s tree of controls. &lt;br /&gt;
&lt;br /&gt;
View state is a very powerful capability since it allows state to be persisted with the client and it requires no cookies or server memory to save this state. Many ASP.NET server controls use view state to persist settings made during interactions with elements on the page, for example, saving the current page that is being displayed when paging through data. &lt;br /&gt;
&lt;br /&gt;
How it affects performance: &lt;br /&gt;
&lt;br /&gt;
? There are a number of drawbacks to the use of view state, however. &lt;br /&gt;
&lt;br /&gt;
? It increases the total payload of the page both when served and when requested. There is also an additional overhead incurred when serializing or deserializing view state data that is posted back to the server. &lt;br /&gt;
&lt;br /&gt;
? View state increases the memory allocations on the server. Several server controls, the most well known of which is the DataGrid, tend to make excessive use of view state, even in cases where it is not needed. &lt;br /&gt;
&lt;br /&gt;
Solution: &lt;br /&gt;
&lt;br /&gt;
Pages that do not have any server postback events can have the view state turned off. &lt;br /&gt;
&lt;br /&gt;
The default behavior of the ViewState property is enabled, but if you don&#39;t need it, you can turn it off at the control or page level. Within a control, simply set the EnableViewState property to false, or set it globally within the page using this setting: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;%@ Page EnableViewState=&quot;false&quot; %&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you turn view state off for a page or control, make sure you thoroughly test your pages to verify that they continue to function correctly. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) Set debug=false in web.config &lt;br /&gt;
&lt;br /&gt;
When you create the application, by default this attribute is set to &quot;true&quot; which is very useful while developing. However, when you are deploying your application, always set it to &quot;false&quot;. &lt;br /&gt;
&lt;br /&gt;
How it affects performance: &lt;br /&gt;
&lt;br /&gt;
Setting it to &quot;true&quot; requires the pdb information to be inserted into the file and this results in a comparatively larger file and hence processing will be slow. &lt;br /&gt;
&lt;br /&gt;
Solution: &lt;br /&gt;
&lt;br /&gt;
Therefore, always set debug=&quot;false&quot; before deployment. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5) Avoid Response.Redirect &lt;br /&gt;
&lt;br /&gt;
Response.Redirect () method simply tells the browser to visit another page. &lt;br /&gt;
&lt;br /&gt;
How it affects performance: &lt;br /&gt;
&lt;br /&gt;
Redirects are also very chatty. They should only be used when you are transferring people to another physical web server. &lt;br /&gt;
&lt;br /&gt;
Solution: &lt;br /&gt;
&lt;br /&gt;
For any transfers within your server, use .transfer! You will save a lot of needless HTTP requests. Instead of telling the browser to redirect, it simply changes the &quot;focus&quot; on the Web server and transfers the request. This means you don&#39;t get quite as many HTTP requests coming through, which therefore eases the pressure on your Web server and makes your applications run faster. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tradeoffs:&lt;br /&gt;
&lt;br /&gt;
? &quot;.transfer&quot; process can work on only those sites running on the server. Only Response.Redirect can do that. &lt;br /&gt;
&lt;br /&gt;
? Server.Transfer maintains the original URL in the browser. This can really help streamline data entry techniques, although it may make for confusion when debugging &lt;br /&gt;
&lt;br /&gt;
5. A) To reduce CLR Exceptions count, Use Response.Redirect (&quot;.aspx&quot;, false) instead of response.redirect (&quot;.aspx&quot;). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6) Use the String builder to concatenate string &lt;br /&gt;
&lt;br /&gt;
How it affects performance: &lt;br /&gt;
&lt;br /&gt;
String is Evil when you want to append and concatenate text to your string. All the activities you do to the string are stored in the memory as separate references and it must be avoided as much as possible. &lt;br /&gt;
&lt;br /&gt;
i.e. When a string is modified, the run time will create a new string and return it, leaving the original to be garbage collected. Most of the time this is a fast and simple way to do it, but when a string is being modified repeatedly it begins to be a burden on performance: all of those allocations eventually get expensive. &lt;br /&gt;
&lt;br /&gt;
Solution: &lt;br /&gt;
&lt;br /&gt;
Use String Builder when ever string concatenation is needed so that it only stores the value in the original string and no additional reference is created. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7) Avoid throwing exceptions &lt;br /&gt;
&lt;br /&gt;
How it affects performance: &lt;br /&gt;
&lt;br /&gt;
Exceptions are probably one of the heaviest resource hogs and causes of slowdowns you will ever see in web applications, as well as windows applications. &lt;br /&gt;
&lt;br /&gt;
Solution: &lt;br /&gt;
&lt;br /&gt;
You can use as many try/catch blocks as you want. Using exceptions gratuitously is where you lose performance. For example, you should stay away from things like using exceptions for control flow. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8) Use Finally Method to kill resources &lt;br /&gt;
&lt;br /&gt;
?The finally method gets executed independent of the outcome of the Block. &lt;br /&gt;
&lt;br /&gt;
?Always use the finally block to kill resources like closing database connection, closing files and other resources such that they get executed independent of whether the code worked in Try or went to Catch. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
9) Use Client Side Scripts for validations &lt;br /&gt;
&lt;br /&gt;
User Input is Evil and it must be thoroughly validated before processing to avoid overhead and possible injections to your applications. &lt;br /&gt;
&lt;br /&gt;
How It improves performance: &lt;br /&gt;
&lt;br /&gt;
Client site validation can help reduce round trips that are required to process user&#39;s request. In ASP.NET you can also use client side controls to validate user input. However, do a check at the Server side too to avoid the infamous Javascript disabled scenarios. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
10) Avoid unnecessary round trips to the server &lt;br /&gt;
&lt;br /&gt;
How it affects performance: &lt;br /&gt;
&lt;br /&gt;
Round trips significantly affect performance. They are subject to network latency and to downstream server latency. Many data-driven Web sites heavily access the database for every user request. While connection pooling helps, the increased network traffic and processing load on the database server can adversely affect performance. &lt;br /&gt;
&lt;br /&gt;
Solution: &lt;br /&gt;
&lt;br /&gt;
? Keep round trips to an absolute minimum &lt;br /&gt;
&lt;br /&gt;
? Implement Ajax UI whenever possible. The idea is to avoid full page refresh and only update the portion of the page that needs to be changed &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
11) Use Page.ISPostBack &lt;br /&gt;
&lt;br /&gt;
Make sure you don&#39;t execute code needlessly. Use Page.ISPostBack property to ensure that you only perform page initialization logic when a page is first time loaded and not in response to client postbacks. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
12) Include Return Statements with in the Function/Method &lt;br /&gt;
&lt;br /&gt;
How it improves performance &lt;br /&gt;
&lt;br /&gt;
Explicitly using return allows the JIT to perform slightly more optimizations. Without a return statement, each function/method is given several local variables on stack to transparently support returning values without the keyword. Keeping these around makes it harder for the JIT to optimize, and can impact the performance of your code. Look through your functions/methods and insert return as needed. It doesn&#39;t change the semantics of the code at all, and it can help you get more speed from your application. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
13) Use Foreach loop instead of For loop for String Iteration &lt;br /&gt;
&lt;br /&gt;
Foreach is far more readable, and in the future it will become as fast as a For loop for special cases like strings. Unless string manipulation is a real performance hog for you, the slightly messier code may not be worth it. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
14) Avoid Unnecessary Indirection &lt;br /&gt;
&lt;br /&gt;
How it affects performance: &lt;br /&gt;
&lt;br /&gt;
When you use byRef, you pass pointers instead of the actual object. &lt;br /&gt;
&lt;br /&gt;
Many times this makes sense (side-effecting functions, for example), but you don&#39;t always need it. Passing pointers results in more indirection, which is slower than accessing a value that is on the stack. &lt;br /&gt;
&lt;br /&gt;
Solution: &lt;br /&gt;
&lt;br /&gt;
When you don&#39;t need to go through the heap, it is best to avoid it there by avoiding indirection. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
15) Use &quot;ArrayLists&quot; in place of arrays &lt;br /&gt;
&lt;br /&gt;
How it improves performance &lt;br /&gt;
&lt;br /&gt;
An ArrayList as everything that is good about an array PLUS automatic sizing, Add, Insert, Remove, Sort, Binary Search. All these great helper methods are added when implementing the IList interface. &lt;br /&gt;
&lt;br /&gt;
Tradeoffs: &lt;br /&gt;
&lt;br /&gt;
The downside of an ArrayList is the need to cast objects upon retrieval. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
16) Always check Page.IsValid when using Validator Controls &lt;br /&gt;
&lt;br /&gt;
Always make sure you check Page.IsValid before processing your forms when using Validator Controls. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
17) Use Paging &lt;br /&gt;
&lt;br /&gt;
Take advantage of paging&#39;s simplicity in .net. Only show small subsets of data at a time, allowing the page to load faster. &lt;br /&gt;
&lt;br /&gt;
Tradeoffs: &lt;br /&gt;
&lt;br /&gt;
Just be careful when you mix in caching. Don&#39;t cache all the data in the grid. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
18) Store your content by using caching &lt;br /&gt;
&lt;br /&gt;
How it improves performance: &lt;br /&gt;
&lt;br /&gt;
ASP.NET allows you to cache entire pages, fragment of pages or controls. You can cache also variable data by specifying the parameters that the data depends. By using caching you help ASP.NET engine to return data for repeated request for the same page much faster. &lt;br /&gt;
&lt;br /&gt;
When and Why Use Caching: &lt;br /&gt;
&lt;br /&gt;
A Proper use and fine tune of caching approach of caching will result on better performance and scalability of your site. However improper use of caching will actually slow down and consume lots of your server performance and memory usage. &lt;br /&gt;
&lt;br /&gt;
Good candidate to use caching is if you have infrequent chance of data or static content of web page. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
19) Use low cost authentication &lt;br /&gt;
&lt;br /&gt;
Authentication can also have an impact over the performance of your application. For example passport authentication is slower than form-base authentication which in here turn is slower than Windows authentication. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
20) Minimize the number of web server controls &lt;br /&gt;
&lt;br /&gt;
How it affects performance: &lt;br /&gt;
&lt;br /&gt;
The use of web server controls increases the response time of your application because they need time to be processed on the server side before they are rendered on the client side. &lt;br /&gt;
&lt;br /&gt;
Solution: &lt;br /&gt;
&lt;br /&gt;
One way to minimize the number of web server controls is to taking into consideration, the usage of HTML elements where they are suited, for example if you want to display static text. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
21) Avoid using unmanaged code &lt;br /&gt;
&lt;br /&gt;
How it affects performance: &lt;br /&gt;
&lt;br /&gt;
Calls to unmanaged code are a costly marshaling operation. &lt;br /&gt;
&lt;br /&gt;
Solution: &lt;br /&gt;
&lt;br /&gt;
Try to reduce the number calls between the managed and unmanaged code. Consider to do more work in each call rather than making frequent calls to do small tasks. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
22) Avoid making frequent calls across processes &lt;br /&gt;
&lt;br /&gt;
If you are working with distributed applications, this involves additional overhead negotiating network and application level protocols. In this case network speed can also be a bottleneck. Try to do as much work as possible in fewer calls over the network. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
23) Cleaning Up Style Sheets and Script Files &lt;br /&gt;
&lt;br /&gt;
? A quick and easy way to improve your web application&#39;s performance is by going back and cleaning up your CSS Style Sheets and Script Files of unnecessary code or old styles and functions. It is common for old styles and functions to still exist in your style sheets and script files during development cycles and when improvements are made to a website. &lt;br /&gt;
&lt;br /&gt;
? Many websites use a single CSS Style Sheet or Script File for the entire website. Sometimes, just going through these files and cleaning them up can improve the performance of your site by reducing the page size. If you are referencing images in your style sheet that are no longer used on your website, it&#39;s a waste of performance to leave them in there and have them loaded each time the style sheet is loaded. &lt;br /&gt;
&lt;br /&gt;
? Run a web page analyzer against pages in your website so that you can see exactly what is being loaded and what takes the most time to load. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
24) Design with ValueTypes &lt;br /&gt;
&lt;br /&gt;
Use simple structs when you can, and when you don&#39;t do a lot of boxing &lt;br /&gt;
&lt;br /&gt;
and unboxing. &lt;br /&gt;
&lt;br /&gt;
Tradeoffs: &lt;br /&gt;
&lt;br /&gt;
ValueTypes are far less flexible than Objects, and end up hurting performance if used incorrectly. You need to be very careful about when you treat them like objects. This adds extra boxing and unboxing overhead to your program, and can end up costing you more than it would if you had stuck with objects. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
25) Minimize assemblies &lt;br /&gt;
&lt;br /&gt;
Minimize the number of assemblies you use to keep your working set small. If you load an entire assembly just to use one method, you&#39;re paying a tremendous cost for very little benefit. See if you can duplicate that method&#39;s functionality using code that you already have loaded. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
26) Encode Using ASCII When You Don&#39;t Need UTF &lt;br /&gt;
&lt;br /&gt;
By default, ASP.NET comes configured to encode requests and responses as UTF-8. &lt;br /&gt;
&lt;br /&gt;
If ASCII is all your application needs, eliminated the UTF overhead can give you back a few cycles. Note that this can only be done on a per-application basis. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
27) Avoid Recursive Functions / Nested Loops &lt;br /&gt;
&lt;br /&gt;
These are general things to adopt in any programming language, which consume lot of memory. Always avoid Nested Loops, Recursive functions, to improve performance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
28) Minimize the Use of Format () &lt;br /&gt;
&lt;br /&gt;
When you can, use toString () instead of format (). In most cases, it will provide you with the functionality you need, with much less overhead. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
29) Place StyleSheets into the Header &lt;br /&gt;
&lt;br /&gt;
Web developers who care about performance want browser to load whatever content it has as soon as possible. This fact is especially important for pages with a lot of content and for users with slow Internet connections. When the browser loads the page progressively the header, the logo, the navigation components serve as visual feedback for the user. &lt;br /&gt;
&lt;br /&gt;
When we place style sheets near the bottom part of the html, most browsers stop rendering to avoid redrawing elements of the page if their styles change thus decreasing the performance of the page. So, always place StyleSheets into the Header &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
30) Put Scripts to the end of Document &lt;br /&gt;
&lt;br /&gt;
Unlike StyleSheets, it is better to place scripts to the end of the document. Progressive rendering is blocked until all StyleSheets have been downloaded. Scripts cause progressive rendering to stop for all content below the script until it is fully loaded. Moreover, while downloading a script, browser does not start any other component downloads, even on different hostnames. &lt;br /&gt;
&lt;br /&gt;
So,always have scripts at the end of the document. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
31) Make JavaScript and CSS External &lt;br /&gt;
&lt;br /&gt;
Using external files generally produces faster pages because the JavaScript and CSS files are cached by the browser. Inline JavaScript and CSS increases the HTML document size but reduces the number of HTTP requests. With cached external files, the size of the HTML is kept small without increasing the number of HTTP requests thus improving the performance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tips For Database Operations&lt;br /&gt;
&lt;br /&gt;
1) Return Multiple Resultsets &lt;br /&gt;
&lt;br /&gt;
The database code if has request paths that go to the database more than once then, these round-trips decreases the number of requests per second your application can serve. &lt;br /&gt;
&lt;br /&gt;
Solution: &lt;br /&gt;
&lt;br /&gt;
Return multiple resultsets in a single database request, so that you can cut the total time spent communicating with the database. You&#39;ll be making your system more scalable, too, as you&#39;ll cut down on the work the database server is doing managing requests. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Connection Pooling and Object Pooling &lt;br /&gt;
&lt;br /&gt;
Connection pooling is a useful way to reuse connections for multiple requests, rather than paying the overhead of opening and closing a connection for each request. It&#39;s done implicitly, but you get one pool per unique connection string. Make sure you call Close or Dispose on a connection as soon as possible. When pooling is enabled, calling Close or Dispose returns the connection to the pool instead of closing the underlying database connection. &lt;br /&gt;
&lt;br /&gt;
Account for the following issues when pooling is a part of your design: &lt;br /&gt;
&lt;br /&gt;
? Share connections &lt;br /&gt;
&lt;br /&gt;
? Avoid per-user logons to the database &lt;br /&gt;
&lt;br /&gt;
? Do not vary connection strings &lt;br /&gt;
&lt;br /&gt;
? Do not cache connections &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) Use SqlDataReader Instead of Dataset wherever it is possible &lt;br /&gt;
&lt;br /&gt;
If you are reading a table sequentially you should use the DataReader rather than DataSet. DataReader object creates a read only stream of data that will increase your application performance because only one row is in memory at a time. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) Keep Your Datasets Lean &lt;br /&gt;
&lt;br /&gt;
Remember that the dataset stores all of its data in memory, and that the more data you request, the longer it will take to transmit across the wire. &lt;br /&gt;
&lt;br /&gt;
Therefore Only put the records you need into the dataset. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5) Avoid Inefficient queries &lt;br /&gt;
&lt;br /&gt;
How it affects performance: &lt;br /&gt;
&lt;br /&gt;
Queries that process and then return more columns or rows than necessary, waste processing cycles that could best be used for servicing other requests. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cause of Inefficient queries: &lt;br /&gt;
&lt;br /&gt;
? Too much data in your results is usually the result of inefficient queries. &lt;br /&gt;
&lt;br /&gt;
? The SELECT * query often causes this problem. You do not usually need to return all the columns in a row. Also, analyze the WHERE clause in your queries to ensure that you are not returning too many rows. Try to make the WHERE clause as specific as possible to ensure that the least number of rows are returned. &lt;br /&gt;
&lt;br /&gt;
? Queries that do not take advantage of indexes may also cause poor performance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6) Unnecessary round trips &lt;br /&gt;
&lt;br /&gt;
How it affects performance: &lt;br /&gt;
&lt;br /&gt;
Round trips significantly affect performance. They are subject to network latency and to downstream server latency. Many data-driven Web sites heavily access the database for every user request. While connection pooling helps, the increased network traffic and processing load on the database server can adversely affect performance. &lt;br /&gt;
&lt;br /&gt;
Solution: &lt;br /&gt;
&lt;br /&gt;
Keep round trips to an absolute minimum. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7) Too many open connections &lt;br /&gt;
&lt;br /&gt;
Connections are an expensive and scarce resource, which should be shared between callers by using connection pooling. Opening a connection for each caller limits scalability. &lt;br /&gt;
&lt;br /&gt;
Solution: &lt;br /&gt;
&lt;br /&gt;
To ensure the efficient use of connection pooling, avoid keeping connections open and avoid varying connection strings. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8) Avoid Transaction misuse &lt;br /&gt;
&lt;br /&gt;
How it affects performance: &lt;br /&gt;
&lt;br /&gt;
If you select the wrong type of transaction management, you may add latency to each operation. Additionally, if you keep transactions active for long periods of time, the active transactions may cause resource pressure. &lt;br /&gt;
&lt;br /&gt;
Solution: &lt;br /&gt;
&lt;br /&gt;
Transactions are necessary to ensure the integrity of your data, but you need to ensure that you use the appropriate type of transaction for the shortest duration possible and only where necessary. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
9) Avoid Over Normalized tables &lt;br /&gt;
&lt;br /&gt;
Over Normalized tables may require excessive joins for simple operations. These additional steps may significantly affect the performance and scalability of your application, especially as the number of users and requests increases. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
10) Reduce Serialization &lt;br /&gt;
&lt;br /&gt;
Dataset serialization is more efficiently implemented in .NET Framework version 1.1 than in version 1.0. However, Dataset serialization often introduces performance bottlenecks. &lt;br /&gt;
&lt;br /&gt;
You can reduce the performance impact in a number of ways: &lt;br /&gt;
&lt;br /&gt;
? Use column name aliasing &lt;br /&gt;
&lt;br /&gt;
? Avoid serializing multiple versions of the same data &lt;br /&gt;
&lt;br /&gt;
? Reduce the number of DataTable objects that are serialized &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
11) Do Not Use CommandBuilder at Run Time &lt;br /&gt;
&lt;br /&gt;
How it affects performance: &lt;br /&gt;
&lt;br /&gt;
CommandBuilder objects such as as SqlCommandBuilder and OleDbCommandBuilder are useful when you are designing and prototyping your application. However, you should not use them in production applications. The processing required to generate the commands affects performance. &lt;br /&gt;
&lt;br /&gt;
Solution: &lt;br /&gt;
&lt;br /&gt;
Manually create stored procedures for your commands, or use the Visual Studio® .NET design-time wizard and customize them later if necessary. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
12) Use Stored Procedures Whenever Possible &lt;br /&gt;
&lt;br /&gt;
?Stored procedures are highly optimized tools that result in excellent performance when used effectively. &lt;br /&gt;
&lt;br /&gt;
?Set up stored procedures to handle inserts, updates, and deletes with the data adapter &lt;br /&gt;
&lt;br /&gt;
?Stored procedures do not have to be interpreted, compiled or even transmitted from the client, and cut down on both network traffic and server overhead. &lt;br /&gt;
&lt;br /&gt;
?Be sure to use CommandType.StoredProcedure instead of CommandType.Text &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
13) Avoid Auto-Generated Commands &lt;br /&gt;
&lt;br /&gt;
When using a data adapter, avoid auto-generated commands. These require additional trips to the server to retrieve meta data, and give you a lower level of interaction control. While using auto-generated commands is convenient, it&#39;s worth the effort to do it yourself in performance-critical applications. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
14) Use Sequential Access as Often as Possible &lt;br /&gt;
&lt;br /&gt;
With a data reader, use CommandBehavior.SequentialAccess. This is essential for dealing with blob data types since it allows data to be read off of the wire in small chunks. While you can only work with one piece of the data at a time, the latency for loading a large data type disappears. If you don&#39;t need to work the whole object at once, using &lt;br /&gt;
&lt;br /&gt;
Sequential Access will give you much better performance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Tips for Asp.Net applications developed using VB&lt;br /&gt;
&lt;br /&gt;
1) Enable Option Strict and Option Explicit for your pages &lt;br /&gt;
&lt;br /&gt;
With Option Strict on, you protect yourself from inadvertent late binding and enforce a higher level of coding discipline. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Use early binding in Visual Basic or JScript code &lt;br /&gt;
&lt;br /&gt;
Visual Basic 6 does a lot of work under the hood to support casting of objects, and many programmers aren&#39;t even aware of it. In Visual Basic 7, this is an area that out of which you can squeeze a lot of performance. &lt;br /&gt;
&lt;br /&gt;
Solution: &lt;br /&gt;
&lt;br /&gt;
When you compile, use early binding. This tells the compiler to insert a Type Coercion is only done when explicitly mentioned. &lt;br /&gt;
&lt;br /&gt;
This has two major effects: &lt;br /&gt;
&lt;br /&gt;
? Strange errors become easier to track down. &lt;br /&gt;
&lt;br /&gt;
? Unneeded coercions are eliminated, leading to substantial performance improvements. &lt;br /&gt;
&lt;br /&gt;
When you use an object as if it were of a different type, Visual Basic will coerce the object for you if you don&#39;t specify. This is handy, since the programmer has to worry about less code. &lt;br /&gt;
&lt;br /&gt;
3) Put Concatenations in One Expression &lt;br /&gt;
If you have multiple concatenations on multiple lines, try to stick them all on one expression. The compiler can optimize by modifying the string in place, providing a speed and memory boost. If the statements are split into multiple lines, the Visual Basic compiler will not generate the Microsoft Intermediate Language (MSIL) to allow in-place concatenation. &lt;br /&gt;
&lt;br /&gt;
Summary&lt;br /&gt;
When we talk about ASP.Net performance, there are lots of factors in place. &lt;br /&gt;
Above discussed are the most critical of the speed improvements you can make in ASP.net that will have a dramatic impact on the user experience of your web application. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/3811304392496560387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2013/05/best-practices-to-improve-aspnet-web.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/3811304392496560387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/3811304392496560387'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2013/05/best-practices-to-improve-aspnet-web.html' title='Best Practices to Improve ASP.Net Web Application Performance'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-3595310350277726632</id><published>2013-03-06T17:17:00.001+03:00</published><updated>2013-03-06T17:17:16.695+03:00</updated><title type='text'>Expatriates Procedures in Saudi Arabia</title><content type='html'>&lt;span class=&quot;mid_content&quot; id=&quot;contentspan&quot;&gt;
&lt;/span&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;strong&gt;Dear Resident:&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;bodytext&quot;&gt;
To ensure your application is completed 
promptly, please ensure that your traffic police record is free from traffic 
fines before applying for your Iqama ID.&lt;/div&gt;
&lt;div class=&quot;bodytext&quot;&gt;
To check your traffic fines please visit 
the&amp;nbsp;&lt;a href=&quot;https://www.moi.gov.sa/wps/portal/!ut/p/b1/rZFda8IwFIZ_0cibz8bLNmISW223UjZzI70QKdgKY-z3r26CODFT5rk78Dycj5cEsqITqQSFZIK8kTC0n922_ej2Q7s79EGtpamM1wtOtcoNPLML2ExRVGoEViOAK5Xi3LdVk4DNEjE3KtfIxdE3NnUiKQBdWAmfuuZl8sw5Uv7Y-aUrKLyrXaWbjKGmD_JPwNJN4ZFPs6IsmWDytv2v-Vb9z8fd8y8O_MOv23fySkI0ZsGPQCzmbyCWw68kLh8VBQ6fiAJjVEu37zekD7vZT-nad_7pC9UEN2I!/dl4/d5/L0lHSkovd0RNQUprQUVnQSEhLzRKVUUvZW4!/&quot;&gt;Traffic 
Department Website.&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;bodytext&quot;&gt;
Following is a table listing 
Administrations that receive fees through authorised banks (saving fees 
for&amp;nbsp;Saudi Passport, which are paid through prepaid vouchers temporarily), until 
listed administrations are included within administrations charging fees via 
automated system.&lt;/div&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table class=&quot;tableclass&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th&gt;No.&lt;/th&gt;
&lt;th&gt;Administration&lt;/th&gt;
&lt;th&gt;No.&lt;/th&gt;
&lt;th&gt;Administration&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Riyadh passports (Muzahmeya/Deri&#39;yah)&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Al-Madinah passports (Yanbu) &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Makkah passports (Makkah/Jeddah/Taif/Qunfutha)&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Eastern Province passports (Damma/Khobar/Ahsa)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Aseer passports&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;Al-Qassim passports&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;Najran passports&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;Northern Borders passports &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;Jazzan passports&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;Tabouk passports &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;Hayel passports&lt;/td&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;Al-Baha passports &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;13&lt;/td&gt;
&lt;td&gt;Al-Jauf passports &lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;strong&gt;Note&lt;/strong&gt;: Other 
administrations receive fees in cash or through prepaid vouchers until they are 
included within administrations charging fees via automated system. 
&lt;/div&gt;
&lt;span lang=&quot;AR-SA&quot;&gt;&lt;/span&gt;&lt;span lang=&quot;AR-SA&quot;&gt;&lt;/span&gt;


&lt;script&gt;&lt;/script&gt;

&lt;script&gt;&lt;/script&gt;

&lt;script&gt;&lt;/script&gt;

&lt;script&gt;&lt;/script&gt;

&lt;script&gt;&lt;/script&gt;

&lt;script&gt;&lt;/script&gt;

&lt;script&gt;&lt;/script&gt;

&lt;script&gt;&lt;/script&gt;

&lt;script&gt;&lt;/script&gt;

&lt;table cellspacing=&quot;7&quot; class=&quot;bodytext&quot; style=&quot;float: right; width: 575px;&quot;&gt;
&lt;tbody&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNodecd1bc28041a63e84b5f8bfffe87aece9&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Report 
runaway expatriate &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;cd1bc28041a63e84b5f8bfffe87aece9&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;strong&gt;Requirements to report runaway 
expatriate:&lt;/strong&gt;&lt;/div&gt;
&lt;ul class=&quot;bodytext&quot;&gt;
&lt;li&gt;&lt;em&gt;Reporting Runaway Expatriate &lt;/em&gt;form duly filled in with 2 photocopies 
&lt;/li&gt;
&lt;li&gt;Attach a copy of the expatriate&#39;s Resident Permit (Iqama) or passport &lt;/li&gt;
&lt;li&gt;Attach a copy of the informant&#39;s National ID &lt;/li&gt;
&lt;li&gt;If the informant&#39;s is not the employer, an authorisation letter must be 
provided (sanctioned by police or Chamber of Commerce)&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;strong&gt;Requirements to invalidate report against runaway 
expatriate:&lt;/strong&gt;&lt;/div&gt;
&lt;ul class=&quot;bodytext&quot;&gt;
&lt;li&gt;&lt;em&gt;Invalidating report against runaway expatriate &lt;/em&gt;form duly filled in 
&lt;/li&gt;
&lt;li&gt;Provide the runaway report &lt;/li&gt;
&lt;li&gt;Pay the statutory fees &lt;/li&gt;
&lt;li&gt;Presence of employer or his representative &lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNoded5d4be8041a63eadb601bfffe87aece9&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Issue 
Hajj Permits for residents &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;d5d4be8041a63eadb601bfffe87aece9&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;strong&gt;Requirements to issue Hajj Permits for 
residents&lt;/strong&gt;&lt;/div&gt;
&lt;ul class=&quot;bodytext&quot;&gt;
&lt;li class=&quot;bodytext&quot;&gt;Hajj Permit request form duly filled in &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Provide two recent coloured photographs, 4X6 cm in size &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;The applicant must not have performed Hajj in the past five 
years &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Provide an approval letter from the employer &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Provide passport and Resident Permit (Iqama) &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Provide a contract with one of the authorised Hajj campaign 
&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Vaccinate against meningitis &lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNodeceeb400041a64653b618bfffe87aece9&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Procedures 
to lend manpower &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;ceeb400041a64653b618bfffe87aece9&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;strong&gt;Housemaids (includes private drivers, babysitters and 
guards) &lt;/strong&gt;&lt;/div&gt;
&lt;ul class=&quot;bodytext&quot;&gt;
&lt;li class=&quot;bodytext&quot;&gt;Lending of household help is restricted to employer&#39;s 
relatives only (brother / uncle / sister / aunt or their sons and daughters) 
&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;This lending is valid until its validity date or until the 
Resident Permit (Iqama) is expires, and it can be renewed by following same 
procedures &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;This lending is temporary for the employer&#39;s relative 
(beneficiary) &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;The employer must cooperate with the beneficiary regarding 
the housemaid dues to other parties &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Lending duration is calculated within the housemaid service 
duration as agreed with the employer &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;The beneficiary is not permitted to employ the housemaid 
until Passports Department issue the lending permit &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;The employer and the beneficiary are provided with a copy of 
the contract, and the expatriate is provided with lending permit &lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;strong&gt;Agricultural Manpower:&lt;/strong&gt;&lt;/div&gt;
&lt;ul class=&quot;bodytext&quot;&gt;
&lt;li class=&quot;bodytext&quot;&gt;Permission to lend agricultural manpower is granted to 
farmers, and the beneficiary is required to provide property document or 
certificate from the Ministry of Agriculture. Lending duration is for three 
months only and may not be extended&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Lending agreement will not release the original employer from 
his responsibilities towards the employee&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Lending duration is calculated within the manpower service 
duration as agreed with the employer&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;The original employer must keep the manpower passport with 
him&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;The original employer must not allow the expatriate to leave 
the Kingdom without acquiring the beneficiary&#39;s approval&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;The original employer must ensure his employee will resume 
working for him by the end of lending duration&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;The employer must cooperate with the beneficiary regarding 
the expatriate dues to other parties&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;The beneficiary is not permitted to employ the expatriate 
before issuing lending permit from passports&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;The beneficiary must report to the employer any expatriate 
absence from duties&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;strong&gt;Shepherds:&lt;/strong&gt;&lt;/div&gt;
&lt;ul class=&quot;bodytext&quot;&gt;
&lt;li class=&quot;bodytext&quot;&gt;Permission to lend shepherds is granted to cattle owners, and 
the beneficiary is required to provide Zakat certificate. Lending duration is 
for three months only and may not be extended&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Presence of the employer and the beneficiary or their legal 
representative is required&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;The beneficiary must not have manpower practicing the same 
occupation&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNode657244004548467d9a3fdf6998118dae&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Application 
for a residence permit for citizens&#39; non-Saudi wives &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;657244004548467d9a3fdf6998118dae&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
Procedures for a residence permit for citizens&#39; non-Saudi wives&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;Fill the relevant form (information as written in the passport of the wife) 
and sign the form.&lt;/li&gt;
&lt;li&gt;Attach a valid wife&#39;s passport with the name of the husband written in 
it.&lt;/li&gt;
&lt;li&gt;Submit two (2) recent photographs, size (4×6).&lt;/li&gt;
&lt;li&gt;Submit original valid husband&#39;s civil affairs card and a copy of it.&lt;/li&gt;
&lt;li&gt;Pay the issuance fee (S.R. 500) for each year.&lt;/li&gt;
&lt;li&gt;Attach a medical report.&lt;/li&gt;
&lt;/ul&gt;
After completing the required documents and submitting the application, the 
husband shall review the passports department the next day to get the residence 
permit for his wife.&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNode35329300454845f499f9dd6998118dae&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Application 
for a residence permit for the first time for institutions and companies &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;35329300454845f499f9dd6998118dae&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
Procedures for issuing a residence permit for institutions and companies&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;Fill the relevant form (information as written in the passport); and get the 
form signed and stamped with the seal of the employer.&lt;/li&gt;
&lt;li&gt;Submit expat&#39;s valid passport.&lt;/li&gt;
&lt;li&gt;Submit two (2) recent photographs, size (4×6).&lt;/li&gt;
&lt;li&gt;Pay the issuance fee (S.R. 500) for each year in any of authorised 
banks.&lt;/li&gt;
&lt;li&gt;Pay the human resources fees (S.R. 150).&lt;/li&gt;
&lt;li&gt;Submit a valid work permit covering the required period of stay and attach a 
copy through the Labour Office.&lt;/li&gt;
&lt;li&gt;Attach a medical report.&lt;/li&gt;
&lt;li&gt;Attach a health insurance.&lt;/li&gt;
&lt;li&gt;Fingerprint enrolment is a must.&lt;/li&gt;
&lt;/ul&gt;
After completing the required documents and submitting the application, the 
applicant shall review the passports department the next day to get his 
residence permit.&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNodebed96500454845e299e7dd6998118dae&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Application 
to renew residence permit for individuals and government agencies &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;bed96500454845e299e7dd6998118dae&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
Procedures for renewal of residence permit for individuals and government 
agencies&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;Fill the relevant form (information as written in the passport); and get the 
form signed and sealed by the government agency).&lt;/li&gt;
&lt;li&gt;Submit expat&#39;s valid passport.&lt;/li&gt;
&lt;li&gt;Submit two (2) recent photographs, size (4×6).&lt;/li&gt;
&lt;li&gt;Attach a clear photocopy of employer&#39;s civil affairs (for individuals).&lt;/li&gt;
&lt;li&gt;Pay the issuance fee for each year: (S.R. 500) for governmental agencies, 
and (S.R. 250) for the household labour in any authorised bank.&lt;/li&gt;
&lt;li&gt;Pay (S.R. 100) work permit fee.&lt;/li&gt;
&lt;li&gt;Attach a medical examination (by nationality). African countries: (Ethiopia, 
Eritrea, Kenya, Somalia, Djibouti, Nigeria, and the Sudan). Asian countries: 
(Thailand, Nepal and Vietnam)&lt;/li&gt;
&lt;li&gt;Fingerprint enrolment is a must; &lt;a href=&quot;http://www.moi.gov.sa/wps/portal/!ut/p/c1/pZDbCoJAEIafxSfY2XVd99ZD6uZhjdgyb2QvQhZSIyJ6_JQgQsiCZi6_-YaZH9Vo7F7fTKuvZuj1CVWoZo0TlIHguY25m_sg0jxIuXQIAIz8wJpCEhVRgTFnKwyEJdTPdgLi0P7FfnFZJCEISEM_k5LQDfvHjv-ywflib_UF7ae03qbiUrlAIpeuA5ZyoPaTL6UzcfhQHsz2z26kZJlPCSzx6cclPuZfJEN3ROdOKVXdhRGmbD3LegCWhXyr/dl2/d1/L0lHSkovd0RNQUprQUVnQSEhL1lCWncvZW4!/&quot;&gt;click 
here&lt;/a&gt; to inquire on fingerprint.&lt;/li&gt;
&lt;/ul&gt;
After completing the required documents and submitting the application, the 
applicant shall review the passports department the next day to get his 
residence permit.&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNode79534980454b1a22bc48fd2263f11f4e&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Issuing 
residence permit for dependents who reach 18 years of age &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;79534980454b1a22bc48fd2263f11f4e&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
Procedures to get a residence permit for a dependent after reaching 18 
years&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;Fill the relevant form (information as it is written in the passport);&amp;nbsp; and 
get the form signed by the family guardian.&lt;/li&gt;
&lt;li&gt;Submit a valid passport of the dependent.&lt;/li&gt;
&lt;li&gt;Submit two (2) photos, size (4×6).&lt;/li&gt;
&lt;li&gt;Pay (S.R. 500) issuance fees for each year.&lt;/li&gt;
&lt;li&gt;Submit a medical examination (by nationality).&lt;/li&gt;
&lt;li&gt;Fingerprint enrollment is a must.&lt;/li&gt;
&lt;/ul&gt;
After completing the required documents and submitting the application, the 
applicant or family guardian shall review the department passports the next day 
to get the residence permit.&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNode06050400454b1a31bc50fd2263f11f4e&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Adding 
(wives and minor children) to the residence permit of the family guardian 
&lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;06050400454b1a31bc50fd2263f11f4e&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
Procedures to apply for adding (wives and minor children) to the residence 
permit of the family guardian&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;Fill the relevant form (information as it is written in the passport); and 
get the form signed by the family guardian.&lt;/li&gt;
&lt;li&gt;Submit the wife&#39;s passports and minor children to be added, with an entry 
visa issued by the Saudi embassy enabling children to stay with their guardian 
or formal document to add them.&lt;/li&gt;
&lt;li&gt;Submit two (2) group-photos, recent, size (6×4).&lt;/li&gt;
&lt;li&gt;Submit the original residence permit of the family guardian, to where 
children would be added.&lt;/li&gt;
&lt;li&gt;If the religion of the wife to be added is different from the religion of 
the husband, she should get a separate residence permit and pay the prescribed 
fees, (S.R. 500).&lt;/li&gt;
&lt;li&gt;If the wife is to be added has been married in the Kingdom, her sponsorship 
must first be transferred to the husband after submitting a copy of the marriage 
contract and pay the prescribed fees; then she could be added to her husband&#39;s 
residence permit.&lt;/li&gt;
&lt;li&gt;If minor children to be added were born in Saudi Arabia, the original birth 
certificates and copies of them should be submitted.&lt;/li&gt;
&lt;/ul&gt;
After completing the required documents and submitting the application, the 
applicant or family guardian shall review the department of passport the next 
day to get the residence permit.&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNode831dba00454846399a1fdf6998118dae&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Procedure 
to cancel exit/reentry &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;831dba00454846399a1fdf6998118dae&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
Procedure to cancel exit/reentry&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;Fill the relevant form (information as written in the passport); attach a 
photo of the applicant; and get the form singed by the employer.&lt;/li&gt;
&lt;li&gt;Submit a letter from the employer asking cancellation of the visa.&lt;/li&gt;
&lt;li&gt;Attendance of the sponsor or his representative.&lt;/li&gt;
&lt;/ul&gt;
After completing the required documents and submitting the application, the 
applicant shall review the passports department the next day to get his passport 
after the abolition of the visa.&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNode4dfd990041a63372b5aebfffe87aece9&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Issue 
Resident Permit for the first time &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;4dfd990041a63372b5aebfffe87aece9&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;strong&gt;Requirements to issue Resident Permit (Iqama) for the 
first time: &lt;/strong&gt;&lt;/div&gt;
&lt;ul class=&quot;bodytext&quot;&gt;
&lt;li class=&quot;bodytext&quot;&gt;The applicant must have an entry visa issued by the Saudi 
embassy from the country of origin of the expatriate &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Iqama &lt;a href=&quot;http://www.moi.gov.sa/wps/wcm/connect/75268d804d4bb7fb8f58dfbed7ca8368/AlienMultiForm_FP.pdf?MOD=AJPERES&amp;amp;CACHEID=75268d804d4bb7fb8f58dfbed7ca8368&quot; target=&quot;_blank&quot;&gt;Application Form&lt;/a&gt; duly filled &lt;em&gt;(by a typewriter or a 
computer)&lt;/em&gt; data as appear in the passport, signed and stamped by the 
employer. &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Provide a valid passport. &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Provide two recent colour photographs, size (4X6) &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Iqama fees are 500 Saudi Riyals per year&amp;nbsp;paid at one of the 
authorised banks. &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Expatriate working for private sector must have work licence 
issued by the Labour Office.&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;For individuals, a photocopy of employer&#39;s Civil Affairs ID 
must be attached.&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;For restaurant and kitchen labourer, chef, maid and private 
driver, a medical report by an authorised hospital or clinic is required. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNode08735800454b1a49bc59fd2263f11f4e&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Cancelling 
a final exit visa in order to issue a residence permit &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;08735800454b1a49bc59fd2263f11f4e&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
Procedures to cancel a final exit visa in order to issue a residence permit 
&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;Fill the relevant form (information as it is written in the passport); 
attach a picture of the applicant; and get the form signed and stamped with the 
seal of the employer if the worker is an employee in a company or 
institution.&lt;/li&gt;
&lt;li&gt;A letter from the employer asking cancellation of the final exit visa.&lt;/li&gt;
&lt;li&gt;Attendance of the sponsor or his representative.&lt;/li&gt;
&lt;li&gt;Pay a fee (S.R. 650) for each year if the residence permit is expired; and 
(S.R. 600) for the household labour.&lt;/li&gt;
&lt;li&gt;Submit a valid work permit covering the required period of stay and attach a 
copy thereof, while domestic workers are exempted from getting a work permit, as 
the permit fee is paid within the re-issuance fee, (S.R. 600).&lt;/li&gt;
&lt;/ul&gt;
After completing the required documents and submitting the application, the 
applicant shall review the department of passports the next day to get the 
passport and residence permit after cancellation of the final exit 
visa.&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNodef46668804548464b9a27df6998118dae&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Application 
for a lost visa replacement &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;f46668804548464b9a27df6998118dae&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
Procedures for getting a lost visa replacement&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;The sponsor or his representative or head of household.&lt;/li&gt;
&lt;li&gt;Get out of the establishment of the beneficiary.&lt;/li&gt;
&lt;li&gt;Get out your passport.&lt;/li&gt;
&lt;/ul&gt;
After completing the required documents and submitting the application, the 
applicant shall wait to get the visa replacement.&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNodee9c88d80454b1a57bc61fd2263f11f4e&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Adding 
births &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;e9c88d80454b1a57bc61fd2263f11f4e&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
Procedures to add babies born outside the Kingdom&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;Pay entry visa fees, (S.R. 2000) through Sadad payment system.&lt;/li&gt;
&lt;li&gt;Submit a medical examination (by nationality).&lt;/li&gt;
&lt;li&gt;Fill the relevant form in the baby&#39;s name and submit two (2) group-photos 
excluding the family guardian, size (6×4).&lt;/li&gt;
&lt;li&gt;The Addition is done within 3 months as of entry stamp date.&lt;/li&gt;
&lt;li&gt;If 3 months elapsed without completing the addition, a fine of (S.R. 500) is 
imposed under Article 61 of the Residence Law.&lt;/li&gt;
&lt;li&gt;Baby must be inside the kingdom during the adding process.&lt;/li&gt;
&lt;/ul&gt;
Procedures for adding babies born inside the Kingdom&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;Add the baby to the passport of one of the parents at the embassy or get him 
a separate passport.&lt;/li&gt;
&lt;li&gt;Submit birth certificate and a copy thereof.&lt;/li&gt;
&lt;li&gt;Fill the relevant form in the baby&#39;s name and submit two (2) group-photos 
excluding the family guardian, size (6×4).&lt;/li&gt;
&lt;li&gt;If baby is not added while a year elapses as of the birthdate, a fine equals 
to (S.R. 1000) by certified check is imposed under Article 61 of the Residence 
Law.&lt;/li&gt;
&lt;li&gt;Baby must be inside the kingdom during the adding process.&lt;/li&gt;
&lt;/ul&gt;
After completing the required documents and submitting the application, the 
applicant or family guardian shall review the department of passports the next 
day to get the residence permit.&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNode64010e00454b1a68bc69fd2263f11f4e&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Sponsorship 
transfer &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;64010e00454b1a68bc69fd2263f11f4e&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
Procedures to apply for transfer of sponsorship&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;Fill the relevant form; stamp and sign the form by the current employer and 
new employer; and attach an applicant&#39;s photograph.&lt;/li&gt;
&lt;li&gt;Submit a letter of waiver from the current employer certified by the Chamber 
of Commerce and attach Chamber&#39;s receipt for companies, institutions and 
individuals; and if the sponsor is individual, the waiver letter must be 
certified from the mayor and the police.&lt;/li&gt;
&lt;li&gt;Submit a letter from the new employer requesting release, accompanied by a 
computer chip containing number of workers he has.&lt;/li&gt;
&lt;li&gt;Submit a copy of valid CR or licence of the municipality along with the 
originals for matching with the family book of the new employer.&lt;/li&gt;
&lt;li&gt;New employer must fill a pledge form to keep the new labourer, and not to 
let him work for others.&lt;/li&gt;
&lt;li&gt;Submit valid originals of the passport and residence permit of the worker 
whose services to be transferred, and attach a copy of same.&lt;/li&gt;
&lt;li&gt;Worker&#39;s profession must be appropriate to activity of new employer.&lt;/li&gt;
&lt;li&gt;Pay the transfer fees (2000 SR for the first time, 4000 SR for the second 
time and 6000 SR for the third time) but only after the submission and approval 
of the application by the relevant officer, in any of the authorised banks.&lt;/li&gt;
&lt;li&gt;If the expat has transferred service already and listed in former passports, 
all these passports must be submitted.&lt;/li&gt;
&lt;li&gt;Fingerprint enrollment is a must.&lt;/li&gt;
&lt;/ul&gt;
After completing the required documents and submitting the application, the 
applicant shall await the employee to finalise the service, and get the passport 
and residence permit.&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNodee68e03004548469e9a52df6998118dae&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Transfer 
of wife sponsorship &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;e68e03004548469e9a52df6998118dae&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
Procedures to apply for wife sponsorship transfer&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;Fill the relevant form for the transfer of sponsorship of individuals.&lt;/li&gt;
&lt;li&gt;A letter for transfer of sponsorship &quot;prepared by the husband.&quot;&lt;/li&gt;
&lt;li&gt;Submit two (2) photos, size (4×6).&lt;/li&gt;
&lt;li&gt;Submit a copy of husband&#39;s residence permit or a copy of civil affairs card 
if the husband is Saudi.&lt;/li&gt;
&lt;li&gt;Submit the marriage contract and a clear copy of it. If the marriage 
contract is issued abroad, it must be authenticated from the embassy and the 
Saudi foreign ministry.&lt;/li&gt;
&lt;li&gt;The name of the husband must be added on the wife&#39;s passport by the embassy 
of the country of the wife.&lt;/li&gt;
&lt;li&gt;A waiver certified by the former sponsor. If the releaser is the wife&#39;s 
father a copy of the residence permit and letter of waiver must be 
submitted.&lt;/li&gt;
&lt;li&gt;Pay (S.R. 2000) sponsorship transfer fee in one of the authorised 
banks.&lt;/li&gt;
&lt;/ul&gt;
After completing the required documents and submitting the application, the 
applicant shall wait for the employee to finalise transfer 
procedures.&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNode21009b80454846b19a5adf6998118dae&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Copy 
information of old passport to new passport &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;21009b80454846b19a5adf6998118dae&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
Procedures to apply for copying information of an old passport to a new 
passport&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;Attendance of the employer or his representative.&lt;/li&gt;
&lt;li&gt;Submit the original old passport provided it contains a cancellation 
stamp.&lt;/li&gt;
&lt;li&gt;Submit the original new passport.&lt;/li&gt;
&lt;/ul&gt;
After completing the required documents and submitting the application, the 
applicant shall wait to get his passport after completing relevant 
procedures.&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNode51513580454846c39a62df6998118dae&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Change 
profession &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;51513580454846c39a62df6998118dae&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
Procedures to apply for profession change&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;Applicant must submit an application for profession change from his 
country&#39;s embassy.&lt;/li&gt;
&lt;li&gt;Should review the Labour Office to check if applicant is suitable to work 
according to his qualifications; and then the labour office reports to the 
passports department to approve the change or otherwise.&lt;/li&gt;
&lt;li&gt;The department of passports shall in the light of the labour office approval 
collect the change fees (S.R. 1000), via ATMs of authorised banks i.e. Riyadh 
and Al Rajhi Banks.&lt;/li&gt;
&lt;/ul&gt;
After completing the required documents and submitting the application, the 
applicant shall review the passports department the next day to get the passport 
and residence permit after the completion of profession 
change.&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNode78c0e7804548465c9a2fdf6998118dae&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Rreporting 
loss of expat&#39;s passport &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;78c0e7804548465c9a2fdf6998118dae&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
Procedures to report loss of expat&#39;s passport&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;A letter from the employer or his deputy, which must be sealed and certified 
by a Chamber of Commerce; and if the sponsor could not attended in person at the 
date, location, number, date and source of the lost passport, and that the 
passport is not reserved or in custody of any government body.&lt;/li&gt;
&lt;li&gt;Declaration of the lost passport in one of the local newspapers.&lt;/li&gt;
&lt;li&gt;A copy of the lost passport, if any.&lt;/li&gt;
&lt;li&gt;Attach a copy of the residence permit of the lost passport holder.&lt;/li&gt;
&lt;li&gt;Holder of the lost passport shall fill the case investigation documents and 
stamp them with the seal of the enterprise or the 
employer.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNode8894f7804548466d9a37df6998118dae&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Non-transfer 
of sponsorship notification &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;8894f7804548466d9a37df6998118dae&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
Procedures to notify about non-transfer of sponsorship&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;Personal attendance of sponsor or his deputy.&lt;/li&gt;
&lt;li&gt;Fill the relevant form.&lt;/li&gt;
&lt;li&gt;A copy of the release letter sent by the institution to the 
sponsor.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNode5cd23d0041a63cdcb5b8bfffe87aece9&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Issue 
Resident Permit to family member &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;5cd23d0041a63cdcb5b8bfffe87aece9&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;strong&gt;Requirements to issue Resident Permit (Iqama) to 
family member for the first time: &lt;/strong&gt;&lt;/div&gt;
&lt;ul class=&quot;bodytext&quot;&gt;
&lt;li&gt;The family member must have an entry visa issued by the Saudi embassy from 
the country of origin of him/her &lt;/li&gt;
&lt;li&gt;The family member must be present in the Kingdom &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.moi.gov.sa/wps/wcm/connect/75268d804d4bb7fb8f58dfbed7ca8368/AlienMultiForm_FP.pdf?MOD=AJPERES&amp;amp;CACHEID=75268d804d4bb7fb8f58dfbed7ca8368&quot; target=&quot;_blank&quot;&gt;Iqama Form&lt;/a&gt; duly filled&amp;nbsp;&lt;em&gt;(by a typewriter or a 
computer)&lt;/em&gt; data as appear in the passport and signed by guardian.&lt;/li&gt;
&lt;li&gt;Provide valid passport of the member.&lt;/li&gt;
&lt;li&gt;Provide two recent, collective and colour photographs of the wife and 
children, size (4X6). &lt;/li&gt;
&lt;li&gt;If the child is born in saudi Arabia, a copy of birth certificate must be 
provided within one year from date of birth. &lt;/li&gt;
&lt;li&gt;If the wife was married in Saudi Arabia, she must be added to her husband&#39;s 
Resident Permit (Iqama) and a copy of the marriage contract must be provided. 
&lt;/li&gt;
&lt;li&gt;If the wife&#39;s religion is different from her husband&#39;s, her own Iqama must 
be issued with the statutory fees. &lt;/li&gt;
&lt;li&gt;Upon reaching 18 years of age the family member should be separated from 
guardian&#39;s Iqama and issued an individual Iqama, and a letter from the school 
must be provided confirming the student status. &lt;/li&gt;
&lt;li&gt;Iqama fees must be paid at an authorised bank. &lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNode00d5db8041a63d11b5c1bfffe87aece9&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Renew 
Resident Permit &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;00d5db8041a63d11b5c1bfffe87aece9&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;strong&gt;Requirements to renew Resident Permit (Iqama): 
&lt;/strong&gt;&lt;/div&gt;
&lt;ul class=&quot;bodytext&quot;&gt;
&lt;li&gt;Iqama&amp;nbsp;&lt;a href=&quot;http://www.moi.gov.sa/wps/wcm/connect/75268d804d4bb7fb8f58dfbed7ca8368/AlienMultiForm_FP.pdf?MOD=AJPERES&amp;amp;CACHEID=75268d804d4bb7fb8f58dfbed7ca8368&quot; target=&quot;_blank&quot;&gt;Renewal Form&lt;/a&gt; duly filled &lt;em&gt;(by a typewriter or 
computer)&lt;/em&gt; data as appear in the passport, signed and stamped by employer. 
&lt;/li&gt;
&lt;li&gt;Valid passport. &lt;/li&gt;
&lt;li&gt;Provide two recent colour photographs, size (4X6). &lt;/li&gt;
&lt;li&gt;Iqama fees paid at an authorised bank.&lt;/li&gt;
&lt;li&gt;Expatriate who works for private sector must have work licence issued by 
Labour Office.&lt;/li&gt;
&lt;li&gt;For individuals, a photocopy of employer&#39;s Civil Affairs ID must be 
attached. &lt;/li&gt;
&lt;li&gt;For restaurant and kitchen labourer, chef, maid and private driver; a 
medical report by an authorised hospital or clinic is required. &lt;/li&gt;
&lt;li&gt;Provide expired Resident Permit (Iqama).&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNode71e3b60041a63d46b5cabfffe87aece9&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Issue 
Loss Replacement Resident Permit &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;71e3b60041a63d46b5cabfffe87aece9&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;strong&gt;Requirements to issue loss replacement 
&lt;/strong&gt;&lt;strong&gt;Resident Permit (Iqama)&lt;/strong&gt;&lt;/div&gt;
&lt;ul class=&quot;bodytext&quot;&gt;
&lt;li class=&quot;bodytext&quot;&gt;Report to the nearest Passports Administration within 24 
hours. &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Provide valid passport. &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Provide a copy of the lost Iqama if available.&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Fill the&amp;nbsp;&lt;a href=&quot;http://www.moi.gov.sa/wps/wcm/connect/75268d804d4bb7fb8f58dfbed7ca8368/AlienMultiForm_FP.pdf?MOD=AJPERES&amp;amp;CACHEID=75268d804d4bb7fb8f58dfbed7ca8368&quot; target=&quot;_blank&quot;&gt;Specified Form&lt;/a&gt; duly &lt;em&gt;(by a typewriter or computer)&lt;/em&gt; 
data as appear in the passport, signed and stamped by employer.&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Iqama fees are 500 Saudi Riyals valid for a year, this must 
paid at any authorised bank.&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Provide two recent colour photos, size (4X6) cm. &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Pay the statutory fines. &lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNodef22b0b0041a63d88b5d3bfffe87aece9&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Issue 
Damage Replacement Resident Permit &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;f22b0b0041a63d88b5d3bfffe87aece9&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;strong&gt;Requirements to issue Damage Replacement Resident 
Permit (Iqama)&lt;/strong&gt;&lt;/div&gt;
&lt;ul class=&quot;bodytext&quot;&gt;
&lt;li class=&quot;bodytext&quot;&gt;Damage Replacement Iqama form duly filled in &lt;em&gt;(by a 
typewriter or a computer) &lt;/em&gt;as it appears in the passport, signed and stamped 
by the employer &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Provide the original damaged Iqama &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Provide two recent colour photographs, 4X6 cm in size&amp;nbsp;&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Provide a valid passport of the expatriate &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Iqama loss replacement fees are 500 S.R. valid for a year, 
this must be paid&amp;nbsp;at an authorised bank &lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNodeb97a488041a63dffb5ddbfffe87aece9&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Issue 
Exit/ Re-Entry Visa (single/ multiple) &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;b97a488041a63dffb5ddbfffe87aece9&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;strong&gt;Requirements to issue Exit/ Re-Entry Visa (single/ 
multiple)&lt;/strong&gt;&lt;/div&gt;
&lt;ul class=&quot;bodytext&quot;&gt;
&lt;li class=&quot;bodytext&quot;&gt;Exit Re-Entry Visa &lt;a href=&quot;http://www.moi.gov.sa/wps/wcm/connect/75268d804d4bb7fb8f58dfbed7ca8368/AlienMultiForm_FP.pdf?MOD=AJPERES&amp;amp;CACHEID=75268d804d4bb7fb8f58dfbed7ca8368&quot; target=&quot;_blank&quot;&gt;Form&lt;/a&gt; duly filled. &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Specify visa duration. &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;The passport and Resident Permit (Iqama) must be valid. &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;If the visa is for medical employees, approval letter from 
the Health Affairs Administration must be attached. &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Pay the required fees in an authorised bank. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNodefa39880041a63e26b5e6bfffe87aece9&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Issue 
Final Exit Visa &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;fa39880041a63e26b5e6bfffe87aece9&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;strong&gt;Requirements to issue Final Exit Visa&lt;/strong&gt;&lt;/div&gt;
&lt;ul class=&quot;bodytext&quot;&gt;
&lt;li class=&quot;bodytext&quot;&gt;Final Exit Visa &lt;a href=&quot;http://www.moi.gov.sa/wps/wcm/connect/75268d804d4bb7fb8f58dfbed7ca8368/AlienMultiForm_FP.pdf?MOD=AJPERES&amp;amp;CACHEID=75268d804d4bb7fb8f58dfbed7ca8368&quot; target=&quot;_blank&quot;&gt;Form&lt;/a&gt; duly filled. &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Provide valid Resident Permit (Iqama). &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Provide valid passport.&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;For household help, employer must provide evidence that the 
employee has received all his/her dues. &lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td class=&quot;wcmtreeexpand&quot; id=&quot;faqTreeNode291a230041a63e54b5efbfffe87aece9&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;span class=&quot;bodytext&quot; style=&quot;cursor: pointer;&quot;&gt;Extend 
Visit Visa &lt;/span&gt;
&lt;div _extended=&quot;true&quot; _overflow=&quot;undefined&quot; class=&quot;bodytext&quot; id=&quot;291a230041a63e54b5efbfffe87aece9&quot; style=&quot;background-color: #dceed2; direction: ltr; margin: 4px;&quot;&gt;
&lt;div class=&quot;bodytext&quot;&gt;
&lt;strong&gt;Requirements to extend Visit Visa:&lt;/strong&gt;&lt;/div&gt;
&lt;ul class=&quot;bodytext&quot;&gt;
&lt;li class=&quot;bodytext&quot;&gt;Extend Visa request form duly filled in &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Sign and stamp the approval form by the host &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Provide a photocopy of the passport including the visit visa 
&lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Provide a photocopy of the expatriate&#39;s host ID &lt;/li&gt;
&lt;li class=&quot;bodytext&quot;&gt;Pay the required fees at an authorised bank and provide a 
receipt&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/3595310350277726632/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2013/03/expatriates-procedures-in-saudi-arabia.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/3595310350277726632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/3595310350277726632'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2013/03/expatriates-procedures-in-saudi-arabia.html' title='Expatriates Procedures in Saudi Arabia'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-5996014449549282145</id><published>2013-03-06T17:14:00.000+03:00</published><updated>2013-03-06T17:14:08.809+03:00</updated><title type='text'>How to Change Default Browser (or Make Firefox / Chrome / IE Default Browser)</title><content type='html'>&lt;br /&gt;
&lt;div class=&quot;hfeed&quot; id=&quot;content&quot;&gt;
&lt;div class=&quot;post-6579 post type-post status-publish format-standard hentry category-how-to-guides tag-browser tag-chrome tag-firefox tag-internet-explorer&quot;&gt;
&lt;h1 class=&quot;entry-title&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;So the other day I downloaded and installed the &lt;a href=&quot;http://www.opera.com/&quot; target=&quot;_blank&quot; title=&quot;latest version of Opera&quot;&gt;latest version of Opera&lt;/a&gt;. I had 
heard good things about this new version and wanted to give it a shot. 
Strangely, during the installation process, I didn’t see any option to &lt;em&gt;not 
set&lt;/em&gt; it as default browser. It quickly installed and set itself as the 
default browser.&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;div class=&quot;entry-content&quot;&gt;
I probably missed a step or two in the installation process because as far as 
I know, all the browsers let the user decide if it wants to choose them as 
default. This was just an example and this can happen sometimes when 
&lt;strong&gt;some changes to the system change default browser&lt;/strong&gt; without 
letting you know. You only find that out when you click on a link on, lets say, 
a chat window on your IM client and it suddenly opens the link in the new 
browser you installed, instead of your favorite browser.&lt;br /&gt;

The purpose of this article is to teach people – who are facing this problem 
– how to change default browser back to the old one manually.&lt;br /&gt;

We will take up Firefox, Chrome and IE in this post, and Safari and Opera in 
the next one.&lt;br /&gt;

&lt;h2&gt;
Make Firefox Your Default Browser&lt;/h2&gt;
In my case, I had Firefox set as the default browser and wanted it to remain 
like that. Hence when Opera set itself as the default browser without my 
permission, it didn’t make me jump with joy. I kinda like external links to open 
in Firefox.&lt;br /&gt;

Turned out that it wasn’t that difficult to revert the change. I first had to 
visit &lt;strong&gt;Tools –&amp;gt; Options&lt;/strong&gt; to find where the setting was. It was 
under the &lt;strong&gt;Advanced&lt;/strong&gt; tab. You can see below that there’s a way to 
check if Firefox is the default browser, without the need to restart it.&lt;br /&gt;

&lt;img alt=&quot;make firefox default browser 1&quot; border=&quot;0&quot; height=&quot;484&quot; src=&quot;http://www.guidingtech.com/assets/postimages/2011/04/makefirefoxdefaultbrowser1.png&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;make firefox default browser 1&quot; width=&quot;514&quot; /&gt;&lt;br /&gt;

When you click on Check Now, it’ll pop up a box where you can set it as your 
default browser by clicking on Yes.&lt;br /&gt;
&lt;!-- Easy AdSense (WP) V6.00 --&gt;&lt;!-- Post[count: 1] --&gt;
&lt;div class=&quot;ezAdsense adsense adsense-midtext&quot; style=&quot;margin: 12px;&quot;&gt;
&lt;script&gt;&lt;/script&gt;

&lt;script&gt;&lt;/script&gt;
&lt;/div&gt;
&lt;!-- Easy AdSense (WP) V6.00 --&gt;
&lt;img alt=&quot;make firefox default browser 2&quot; border=&quot;0&quot; height=&quot;241&quot; src=&quot;http://www.guidingtech.com/assets/postimages/2011/04/makefirefoxdefaultbrowser2.png&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;make firefox default browser 2&quot; width=&quot;590&quot; /&gt;&lt;br /&gt;

Simple, isn’t it? Now lets see how we can do it in Chrome.&lt;br /&gt;

&lt;h2&gt;
Make Chrome Your Default Browser&lt;/h2&gt;
Making Chrome your default browser is more simple because the setting is 
there right on the first page of the Options.&lt;br /&gt;

You can visit Chrome Options by clicking on the wrench icon at the top, and 
there under &lt;strong&gt;Basics&lt;/strong&gt;, at the very bottom you’ll find a button 
that says &lt;strong&gt;Make Google Chrome my default browser&lt;/strong&gt;. Clicking on it 
should get the job done.&lt;br /&gt;

&lt;img alt=&quot;make chrome default browser&quot; border=&quot;0&quot; height=&quot;578&quot; src=&quot;http://www.guidingtech.com/assets/postimages/2011/04/makechromedefaultbrowser.png&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;make chrome default browser&quot; width=&quot;600&quot; /&gt;&lt;br /&gt;

&lt;h2&gt;
Make Internet Explorer Default Browser&lt;/h2&gt;
Considering the rave reviews IE 9 has received, it is possible that many 
people – who were not IE users previously – are now using it as their default 
browser. And then, there are millions of other IE users to consider (Lest you 
forget, IE is still the most widely used browser).&lt;br /&gt;

No matter what version of IE you are using, the Internet Options window is 
the answer to setting it as your default browser. You would need to go to 
&lt;strong&gt;Tools –&amp;gt; Internet Options&lt;/strong&gt;, and then to 
&lt;strong&gt;Programs&lt;/strong&gt;. There you’ll find the button that will set IE as 
default browser. Click on it, click OK and you’re done!&lt;br /&gt;

&lt;img alt=&quot;make ie default browser&quot; border=&quot;0&quot; height=&quot;520&quot; src=&quot;http://www.guidingtech.com/assets/postimages/2011/04/makeiedefaultbrowser.png&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;make ie default browser&quot; width=&quot;405&quot; /&gt;&lt;br /&gt;

That was about manually setting Firefox, Chrome or IE as the default browser. 
Tomorrow, we will take up Safari and Opera, and see how to change default 
browser in that case.&lt;br /&gt;
&lt;span id=&quot;pty_trigger&quot;&gt;&lt;/span&gt;&lt;!--&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;
   xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot;
   xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
  &lt;rdf:Description rdf:about=&quot;http://www.guidingtech.com/6579/change-default-browser-make-firefox-chrome-ie-default-browser/&quot;
    dc:identifier=&quot;http://www.guidingtech.com/6579/change-default-browser-make-firefox-chrome-ie-default-browser/&quot;
    dc:title=&quot;How to Change Default Browser (or Make Firefox / Chrome / IE Default Browser)&quot;
    trackback:ping=&quot;http://www.guidingtech.com/6579/change-default-browser-make-firefox-chrome-ie-default-browser/trackback/&quot; /&gt;
&lt;/rdf:RDF&gt;--&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/5996014449549282145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2013/03/how-to-change-default-browser-or-make_6.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/5996014449549282145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/5996014449549282145'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2013/03/how-to-change-default-browser-or-make_6.html' title='How to Change Default Browser (or Make Firefox / Chrome / IE Default Browser)'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-6148435960725400392</id><published>2013-01-14T17:13:00.005+03:00</published><updated>2013-01-14T17:13:53.613+03:00</updated><title type='text'>Passing Data Between Forms</title><content type='html'>&lt;form action=&quot;/Articles/14122/Passing-Data-Between-Forms&quot; id=&quot;aspnetForm&quot; method=&quot;post&quot; name=&quot;aspnetForm&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;
&lt;input id=&quot;__VIEWSTATE&quot; name=&quot;__VIEWSTATE&quot; type=&quot;hidden&quot; value=&quot;/wEPDwUKMjExOTQzNjk4Mw9kFgJmD2QWBgIHDxYCHgdWaXNpYmxlZ2QCCg8WAh4FY2xhc3MFE3N1Yi1oZWFkZXJiYXIgZml4ZWRkAgsPFgIfAQUcY29udGFpbmVyLWNvbnRlbnQtd3JhcCBmaXhlZBYQAgEPZBYCZg8WAh4EVGV4dAXJATxkaXY+PGEgaHJlZj0iL3NjcmlwdC9Db250ZW50L1NpdGVNYXAuYXNweCI+QXJ0aWNsZXM8L2E+ICYjMTg3OyA8YSBocmVmPSIvQ2hhcHRlcnMvNS9MYW5ndWFnZXMuYXNweCI+TGFuZ3VhZ2VzPC9hPiAmIzE4NzsgPGEgaHJlZj0iL0tCL2NzLyI+QyM8L2E+ICYjMTg3OyA8YSBocmVmPSIvS0IvY3MvI1V0aWxpdGllcyI+VXRpbGl0aWVzPC9hPjwvZGl2PmQCAw9kFgQCBA8PFgIeC05hdmlnYXRlVXJsBTgvc2NyaXB0L0F3YXJkcy9BZG1pbi9Bd2FyZE9iamVjdC5hc3B4P29iaWQ9MTQxMjImb2J0aWQ9MmRkAg4PDxYCHwMFLy9zY3JpcHQvQXJ0aWNsZXMvQWRtaW4vUXVldWVFZGl0LmFzcHg/YWlkPTE0MTIyZGQCBQ9kFghmDw8WBB4ISW1hZ2VVcmwFFi9JbWFnZXMvYXJyb3ctbGVmdC5wbmcfAGcWBB4Fc3R5bGUFFnZlcnRpY2FsLWFsaWduOmJvdHRvbTseA3JlbAUIbm9mb2xsb3dkAgEPDxYGHwMFJC9zY3JpcHQvQXJ0aWNsZXMvVmlldy5hc3B4P2FpZD0yMjU0OB4HVG9vbFRpcGUfAGdkZAICDw8WBh8DBSQvc2NyaXB0L0FydGljbGVzL1ZpZXcuYXNweD9haWQ9MTYzNDMfB2UfAGdkZAIDDw8WBB8EBRcvSW1hZ2VzL2Fycm93LXJpZ2h0LnBuZx8AZxYEHwUFFnZlcnRpY2FsLWFsaWduOmJvdHRvbTsfBgUIbm9mb2xsb3dkAgcPZBYEAgMPFgQeBGhyZWYFCiNfY29tbWVudHMfAQUKYW5jaG9yTGluaxYCAgEPFgIeCWlubmVyaHRtbAUEKDU0KWQCBQ8PFgIfAwU2L3NjcmlwdC9BcnRpY2xlcy9TdWJtaXNzaW9uV2l6YXJkLmFzcHg/YXQ9MSZhcGlkPTE0MTIyZGQCCQ8WAh8BBRhjb250YWluZXItYXJ0aWNsZSAgZml4ZWQWBgIBDxYCHwBnFgZmDxYCHwkFGlBhc3NpbmcgRGF0YSBCZXR3ZWVuIEZvcm1zZAIBDxYCHwIFWjxhIGhyZWY9Ii9zY3JpcHQvTWVtYmVyc2hpcC9WaWV3LmFzcHg/bWlkPTE0NTcwMjEiIHJlbD0iYXV0aG9yIj5UaGlhZ2FyYWphbiBBbGFnYXJzYW15PC9hPmQCAg8WAh8CBQsxNiBNYXkgMjAwNmQCAw8PFgIfAGdkZAIND2QWAgICDxYCHgZhY3Rpb24FKi9BcnRpY2xlcy8xNDEyMi9QYXNzaW5nLURhdGEtQmV0d2Vlbi1Gb3JtcxYIAgEPZBYCAgEPFgIfAGhkAgMPZBYCAgIPZBYCAgEPEGRkFgBkAgkPFgIeC18hSXRlbUNvdW50AgFkAgsPZBYCAgEPFgIfAgVjPGEgY2xhc3M9ImFuY2hvckxpbmsiIGhyZWY9Ii9BcnRpY2xlcy8xNDEyMi9QYXNzaW5nLURhdGEtQmV0d2Vlbi1Gb3JtcyNfYXJ0aWNsZVRvcCI+QXJ0aWNsZSBUb3A8L2E+ZAILD2QWAgILD2QWBAICDw8WAh8DBTgvQXJ0aWNsZXMvMTQxMjIvUGFzc2luZy1EYXRhLUJldHdlZW4tRm9ybXM/ZGlzcGxheT1QcmludGRkAgQPDxYCHwMFMS9zY3JpcHQvY29tbW9uL1RlbGxGcmllbmQuYXNweD9vYnRpZD0yJm9iaWQ9MTQxMjJkZAINDw8WBB8CBQlQZXJtYWxpbmsfAwUqL0FydGljbGVzLzE0MTIyL1Bhc3NpbmctRGF0YS1CZXR3ZWVuLUZvcm1zZGQCHQ8WAh8CBShDb3B5cmlnaHQgMjAwNiBieSBUaGlhZ2FyYWphbiBBbGFnYXJzYW15ZGRW4TXMKOxw6/jTq1+rLx49ZVX6uQ==&quot; /&gt;&lt;input id=&quot;__EVENTVALIDATION&quot; name=&quot;__EVENTVALIDATION&quot; type=&quot;hidden&quot; value=&quot;/wEWCALdzY2aDgLAlMXDBwLBlMXDBwLClMXDBwLDlMXDBwLElMXDBwLP+++tCwK5upDkCwkfnjnoJno9dr9+nBM1YFGaMyjO&quot; /&gt;Some of you would have faced a scenario where you wanted to &lt;span class=&quot;search-highlight&quot;&gt;pass&lt;/span&gt; data from &lt;span class=&quot;search-highlight&quot;&gt;one&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt; to another in Win&lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;s. H&lt;span class=&quot;search-highlight&quot;&gt;one&lt;/span&gt;stly, I too had a similar problem (that’s why I am writing this article!). &lt;/form&gt;
&lt;br /&gt;
There are so many methods (How many? I don&#39;t know) to &lt;span class=&quot;search-highlight&quot;&gt;pass&lt;/span&gt; data between &lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;s in Windows application. In this article, let me take four important (easiest) ways of accomplishing this:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Using constructor &lt;/li&gt;
&lt;li&gt;Using objects &lt;/li&gt;
&lt;li&gt;Using properties &lt;/li&gt;
&lt;li&gt;Using delegates&lt;/li&gt;
&lt;/ol&gt;
Let us see all the above methods in detail in the following sections.&lt;br /&gt;
For data to be &lt;span class=&quot;search-highlight&quot;&gt;pass&lt;/span&gt;ed between &lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;s using any of the above methods, we need two &lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;s and some controls. Let us start by following the steps given below.&lt;br /&gt;
&lt;h4 style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;color: #cc0000;&quot;&gt;Thanks Code Project&lt;/span&gt;&lt;/h4&gt;
&lt;img alt=&quot;Sample Image - PassData.jpg&quot; height=&quot;215&quot; src=&quot;http://www.codeproject.com/KB/cs/pass_data_between_forms/PassData.jpg&quot; width=&quot;555&quot; /&gt;&lt;br /&gt;
&lt;div class=&quot;article-text&quot; id=&quot;contentdiv&quot;&gt;
&lt;div class=&quot;caption&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;caption&quot;&gt;
&lt;span class=&quot;search-highlight&quot;&gt;Pass&lt;/span&gt;ing Data Between &lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;s &lt;/div&gt;
&lt;h2&gt;
&amp;nbsp;&lt;/h2&gt;
&lt;h4&gt;
Step 1&lt;/h4&gt;
Create a new project and select Windows application. This will create a default &lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt; as “&lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;1&lt;/code&gt;”. We can use this &lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt; for sending data.&lt;br /&gt;
&lt;h4&gt;
Step 2&lt;/h4&gt;
Add a &lt;code&gt;textbox &lt;/code&gt;and a &lt;code&gt;button &lt;/code&gt;to the &lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;.&lt;br /&gt;
&lt;h4&gt;
Step 3&lt;/h4&gt;
Add another Windows &lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt; for receiving the data and to display it. Right click the project and select Add-&amp;gt;Add Windows &lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;. Enter a name or use the default name “&lt;em&gt;&lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;2.cs&lt;/em&gt;” and click ok button.&lt;br /&gt;
&lt;h4&gt;
Step 4&lt;/h4&gt;
Add a label to the second &lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt; to display the text from &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;1&lt;/code&gt;.&lt;br /&gt;
&lt;h2&gt;
The Constructor Approach &lt;/h2&gt;
This could be the easiest method of all. A method is invoked whenever you instantiate an object. This method is called a constructor. Code a constructor for &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2 &lt;/code&gt;class with &lt;span class=&quot;search-highlight&quot;&gt;one&lt;/span&gt; &lt;code&gt;string &lt;/code&gt;parameter. In the constructor, assign the text to the &lt;code&gt;label&lt;/code&gt;’s &lt;code&gt;text &lt;/code&gt;property. Instantiate &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2 &lt;/code&gt;class in &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;1&lt;/code&gt;’s button click event handler using the constructor with &lt;span class=&quot;search-highlight&quot;&gt;one&lt;/span&gt; &lt;code&gt;string &lt;/code&gt;parameter and &lt;span class=&quot;search-highlight&quot;&gt;pass&lt;/span&gt; the &lt;code&gt;textbox&lt;/code&gt;’s text to the constructor.&lt;br /&gt;
Follow the steps given below:&lt;br /&gt;
&lt;h4&gt;
Step 1&lt;/h4&gt;
Code a constructor for &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2 &lt;/code&gt;class as below:&lt;br /&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain0&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg0&quot; preid=&quot;0&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse0&quot; preid=&quot;0&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/14122/Passing-Data-Between-Forms#&quot; preid=&quot;0&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;pre id=&quot;pre0&quot; lang=&quot;cs&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;2(&lt;span class=&quot;code-keyword&quot;&gt;string&lt;/span&gt; strTextBox)
{
  InitializeComp&lt;span class=&quot;search-highlight&quot;&gt;one&lt;/span&gt;nt(); 
  label1.Text=strTextBox;
}&lt;/pre&gt;
&lt;h4&gt;
Step 2&lt;/h4&gt;
Instantiate &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2 &lt;/code&gt;class in &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;1&lt;/code&gt;’s button click event handler as below:&lt;br /&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain1&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg1&quot; preid=&quot;1&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse1&quot; preid=&quot;1&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/14122/Passing-Data-Between-Forms#&quot; preid=&quot;1&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;pre id=&quot;pre1&quot; lang=&quot;cs&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;void&lt;/span&gt; button1_Click(&lt;span class=&quot;code-keyword&quot;&gt;object&lt;/span&gt; sender, System.EventArgs e)
{
    &lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;2 frm=new &lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;2(textBox1.Text);
    frm.Show();
}&lt;/pre&gt;
&lt;h2&gt;
The Object Approach &lt;/h2&gt;
Objects are reference types, and are created on the heap, using the keyword &lt;code&gt;new&lt;/code&gt;. Here we are going to &lt;span class=&quot;search-highlight&quot;&gt;pass&lt;/span&gt; data using objects. The approach is simple; in &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2 &lt;/code&gt;we are going to instantiate &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;1 &lt;/code&gt;class. &lt;br /&gt;
Then instantiate &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2 &lt;/code&gt;in the button click event handler of &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;1&lt;/code&gt;. After this we are going to &lt;span class=&quot;search-highlight&quot;&gt;pass&lt;/span&gt; &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;1 &lt;/code&gt;object to the &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2 &lt;/code&gt;using &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2&lt;/code&gt;’s &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;1 &lt;/code&gt;object. The last step is to invoke the &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2 &lt;/code&gt;window by calling the &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2&lt;/code&gt;’s &lt;code&gt;show &lt;/code&gt;method. &lt;br /&gt;
Follow the below steps: &lt;br /&gt;
&lt;h4&gt;
Step 1&lt;/h4&gt;
Change the access modifier for &lt;code&gt;textbox &lt;/code&gt;in &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;1 &lt;/code&gt;to &lt;code&gt;public&lt;/code&gt;:&lt;br /&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain2&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg2&quot; preid=&quot;2&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse2&quot; preid=&quot;2&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/14122/Passing-Data-Between-Forms#&quot; preid=&quot;2&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;pre id=&quot;pre2&quot; lang=&quot;cs&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;1 : System.Windows.&lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;s.&lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;
{  
 &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; System.Windows.&lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;s.TextBox textBox1;&lt;/pre&gt;
&lt;h4&gt;
Step 2&lt;/h4&gt;
In the button click event-handler, add the following code: &lt;br /&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain3&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg3&quot; preid=&quot;3&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse3&quot; preid=&quot;3&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/14122/Passing-Data-Between-Forms#&quot; preid=&quot;3&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;pre id=&quot;pre3&quot; lang=&quot;cs&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;void&lt;/span&gt; btnSend_Click(&lt;span class=&quot;code-keyword&quot;&gt;object&lt;/span&gt; sender, System.EventArgs e)
{
    &lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;2 frm= &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;2();
    frm.frm1=this;
    frm.Show();
}&lt;/pre&gt;
&lt;h4&gt;
Step 3&lt;/h4&gt;
In &lt;em&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2.cs&lt;/em&gt;, instantiate &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;1 &lt;/code&gt;class: &lt;br /&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain4&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg4&quot; preid=&quot;4&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse4&quot; preid=&quot;4&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/14122/Passing-Data-Between-Forms#&quot; preid=&quot;4&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;pre id=&quot;pre4&quot; lang=&quot;cs&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;2 : System.Windows.&lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;s.&lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;
{
     &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; System.Windows.&lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;s.Label label1;
     &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;1 frm1;&lt;/pre&gt;
&lt;h4&gt;
Step 4&lt;/h4&gt;
In &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;2&lt;/code&gt;’s &lt;code&gt;Load &lt;/code&gt;method, type cast the object (&lt;code&gt;frm1&lt;/code&gt;) of &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;1 &lt;/code&gt;to &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;1 &lt;/code&gt;and access &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;1&lt;/code&gt;’s &lt;code&gt;textbox &lt;/code&gt;and assign its text to &lt;code&gt;label&lt;/code&gt;’s text. &lt;br /&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain5&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg5&quot; preid=&quot;5&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse5&quot; preid=&quot;5&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/14122/Passing-Data-Between-Forms#&quot; preid=&quot;5&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;pre id=&quot;pre5&quot; lang=&quot;cs&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;2_Load(&lt;span class=&quot;code-keyword&quot;&gt;object&lt;/span&gt; sender, System.EventArgs e)
{
    label1.Text=((&lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;1)frm1).textBox1.Text;
}&lt;/pre&gt;
&lt;h2&gt;
The Properties Approach &lt;/h2&gt;
Properties allow clients to access class state as if they were accessing member fields directly, while actually implementing that access through a class method. In this method, we are going to add &lt;span class=&quot;search-highlight&quot;&gt;one&lt;/span&gt; property to each &lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;. In &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;1 &lt;/code&gt;we are going to use &lt;span class=&quot;search-highlight&quot;&gt;one&lt;/span&gt; property for retrieving value from the &lt;code&gt;textbox &lt;/code&gt;and in &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2&lt;/code&gt;, &lt;span class=&quot;search-highlight&quot;&gt;one&lt;/span&gt; property to set the &lt;code&gt;label&lt;/code&gt;’s text property. Then, in &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;1&lt;/code&gt;’s button click event handler, we are going to instantiate &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2 &lt;/code&gt;and use the &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2&lt;/code&gt;’s property to set the &lt;code&gt;label&lt;/code&gt;’s text. &lt;br /&gt;
Follow the below steps: &lt;br /&gt;
&lt;h4&gt;
Step 1&lt;/h4&gt;
Add a property in &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;1 &lt;/code&gt;to retrieve value from &lt;code&gt;textbox&lt;/code&gt;:&lt;br /&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain6&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg6&quot; preid=&quot;6&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse6&quot; preid=&quot;6&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/14122/Passing-Data-Between-Forms#&quot; preid=&quot;6&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;pre id=&quot;pre6&quot; lang=&quot;cs&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;string&lt;/span&gt; _textBox1
{
    &lt;span class=&quot;code-keyword&quot;&gt;get&lt;/span&gt;{&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; textBox1.Text;}
}&lt;/pre&gt;
&lt;h4&gt;
Step 2&lt;/h4&gt;
Add a property in &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2 &lt;/code&gt;to set the &lt;code&gt;label&lt;/code&gt;s’ &lt;code&gt;text&lt;/code&gt;:&lt;br /&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain7&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg7&quot; preid=&quot;7&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse7&quot; preid=&quot;7&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/14122/Passing-Data-Between-Forms#&quot; preid=&quot;7&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;pre id=&quot;pre7&quot; lang=&quot;cs&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;string&lt;/span&gt; _textBox
{
   &lt;span class=&quot;code-keyword&quot;&gt;set&lt;/span&gt;{label1.Text=value;}
}&lt;/pre&gt;
&lt;h4&gt;
Step 3&lt;/h4&gt;
In &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;1&lt;/code&gt;’s button click event handler, add the following code: &lt;br /&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain8&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg8&quot; preid=&quot;8&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse8&quot; preid=&quot;8&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/14122/Passing-Data-Between-Forms#&quot; preid=&quot;8&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;pre id=&quot;pre8&quot; lang=&quot;cs&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;void&lt;/span&gt; button1_Click(&lt;span class=&quot;code-keyword&quot;&gt;object&lt;/span&gt; sender, System.EventArgs e)
{
     &lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;2 frm=new &lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;2();
     frm._textBox=_textBox1;
     frm.Show();
}&lt;/pre&gt;
&lt;h2&gt;
The Delegates Approach &lt;/h2&gt;
Technically, a &lt;code&gt;delegate &lt;/code&gt;is a reference type used to encapsulate a method with a specific signature and return type. You can encapsulate any matching method in that &lt;code&gt;delegate&lt;/code&gt;. Here we are going to create a &lt;code&gt;delegate &lt;/code&gt;with some signature and assign a function to the &lt;code&gt;delegate &lt;/code&gt;to assign the &lt;code&gt;text &lt;/code&gt;from &lt;code&gt;textbox &lt;/code&gt;to &lt;code&gt;label&lt;/code&gt;. &lt;br /&gt;
Follow the below steps: &lt;br /&gt;
&lt;h4&gt;
Step 1&lt;/h4&gt;
Add a &lt;code&gt;delegate &lt;/code&gt;signature to &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;1 &lt;/code&gt;as below: &lt;br /&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain9&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg9&quot; preid=&quot;9&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse9&quot; preid=&quot;9&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/14122/Passing-Data-Between-Forms#&quot; preid=&quot;9&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;pre id=&quot;pre9&quot; lang=&quot;cs&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;delegate&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;void&lt;/span&gt; del&lt;span class=&quot;search-highlight&quot;&gt;Pass&lt;/span&gt;Data(TextBox text);&lt;/pre&gt;
&lt;h4&gt;
Step 2&lt;/h4&gt;
In &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;1&lt;/code&gt;’s button click event handler, instantiate &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2 &lt;/code&gt;class and &lt;code&gt;delegate&lt;/code&gt;. Assign a function in &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2 &lt;/code&gt;to the &lt;code&gt;delegate &lt;/code&gt;and call the &lt;code&gt;delegate &lt;/code&gt;as below: &lt;br /&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain10&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg10&quot; preid=&quot;10&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse10&quot; preid=&quot;10&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/14122/Passing-Data-Between-Forms#&quot; preid=&quot;10&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;pre id=&quot;pre10&quot; lang=&quot;cs&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;void&lt;/span&gt; btnSend_Click(&lt;span class=&quot;code-keyword&quot;&gt;object&lt;/span&gt; sender, System.EventArgs e)
{
    &lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;2 frm= &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;2();
    del&lt;span class=&quot;search-highlight&quot;&gt;Pass&lt;/span&gt;Data del=new del&lt;span class=&quot;search-highlight&quot;&gt;Pass&lt;/span&gt;Data(frm.funData);
    del(&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;.textBox1);
    frm.Show();
}&lt;/pre&gt;
&lt;h4&gt;
Step 3&lt;/h4&gt;
In &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;2&lt;/code&gt;, add a function to which the &lt;code&gt;delegate &lt;/code&gt;should point to. This function will assign &lt;code&gt;textbox&lt;/code&gt;’s &lt;code&gt;text &lt;/code&gt;to the &lt;code&gt;label&lt;/code&gt;: &lt;br /&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain11&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg11&quot; preid=&quot;11&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse11&quot; preid=&quot;11&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/14122/Passing-Data-Between-Forms#&quot; preid=&quot;11&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;pre id=&quot;pre11&quot; lang=&quot;cs&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;void&lt;/span&gt; funData(TextBox txt&lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;1)
{
    label1.Text = txt&lt;span class=&quot;search-highlight&quot;&gt;Form&lt;/span&gt;1.Text;
}&lt;/pre&gt;
&lt;h2&gt;
Conclusion&lt;/h2&gt;
These four approaches are very simple in implementing data &lt;span class=&quot;search-highlight&quot;&gt;pass&lt;/span&gt;ing between &lt;span class=&quot;search-highlight&quot;&gt;form&lt;/span&gt;s. There are also other methods available in accomplishing the same. Source code for the methods I stated above is given at the top for download. It is time for you to put on your thinking cap and find other ways of doing this. Happy coding!!! &lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/6148435960725400392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2013/01/passing-data-between-forms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/6148435960725400392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/6148435960725400392'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2013/01/passing-data-between-forms.html' title='Passing Data Between Forms'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-6746133144429277070</id><published>2013-01-14T14:51:00.000+03:00</published><updated>2013-01-14T14:51:02.517+03:00</updated><title type='text'>Custom Date and Time Format Strings in C#</title><content type='html'>&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;Thanks: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx&quot;&gt;Microsoft&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;A date and time format string defines the text representation of a &lt;/span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.aspx&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;DateTime&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt; or &lt;/span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetimeoffset.aspx&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;DateTimeOffset&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt; value that results from a formatting operation . It can also define the representation of a date and time value that is required in a parsing operation in order to successfully convert the string to a date and time. A custom format string consists of one or more custom date and time format specifiers. Any string that is not a &lt;/span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/az4se3k1.aspx&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;standard date and time format string&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt; is interpreted as a custom date and time format string. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;Custom date and time format strings can be used with both &lt;/span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.aspx&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;DateTime&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt; and &lt;/span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetimeoffset.aspx&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;DateTimeOffset&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt; values.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;DateTime thisDate1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2011, 6, 10);&lt;br /&gt;Console.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Today is &quot;&lt;/span&gt; + thisDate1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;MMMM dd, yyyy&quot;&lt;/span&gt;) + &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;.&quot;&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;DateTimeOffset thisDate2 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTimeOffset(2011, 6, 10, 15, 24, 16, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TimeSpan.Zero);&lt;br /&gt;Console.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;The current date and time: {0:MM/dd/yy H:mm:ss zzz}&quot;&lt;/span&gt;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; thisDate2); &lt;br /&gt;&lt;span style=&quot;color: green;&quot;&gt;// The example displays the following output: &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: green;&quot;&gt;//    Today is June 10, 2011. &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: green;&quot;&gt;//    The current date and time: 06/10/11 15:24:16 +00:00&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;In parsing operations, custom date and time format strings can be used with the &lt;/span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/w2sa9yss.aspx&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;DateTimeParseExact&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;, &lt;/span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms131044.aspx&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;DateTimeTryParseExact&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;, &lt;/span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb343428.aspx&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;DateTimeOffsetParseExact&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;, and &lt;/span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb354997.aspx&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;DateTimeOffsetTryParseExact&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt; methods. These methods require that an input string conform exactly to a particular pattern for the parse operation to succeed. The following example illustrates a call to the &lt;/span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb343428.aspx&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;DateTimeOffsetParseExact(String, String, IFormatProvider)&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt; method to parse a date that must include a day, a month, and a two-digit year.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt; System;&lt;br /&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt; System.Globalization;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; Example&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Main()&lt;br /&gt;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;[] dateValues = { &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;30-12-2011&quot;&lt;/span&gt;, &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;12-30-2011&quot;&lt;/span&gt;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;30-12-11&quot;&lt;/span&gt;, &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;12-30-11&quot;&lt;/span&gt; };&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; pattern = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;MM-dd-yy&quot;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime parsedDate;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; dateValue &lt;span style=&quot;color: blue;&quot;&gt;in&lt;/span&gt; dateValues) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (DateTime.TryParseExact(dateValue, pattern, &lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DateTimeStyles.None, &lt;span style=&quot;color: blue;&quot;&gt;out&lt;/span&gt; parsedDate))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Converted &#39;{0}&#39; to {1:d}.&quot;&lt;/span&gt;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dateValue, parsedDate);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Unable to convert &#39;{0}&#39; to a date and time.&quot;&lt;/span&gt;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dateValue);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;span style=&quot;color: green;&quot;&gt;// The example displays the following output: &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: green;&quot;&gt;//    Unable to convert &#39;30-12-2011&#39; to a date and time. &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: green;&quot;&gt;//    Unable to convert &#39;12-30-2011&#39; to a date and time. &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: green;&quot;&gt;//    Unable to convert &#39;30-12-11&#39; to a date and time. &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: green;&quot;&gt;//    Converted &#39;12-30-11&#39; to 12/30/2011.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;The following table describes the custom date and time format specifiers and displays a result string produced by each format specifier. If a particular format specifier produces a localized result string, the example also notes the culture to which the result string applies. See the Notes section for additional information about using custom date and time format strings.&lt;br /&gt;
&lt;div class=&quot;caption&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;tableSection&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th&gt;Format specifier&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;th&gt;Examples&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;d&quot;&lt;/td&gt;&lt;td&gt;The day of the month, from 1 through 31. &lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#dSpecifier&quot;&gt;The &quot;d&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/1/2009 1:45:30 PM -&amp;gt; 1&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; 15&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;dd&quot;&lt;/td&gt;&lt;td&gt;The day of the month, from 01 through 31.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#ddSpecifier&quot;&gt;The &quot;dd&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/1/2009 1:45:30 PM -&amp;gt; 01&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; 15&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;ddd&quot;&lt;/td&gt;&lt;td&gt;The abbreviated name of the day of the week.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#dddSpecifier&quot;&gt;The &quot;ddd&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 PM -&amp;gt; Mon (en-US)&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; Пн (ru-RU)&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; lun. (fr-FR)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;dddd&quot;&lt;/td&gt;&lt;td&gt;The full name of the day of the week.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#ddddSpecifier&quot;&gt;The &quot;dddd&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 PM -&amp;gt; Monday (en-US)&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; понедельник (ru-RU)&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; lundi (fr-FR)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;f&quot;&lt;/td&gt;&lt;td&gt;The tenths of a second in a date and time value.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#fSpecifier&quot;&gt;The &quot;f&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 13:45:30.617 -&amp;gt; 6&lt;br /&gt;
6/15/2009 13:45:30.050 -&amp;gt; 0 &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;ff&quot;&lt;/td&gt;&lt;td&gt;The hundredths of a second in a date and time value.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#ffSpecifier&quot;&gt;The &quot;ff&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 13:45:30.617 -&amp;gt; 61&lt;br /&gt;
6/15/2009 13:45:30.005 -&amp;gt; 00&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;fff&quot;&lt;/td&gt;&lt;td&gt;The milliseconds in a date and time value.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#fffSpecifier&quot;&gt;The &quot;fff&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 13:45:30.617 -&amp;gt; 617&lt;br /&gt;
6/15/2009 13:45:30.0005 -&amp;gt; 000&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;ffff&quot;&lt;/td&gt;&lt;td&gt;The ten thousandths of a second in a date and time value.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#ffffSpecifier&quot;&gt;The &quot;ffff&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 13:45:30.6175 -&amp;gt; 6175&lt;br /&gt;
6/15/2009 13:45:30.00005 -&amp;gt; 0000&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;fffff&quot;&lt;/td&gt;&lt;td&gt;The hundred thousandths of a second in a date and time value.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#fffffSpecifier&quot;&gt;The &quot;fffff&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 13:45:30.61754 -&amp;gt; 61754&lt;br /&gt;
6/15/2009 13:45:30.000005 -&amp;gt; 00000&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;ffffff&quot;&lt;/td&gt;&lt;td&gt;The millionths of a second in a date and time value.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#ffffffSpecifier&quot;&gt;The &quot;ffffff&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 13:45:30.617542 -&amp;gt; 617542&lt;br /&gt;
6/15/2009 13:45:30.0000005 -&amp;gt; 000000&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;fffffff&quot;&lt;/td&gt;&lt;td&gt;The ten millionths of a second in a date and time value.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#fffffffSpecifier&quot;&gt;The &quot;fffffff&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 13:45:30.6175425 -&amp;gt; 6175425&lt;br /&gt;
6/15/2009 13:45:30.0001150 -&amp;gt; 0001150&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;F&quot;&lt;/td&gt;&lt;td&gt;If non-zero, the tenths of a second in a date and time value.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#F_Specifier&quot;&gt;The &quot;F&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 13:45:30.617 -&amp;gt; 6&lt;br /&gt;
6/15/2009 13:45:30.050 -&amp;gt; (no output)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;FF&quot;&lt;/td&gt;&lt;td&gt;If non-zero, the hundredths of a second in a date and time value.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#FF_Specifier&quot;&gt;The &quot;FF&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 13:45:30.617 -&amp;gt; 61&lt;br /&gt;
6/15/2009 13:45:30.005 -&amp;gt; (no output)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;FFF&quot;&lt;/td&gt;&lt;td&gt;If non-zero, the milliseconds in a date and time value.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#FFF_Specifier&quot;&gt;The &quot;FFF&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 13:45:30.617 -&amp;gt; 617&lt;br /&gt;
6/15/2009 13:45:30.0005 -&amp;gt; (no output)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;FFFF&quot;&lt;/td&gt;&lt;td&gt;If non-zero, the ten thousandths of a second in a date and time value.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#FFFF_Specifier&quot;&gt;The &quot;FFFF&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/1/2009 13:45:30.5275 -&amp;gt; 5275&lt;br /&gt;
6/15/2009 13:45:30.00005 -&amp;gt; (no output)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;FFFFF&quot;&lt;/td&gt;&lt;td&gt;If non-zero, the hundred thousandths of a second in a date and time value.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#FFFFF_Specifier&quot;&gt;The &quot;FFFFF&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 13:45:30.61754 -&amp;gt; 61754&lt;br /&gt;
6/15/2009 13:45:30.000005 -&amp;gt; (no output)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;FFFFFF&quot;&lt;/td&gt;&lt;td&gt;If non-zero, the millionths of a second in a date and time value.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#FFFFFF_Specifier&quot;&gt;The &quot;FFFFFF&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 13:45:30.617542 -&amp;gt; 617542&lt;br /&gt;
6/15/2009 13:45:30.0000005 -&amp;gt; (no output)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;FFFFFFF&quot;&lt;/td&gt;&lt;td&gt;If non-zero, the ten millionths of a second in a date and time value.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#FFFFFFF_Specifier&quot;&gt;The &quot;FFFFFFF&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 13:45:30.6175425 -&amp;gt; 6175425&lt;br /&gt;
6/15/2009 13:45:30.0001150 -&amp;gt; 000115&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;g&quot;, &quot;gg&quot;&lt;/td&gt;&lt;td&gt;The period or era.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#gSpecifier&quot;&gt;The &quot;g&quot; or &quot;gg&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 PM -&amp;gt; A.D.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;h&quot;&lt;/td&gt;&lt;td&gt;The hour, using a 12-hour clock from 1 to 12.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#hSpecifier&quot;&gt;The &quot;h&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 AM -&amp;gt; 1&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; 1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;hh&quot;&lt;/td&gt;&lt;td&gt;The hour, using a 12-hour clock from 01 to 12.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#hhSpecifier&quot;&gt;The &quot;hh&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 AM -&amp;gt; 01&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; 01&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;H&quot;&lt;/td&gt;&lt;td&gt;The hour, using a 24-hour clock from 0 to 23.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#H_Specifier&quot;&gt;The &quot;H&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 AM -&amp;gt; 1&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; 13&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;HH&quot;&lt;/td&gt;&lt;td&gt;The hour, using a 24-hour clock from 00 to 23.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#HH_Specifier&quot;&gt;The &quot;HH&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 AM -&amp;gt; 01&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; 13&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;K&quot;&lt;/td&gt;&lt;td&gt;Time zone information.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#KSpecifier&quot;&gt;The &quot;K&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;With &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.aspx&quot;&gt;DateTime&lt;/a&gt; values:&lt;br /&gt;
6/15/2009 1:45:30 PM, Kind Unspecified -&amp;gt; &lt;br /&gt;
6/15/2009 1:45:30 PM, Kind Utc -&amp;gt; Z&lt;br /&gt;
6/15/2009 1:45:30 PM, Kind Local -&amp;gt; -07:00 (depends on local computer settings)&lt;br /&gt;
With &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetimeoffset.aspx&quot;&gt;DateTimeOffset&lt;/a&gt; values:&lt;br /&gt;
6/15/2009 1:45:30 AM -07:00 --&amp;gt; -07:00&lt;br /&gt;
6/15/2009 8:45:30 AM +00:00 --&amp;gt; +00:00&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;m&quot;&lt;/td&gt;&lt;td&gt;The minute, from 0 through 59.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#mSpecifier&quot;&gt;The &quot;m&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:09:30 AM -&amp;gt; 9&lt;br /&gt;
6/15/2009 1:09:30 PM -&amp;gt; 9&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;mm&quot;&lt;/td&gt;&lt;td&gt;The minute, from 00 through 59.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#mmSpecifier&quot;&gt;The &quot;mm&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:09:30 AM -&amp;gt; 09&lt;br /&gt;
6/15/2009 1:09:30 PM -&amp;gt; 09&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;M&quot;&lt;/td&gt;&lt;td&gt;The month, from 1 through 12.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#M_Specifier&quot;&gt;The &quot;M&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 PM -&amp;gt; 6&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;MM&quot;&lt;/td&gt;&lt;td&gt;The month, from 01 through 12.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#MM_Specifier&quot;&gt;The &quot;MM&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 PM -&amp;gt; 06&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;MMM&quot;&lt;/td&gt;&lt;td&gt;The abbreviated name of the month. &lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#MMM_Specifier&quot;&gt;The &quot;MMM&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 PM -&amp;gt; Jun (en-US)&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; juin (fr-FR)&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; Jun (zu-ZA)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;MMMM&quot;&lt;/td&gt;&lt;td&gt;The full name of the month.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#MMMM_Specifier&quot;&gt;The &quot;MMMM&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 PM -&amp;gt; June (en-US)&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; juni (da-DK)&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; uJuni (zu-ZA)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;s&quot;&lt;/td&gt;&lt;td&gt;The second, from 0 through 59.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#sSpecifier&quot;&gt;The &quot;s&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:09 PM -&amp;gt; 9&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;ss&quot;&lt;/td&gt;&lt;td&gt;The second, from 00 through 59.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#ssSpecifier&quot;&gt;The &quot;ss&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:09 PM -&amp;gt; 09&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;t&quot;&lt;/td&gt;&lt;td&gt;The first character of the AM/PM designator.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#tSpecifier&quot;&gt;The &quot;t&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 PM -&amp;gt; P (en-US)&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; 午 (ja-JP)&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt;  (fr-FR)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;tt&quot;&lt;/td&gt;&lt;td&gt;The AM/PM designator.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#ttSpecifier&quot;&gt;The &quot;tt&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 PM -&amp;gt; PM (en-US)&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; 午後 (ja-JP)&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt;  (fr-FR)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;y&quot;&lt;/td&gt;&lt;td&gt;The year, from 0 to 99.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#ySpecifier&quot;&gt;The &quot;y&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;1/1/0001 12:00:00 AM -&amp;gt; 1&lt;br /&gt;
1/1/0900 12:00:00 AM -&amp;gt; 0&lt;br /&gt;
1/1/1900 12:00:00 AM -&amp;gt; 0&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; 9&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;yy&quot;&lt;/td&gt;&lt;td&gt;The year, from 00 to 99.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#yySpecifier&quot;&gt;The &quot;yy&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;1/1/0001 12:00:00 AM -&amp;gt; 01&lt;br /&gt;
1/1/0900 12:00:00 AM -&amp;gt; 00&lt;br /&gt;
1/1/1900 12:00:00 AM -&amp;gt; 00&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; 09&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;yyy&quot;&lt;/td&gt;&lt;td&gt;The year, with a minimum of three digits.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#yyySpecifier&quot;&gt;The &quot;yyy&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;1/1/0001 12:00:00 AM -&amp;gt; 001&lt;br /&gt;
1/1/0900 12:00:00 AM -&amp;gt; 900&lt;br /&gt;
1/1/1900 12:00:00 AM -&amp;gt; 1900&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; 2009&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;yyyy&quot;&lt;/td&gt;&lt;td&gt;The year as a four-digit number.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#yyyySpecifier&quot;&gt;The &quot;yyyy&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;1/1/0001 12:00:00 AM -&amp;gt; 0001&lt;br /&gt;
1/1/0900 12:00:00 AM -&amp;gt; 0900&lt;br /&gt;
1/1/1900 12:00:00 AM -&amp;gt; 1900&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; 2009&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;yyyyy&quot;&lt;/td&gt;&lt;td&gt;The year as a five-digit number.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#yyyyySpecifier&quot;&gt;The &quot;yyyyy&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;1/1/0001 12:00:00 AM -&amp;gt; 00001&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; 02009&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;z&quot;&lt;/td&gt;&lt;td&gt;Hours offset from UTC, with no leading zeros.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#zSpecifier&quot;&gt;The &quot;z&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 PM -07:00 -&amp;gt; -7&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;zz&quot;&lt;/td&gt;&lt;td&gt;Hours offset from UTC, with a leading zero for a single-digit value.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#zzSpecifier&quot;&gt;The &quot;zz&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 PM -07:00 -&amp;gt; -07&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;zzz&quot;&lt;/td&gt;&lt;td&gt;Hours and minutes offset from UTC.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#zzzSpecifier&quot;&gt;The &quot;zzz&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 PM -07:00 -&amp;gt; -07:00&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;:&quot;&lt;/td&gt;&lt;td&gt;The time separator.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#timeSeparator&quot;&gt;The &quot;:&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 PM -&amp;gt; : (en-US)&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; . (it-IT)&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; : (ja-JP)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;/&quot;&lt;/td&gt;&lt;td&gt;The date separator.&lt;br /&gt;
More Information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#dateSeparator&quot;&gt;The &quot;/&quot; Custom Format Specifier&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 PM -&amp;gt; / (en-US)&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; - (ar-DZ)&lt;br /&gt;
6/15/2009 1:45:30 PM -&amp;gt; . (tr-TR)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&quot;&lt;span class=&quot;parameter&quot;&gt;string&lt;/span&gt;&quot;&lt;br /&gt;
&#39;&lt;span class=&quot;parameter&quot;&gt;string&lt;/span&gt;&#39;&lt;/td&gt;&lt;td&gt;Literal string delimiter. &lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 PM (&quot;arr:&quot; h:m t) -&amp;gt; arr: 1:45 P&lt;br /&gt;
6/15/2009 1:45:30 PM (&#39;arr:&#39; h:m t) -&amp;gt; arr: 1:45 P&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;%&lt;/td&gt;&lt;td&gt;Defines the following character as a custom format specifier.&lt;br /&gt;
More information:&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers&quot;&gt; Using Single Custom Format Specifiers&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 PM (%h) -&amp;gt; 1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\&lt;/td&gt;&lt;td&gt;The escape character.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 PM (h \h) -&amp;gt; 1 h&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Any other character&lt;/td&gt;&lt;td&gt;The character is copied to the result string unchanged.&lt;br /&gt;
More information: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#escape&quot;&gt;Using the Escape Character&lt;/a&gt;.&lt;/td&gt;&lt;td&gt;6/15/2009 1:45:30 AM (arr hh:mm t) -&amp;gt; arr 01:45 A&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
The following sections provide additional information about each custom date and time format specifier. Unless otherwise noted, each specifier produces an identical string representation regardless of whether it is used with a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.aspx&quot;&gt;DateTime&lt;/a&gt; value or a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetimeoffset.aspx&quot;&gt;DateTimeOffset&lt;/a&gt; value. &lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;dSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;d&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle1&quot;&gt;&lt;/a&gt;The &quot;d&quot; custom format specifier represents the day of the month as a number from 1 through 31. A single-digit day is formatted without a leading zero. &lt;br /&gt;
If the &quot;d&quot; format specifier is used without other custom format specifiers, it is interpreted as the &quot;d&quot; standard date and time format specifier. For more information about using a single format specifier, see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers&quot;&gt;Using Single Custom Format Specifiers&lt;/a&gt; later in this topic.&lt;br /&gt;
The following example includes the &quot;d&quot; custom format specifier in several format strings. &lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-3&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-3&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_5c2c5664-fd6c-42d3-9531-6ecd079a67f6&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_5c2c5664-fd6c-42d3-9531-6ecd079a67f6&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 8, 29, 19, 27, 15); 

Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;d, M&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture)); 
&lt;span style=&quot;color: green;&quot;&gt;// Displays 29, 8&lt;/span&gt;

Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;d MMMM&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;en-US&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 29 August&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;d MMMM&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;es-MX&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 29 agosto                                                &lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;ddSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;dd&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle2&quot;&gt;&lt;/a&gt;The &quot;dd&quot; custom format string represents the day of the month as a number from 01 through 31. A single-digit day is formatted with a leading zero. &lt;br /&gt;
The following example includes the &quot;dd&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-4&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-4&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_8c54b092-2bbf-4aff-8395-26d1b96766a2&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_8c54b092-2bbf-4aff-8395-26d1b96766a2&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 2, 6, 30, 15);

Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;dd, MM&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture)); 
&lt;span style=&quot;color: green;&quot;&gt;// 02, 01&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;dddSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;ddd&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle3&quot;&gt;&lt;/a&gt;The &quot;ddd&quot; custom format specifier represents the abbreviated name of the day of the week. The localized abbreviated name of the day of the week is retrieved from the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.abbreviateddaynames.aspx&quot;&gt;DateTimeFormatInfoAbbreviatedDayNames&lt;/a&gt; property of the current or specified culture. &lt;br /&gt;
The following example includes the &quot;ddd&quot; custom format specifier in a custom format string. &lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-5&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-5&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_5d1014ac-7461-4c58-9add-643b7c025b51&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_5d1014ac-7461-4c58-9add-643b7c025b51&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 8, 29, 19, 27, 15);

Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;ddd d MMM&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;en-US&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays Fri 29 Aug&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;ddd d MMM&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;fr-FR&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays ven. 29 août                                                &lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;ddddSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;dddd&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle4&quot;&gt;&lt;/a&gt;The &quot;dddd&quot; custom format specifier (plus any number of additional &quot;d&quot; specifiers) represents the full name of the day of the week. The localized name of the day of the week is retrieved from the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.daynames.aspx&quot;&gt;DateTimeFormatInfoDayNames&lt;/a&gt; property of the current or specified culture. &lt;br /&gt;
The following example includes the &quot;dddd&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-6&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-6&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_192eb9ea-7cd1-4ed6-9f05-fd1e3c0e7fe8&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_192eb9ea-7cd1-4ed6-9f05-fd1e3c0e7fe8&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 8, 29, 19, 27, 15);

Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;dddd dd MMMM&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;en-US&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays Friday 29 August&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;dddd dd MMMM&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;it-IT&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays venerdì 29 agosto                                &lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;fSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;f&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle5&quot;&gt;&lt;/a&gt;The &quot;f&quot; custom format specifier represents the most significant digit of the seconds fraction; that is, it represents the tenths of a second in a date and time value.&lt;br /&gt;
If the &quot;f&quot; format specifier is used without other format specifiers, it is interpreted as the &quot;f&quot; standard date and time format specifier. For more information about using a single format specifier, see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers&quot;&gt;Using Single Custom Format Specifiers&lt;/a&gt; later in this topic.&lt;br /&gt;
When you use &quot;f&quot; format specifiers as part of a format string supplied to the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.parseexact.aspx&quot;&gt;ParseExact&lt;/a&gt;, &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.tryparseexact.aspx&quot;&gt;TryParseExact&lt;/a&gt;, &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetimeoffset.parseexact.aspx&quot;&gt;ParseExact&lt;/a&gt;, or &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetimeoffset.tryparseexact.aspx&quot;&gt;TryParseExact&lt;/a&gt; method, the number of &quot;f&quot; format specifiers indicates the number of most significant digits of the seconds fraction that must be present to successfully parse the string.&lt;br /&gt;
The following example includes the &quot;f&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-7&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-7&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_3cbacdc6-c92e-4479-8ba7-41d8fbf70524&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_3cbacdc6-c92e-4479-8ba7-41d8fbf70524&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 8, 29, 19, 27, 15, 18);
CultureInfo ci = CultureInfo.InvariantCulture;

Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.f&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.0&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.F&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.ff&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.01&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.FF&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.01&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.fff&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.018&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.FFF&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.018&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;ffSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;ff&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle6&quot;&gt;&lt;/a&gt;The &quot;ff&quot; custom format specifier represents the two most significant digits of the seconds fraction; that is, it represents the hundredths of a second in a date and time value. &lt;br /&gt;
following example includes the &quot;ff&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-8&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-8&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_7bdb49cc-e82c-46c0-ae2b-a7c2bf632a18&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_7bdb49cc-e82c-46c0-ae2b-a7c2bf632a18&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 8, 29, 19, 27, 15, 18);
CultureInfo ci = CultureInfo.InvariantCulture;

Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.f&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.0&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.F&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.ff&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.01&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.FF&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.01&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.fff&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.018&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.FFF&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.018&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;fffSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;fff&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle7&quot;&gt;&lt;/a&gt;The &quot;fff&quot; custom format specifier represents the three most significant digits of the seconds fraction; that is, it represents the milliseconds in a date and time value. &lt;br /&gt;
The following example includes the &quot;fff&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-9&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-9&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_da600dac-b363-489e-a5cf-009af8be65b0&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_da600dac-b363-489e-a5cf-009af8be65b0&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 8, 29, 19, 27, 15, 18);
CultureInfo ci = CultureInfo.InvariantCulture;

Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.f&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.0&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.F&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.ff&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.01&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.FF&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.01&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.fff&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.018&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.FFF&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.018&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;ffffSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;ffff&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle8&quot;&gt;&lt;/a&gt;The &quot;ffff&quot; custom format specifier represents the four most significant digits of the seconds fraction; that is, it represents the ten thousandths of a second in a date and time value.&lt;br /&gt;
Although it is possible to display the ten thousandths of a second component of a time value, that value may not be meaningful. The precision of date and time values depends on the resolution of the system clock. On the Windows NT version 3.5 (and later) and Windows Vista operating systems, the clock&#39;s resolution is approximately 10-15 milliseconds.&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;fffffSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;fffff&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle9&quot;&gt;&lt;/a&gt;The &quot;fffff&quot; custom format specifier represents the five most significant digits of the seconds fraction; that is, it represents the hundred thousandths of a second in a date and time value.&lt;br /&gt;
Although it is possible to display the hundred thousandths of a second component of a time value, that value may not be meaningful. The precision of date and time values depends on the resolution of the system clock. On the Windows NT 3.5 (and later) and Windows Vista operating systems, the clock&#39;s resolution is approximately 10-15 milliseconds.&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;ffffffSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;ffffff&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle10&quot;&gt;&lt;/a&gt;The &quot;ffffff&quot; custom format specifier represents the six most significant digits of the seconds fraction; that is, it represents the millionths of a second in a date and time value.&lt;br /&gt;
Although it is possible to display the millionths of a second component of a time value, that value may not be meaningful. The precision of date and time values depends on the resolution of the system clock. On the Windows NT 3.5 (and later) and Windows Vista operating systems, the clock&#39;s resolution is approximately 10-15 milliseconds.&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;fffffffSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;fffffff&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle11&quot;&gt;&lt;/a&gt;The &quot;fffffff&quot; custom format specifier represents the seven most significant digits of the seconds fraction; that is, it represents the ten millionths of a second in a date and time value.&lt;br /&gt;
Although it is possible to display the ten millionths of a second component of a time value, that value may not be meaningful. The precision of date and time values depends on the resolution of the system clock. On the Windows NT 3.5 (and later) and Windows Vista operating systems, the clock&#39;s resolution is approximately 10-15 milliseconds.&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;F_Specifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;F&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle12&quot;&gt;&lt;/a&gt;The &quot;F&quot; custom format specifier represents the most significant digit of the seconds fraction; that is, it represents the tenths of a second in a date and time value. Nothing is displayed if the digit is zero. &lt;br /&gt;
If the &quot;F&quot; format specifier is used without other format specifiers, it is interpreted as the &quot;F&quot; standard date and time format specifier. For more information about using a single format specifier, see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers&quot;&gt;Using Single Custom Format Specifiers&lt;/a&gt; later in this topic.&lt;br /&gt;
The number of &quot;F&quot; format specifiers used with the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.parseexact.aspx&quot;&gt;ParseExact&lt;/a&gt;, &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.tryparseexact.aspx&quot;&gt;TryParseExact&lt;/a&gt;, &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetimeoffset.parseexact.aspx&quot;&gt;ParseExact&lt;/a&gt;, or &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetimeoffset.tryparseexact.aspx&quot;&gt;TryParseExact&lt;/a&gt; method indicates the maximum number of most significant digits of the seconds fraction that can be present to successfully parse the string.&lt;br /&gt;
The following example includes the &quot;F&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-10&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-10&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_ae6eccc6-1414-468f-aead-dd3a5c80d11d&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_ae6eccc6-1414-468f-aead-dd3a5c80d11d&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 8, 29, 19, 27, 15, 18);
CultureInfo ci = CultureInfo.InvariantCulture;

Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.f&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.0&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.F&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.ff&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.01&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.FF&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.01&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.fff&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.018&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.FFF&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.018&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;FF_Specifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;FF&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle13&quot;&gt;&lt;/a&gt;The &quot;FF&quot; custom format specifier represents the two most significant digits of the seconds fraction; that is, it represents the hundredths of a second in a date and time value. However, trailing zeros or two zero digits are not displayed. &lt;br /&gt;
The following example includes the &quot;FF&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-11&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-11&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_4b50bea8-6933-4b5b-a4d5-eff22bb1aa7d&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_4b50bea8-6933-4b5b-a4d5-eff22bb1aa7d&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 8, 29, 19, 27, 15, 18);
CultureInfo ci = CultureInfo.InvariantCulture;

Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.f&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.0&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.F&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.ff&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.01&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.FF&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.01&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.fff&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.018&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.FFF&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.018&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;FFF_Specifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;FFF&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle14&quot;&gt;&lt;/a&gt;The &quot;FFF&quot; custom format specifier represents the three most significant digits of the seconds fraction; that is, it represents the milliseconds in a date and time value. However, trailing zeros or three zero digits are not displayed. &lt;br /&gt;
The following example includes the &quot;FFF&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-12&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-12&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_43a50889-64de-4754-bf4a-1c1fd8508fb5&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_43a50889-64de-4754-bf4a-1c1fd8508fb5&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 8, 29, 19, 27, 15, 18);
CultureInfo ci = CultureInfo.InvariantCulture;

Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.f&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.0&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.F&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.ff&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.01&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.FF&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.01&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.fff&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.018&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.FFF&quot;&lt;/span&gt;, ci));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 07:27:15.018&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;FFFF_Specifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;FFFF&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle15&quot;&gt;&lt;/a&gt;The &quot;FFFF&quot; custom format specifier represents the four most significant digits of the seconds fraction; that is, it represents the ten thousandths of a second in a date and time value. However, trailing zeros or four zero digits are not displayed.&lt;br /&gt;
Although it is possible to display the ten thousandths of a second component of a time value, that value may not be meaningful. The precision of date and time values depends on the resolution of the system clock. On the Windows NT 3.5 (and later) and Windows Vista operating systems, the clock&#39;s resolution is approximately 10-15 milliseconds.&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;FFFFF_Specifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;FFFFF&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle16&quot;&gt;&lt;/a&gt;The &quot;FFFFF&quot; custom format specifier represents the five most significant digits of the seconds fraction; that is, it represents the hundred thousandths of a second in a date and time value. However, trailing zeros or five zero digits are not displayed.&lt;br /&gt;
Although it is possible to display the hundred thousandths of a second component of a time value, that value may not be meaningful. The precision of date and time values depends on the resolution of the system clock. On the Windows NT 3.5 (and later) and Windows Vista operating systems, the clock&#39;s resolution is approximately 10-15 milliseconds.&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;FFFFFF_Specifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;FFFFFF&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle17&quot;&gt;&lt;/a&gt;The &quot;FFFFFF&quot; custom format specifier represents the six most significant digits of the seconds fraction; that is, it represents the millionths of a second in a date and time value. However, trailing zeros or six zero digits are not displayed.&lt;br /&gt;
Although it is possible to display the millionths of a second component of a time value, that value may not be meaningful. The precision of date and time values depends on the resolution of the system clock. On tfhe Windows NT 3.5 (and later) and Windows Vista operating systems, the clock&#39;s resolution is approximately 10-15 milliseconds.&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;FFFFFFF_Specifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;FFFFFFF&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle18&quot;&gt;&lt;/a&gt;The &quot;FFFFFFF&quot; custom format specifier represents the seven most significant digits of the seconds fraction; that is, it represents the ten millionths of a second in a date and time value. However, trailing zeros or seven zero digits are not displayed.&lt;br /&gt;
Although it is possible to display the ten millionths of a second component of a time value, that value may not be meaningful. The precision of date and time values depends on the resolution of the system clock. On the Windows NT 3.5 (and later) and Windows Vista operating systems, the clock&#39;s resolution is approximately 10-15 milliseconds.&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;gSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;g&quot; or &quot;gg&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle19&quot;&gt;&lt;/a&gt;The &quot;g&quot; or &quot;gg&quot; custom format specifiers (plus any number of additional &quot;g&quot; specifiers) represents the period or era, such as A.D. The formatting operation ignores this specifier if the date to be formatted does not have an associated period or era string. &lt;br /&gt;
If the &quot;g&quot; format specifier is used without other custom format specifiers, it is interpreted as the &quot;g&quot; standard date and time format specifier. For more information about using a single format specifier, see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers&quot;&gt;Using Single Custom Format Specifiers&lt;/a&gt; later in this topic.&lt;br /&gt;
The following example includes the &quot;g&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-13&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-13&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_9f799641-9d2c-491a-8702-5a5cb0d95a08&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_9f799641-9d2c-491a-8702-5a5cb0d95a08&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(70, 08, 04);

Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;MM/dd/yyyy g&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 08/04/0070 A.D.                        &lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;MM/dd/yyyy g&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;fr-FR&quot;&lt;/span&gt;)));                         
&lt;span style=&quot;color: green;&quot;&gt;// Displays 08/04/0070 ap. J.-C.&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;hSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;h&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle20&quot;&gt;&lt;/a&gt;The &quot;h&quot; custom format specifier represents the hour as a number from 1 through 12; that is, the hour is represented by a 12-hour clock that counts the whole hours since midnight or noon. A particular hour after midnight is indistinguishable from the same hour after noon. The hour is not rounded, and a single-digit hour is formatted without a leading zero. For example, given a time of 5:43 in the morning or afternoon, this custom format specifier displays &quot;5&quot;. &lt;br /&gt;
If the &quot;h&quot; format specifier is used without other custom format specifiers, it is interpreted as a standard date and time format specifier and throws a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.formatexception.aspx&quot;&gt;FormatException&lt;/a&gt;. For more information about using a single format specifier, see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers&quot;&gt;Using Single Custom Format Specifiers&lt;/a&gt; later in this topic.&lt;br /&gt;
The following example includes the &quot;h&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-14&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-14&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_1a58c363-9fdd-4a2a-a4e2-7090a79d42e0&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_1a58c363-9fdd-4a2a-a4e2-7090a79d42e0&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1; 
date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 18, 9, 1);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;h:m:s.F t&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 6:9:1 P&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;h:m:s.F t&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;el-GR&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 6:9:1 µ                        &lt;/span&gt;
date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 18, 9, 1, 500);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;h:m:s.F t&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 6:9:1.5 P&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;h:m:s.F t&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;el-GR&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 6:9:1.5 µ&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;hhSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;hh&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle21&quot;&gt;&lt;/a&gt;The &quot;hh&quot; custom format specifier (plus any number of additional &quot;h&quot; specifiers) represents the hour as a number from 01 through 12; that is, the hour is represented by a 12-hour clock that counts the whole hours since midnight or noon. A particular hour after midnight is indistinguishable from the same hour after noon. The hour is not rounded, and a single-digit hour is formatted with a leading zero. For example, given a time of 5:43 in the morning or afternoon, this format specifier displays &quot;05&quot;.&lt;br /&gt;
The following example includes the &quot;hh&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-15&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-15&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_3eeee1ab-56af-4372-873a-4faaf8312636&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_3eeee1ab-56af-4372-873a-4faaf8312636&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1; 
date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 18, 9, 1);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss tt&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 06:09:01 PM                        &lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss tt&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hu-HU&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 06:09:01 du.&lt;/span&gt;
date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 18, 9, 1, 500);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.ff tt&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 06:09:01.50 PM                        &lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.ff tt&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hu-HU&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 06:09:01.50 du.&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;H_Specifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;H&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle22&quot;&gt;&lt;/a&gt;The &quot;H&quot; custom format specifier represents the hour as a number from 0 through 23; that is, the hour is represented by a zero-based 24-hour clock that counts the hours since midnight. A single-digit hour is formatted without a leading zero. &lt;br /&gt;
If the &quot;H&quot; format specifier is used without other custom format specifiers, it is interpreted as a standard date and time format specifier and throws a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.formatexception.aspx&quot;&gt;FormatException&lt;/a&gt;. For more information about using a single format specifier, see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers&quot;&gt;Using Single Custom Format Specifiers&lt;/a&gt; later in this topic.&lt;br /&gt;
The following example includes the &quot;H&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-16&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-16&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_b707a880-d54d-44e0-976b-36d37c9d1821&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_b707a880-d54d-44e0-976b-36d37c9d1821&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 6, 9, 1);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;H:mm:ss&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 6:09:01              &lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;HH_Specifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;HH&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle23&quot;&gt;&lt;/a&gt;The &quot;HH&quot; custom format specifier (plus any number of additional &quot;H&quot; specifiers) represents the hour as a number from 00 through 23; that is, the hour is represented by a zero-based 24-hour clock that counts the hours since midnight. A single-digit hour is formatted with a leading zero. &lt;br /&gt;
The following example includes the &quot;HH&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-17&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-17&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_85c288dc-4872-426b-93ca-2fc2d3970028&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_85c288dc-4872-426b-93ca-2fc2d3970028&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 6, 9, 1);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;HH:mm:ss&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 06:09:01                        &lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;KSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;K&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle24&quot;&gt;&lt;/a&gt;The &quot;K&quot; custom format specifier represents the time zone information of a date and time value. When this format specifier is used with &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.aspx&quot;&gt;DateTime&lt;/a&gt; values, the result string is defined by the value of the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.kind.aspx&quot;&gt;DateTimeKind&lt;/a&gt; property: &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;For the local time zone (a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.kind.aspx&quot;&gt;DateTimeKind&lt;/a&gt; property value of &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/shx7s921.aspx&quot;&gt;DateTimeKindLocal&lt;/a&gt;), this specifier is equivalent to the &quot;zzz&quot; specifier and produces a result string containing the local offset from Coordinated Universal Time (UTC); for example, &quot;-07:00&quot;. &lt;/li&gt;
&lt;li&gt;For a UTC time (a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.kind.aspx&quot;&gt;DateTimeKind&lt;/a&gt; property value of &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/shx7s921.aspx&quot;&gt;DateTimeKindUtc&lt;/a&gt;), the result string includes a &quot;Z&quot; character to represent a UTC date. &lt;/li&gt;
&lt;li&gt;For a time from an unspecified time zone (a time whose &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.kind.aspx&quot;&gt;DateTimeKind&lt;/a&gt; property equals &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/shx7s921.aspx&quot;&gt;DateTimeKindUnspecified&lt;/a&gt;), the result is equivalent to &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.string.empty.aspx&quot;&gt;StringEmpty&lt;/a&gt;. &lt;/li&gt;
&lt;/ul&gt;
For &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetimeoffset.aspx&quot;&gt;DateTimeOffset&lt;/a&gt; values, the &quot;K&quot; format specifier is equivalent to the &quot;zz&quot; format specifier, and produces a result string containing the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetimeoffset.aspx&quot;&gt;DateTimeOffset&lt;/a&gt; value&#39;s offset from UTC. &lt;br /&gt;
If the &quot;K&quot; format specifier is used without other custom format specifiers, it is interpreted as a standard date and time format specifier and throws a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.formatexception.aspx&quot;&gt;FormatException&lt;/a&gt;. For more information about using a single format specifier, see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers&quot;&gt;Using Single Custom Format Specifiers&lt;/a&gt; later in this topic.&lt;br /&gt;
The following example displays the string that results from using the &quot;K&quot; custom format specifier with various &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.aspx&quot;&gt;DateTime&lt;/a&gt; and &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetimeoffset.aspx&quot;&gt;DateTimeOffset&lt;/a&gt; values on a system in the U.S. Pacific Time zone.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-18&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-18&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_60fb3052-2ee1-4479-b2ad-ad4e0771f2fa&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_60fb3052-2ee1-4479-b2ad-ad4e0771f2fa&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;Console.WriteLine(DateTime.Now.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%K&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays -07:00&lt;/span&gt;
Console.WriteLine(DateTime.UtcNow.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%K&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays Z      &lt;/span&gt;
Console.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;&#39;{0}&#39;&quot;&lt;/span&gt;, 
                  DateTime.SpecifyKind(DateTime.Now, 
                       DateTimeKind.Unspecified).ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%K&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays &#39;&#39;      &lt;/span&gt;
Console.WriteLine(DateTimeOffset.Now.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%K&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays -07:00&lt;/span&gt;
Console.WriteLine(DateTimeOffset.UtcNow.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%K&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays +00:00&lt;/span&gt;
Console.WriteLine(&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTimeOffset(2008, 5, 1, 6, 30, 0, 
                      &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; TimeSpan(5, 0, 0)).ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%K&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays +05:00                        &lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;mSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;m&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle25&quot;&gt;&lt;/a&gt;The &quot;m&quot; custom format specifier represents the minute as a number from 0 through 59. The minute represents whole minutes that have passed since the last hour. A single-digit minute is formatted without a leading zero. &lt;br /&gt;
If the &quot;m&quot; format specifier is used without other custom format specifiers, it is interpreted as the &quot;m&quot; standard date and time format specifier. For more information about using a single format specifier, see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers&quot;&gt;Using Single Custom Format Specifiers&lt;/a&gt; later in this topic. &lt;br /&gt;
The following example includes the &quot;m&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-19&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-19&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_52f4b23f-63a0-49ac-80de-b920b8b64c5b&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_52f4b23f-63a0-49ac-80de-b920b8b64c5b&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1; 
date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 18, 9, 1);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;h:m:s.F t&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 6:9:1 P&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;h:m:s.F t&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;el-GR&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 6:9:1 µ                        &lt;/span&gt;
date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 18, 9, 1, 500);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;h:m:s.F t&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 6:9:1.5 P&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;h:m:s.F t&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;el-GR&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 6:9:1.5 µ&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;mmSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;mm&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle26&quot;&gt;&lt;/a&gt;The &quot;mm&quot; custom format specifier (plus any number of additional &quot;m&quot; specifiers) represents the minute as a number from 00 through 59. The minute represents whole minutes that have passed since the last hour. A single-digit minute is formatted with a leading zero. &lt;br /&gt;
The following example includes the &quot;mm&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-20&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-20&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_144a63bc-c217-49e5-b82b-374af0322019&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_144a63bc-c217-49e5-b82b-374af0322019&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1; 
date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 18, 9, 1);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss tt&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 06:09:01 PM                        &lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss tt&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hu-HU&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 06:09:01 du.&lt;/span&gt;
date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 18, 9, 1, 500);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.ff tt&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 06:09:01.50 PM                        &lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.ff tt&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hu-HU&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 06:09:01.50 du.&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;M_Specifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;M&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle27&quot;&gt;&lt;/a&gt;The &quot;M&quot; custom format specifier represents the month as a number from 1 through 12 (or from 1 through 13 for calendars that have 13 months). A single-digit month is formatted without a leading zero. &lt;br /&gt;
If the &quot;M&quot; format specifier is used without other custom format specifiers, it is interpreted as the &quot;M&quot; standard date and time format specifier. For more information about using a single format specifier, see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers&quot;&gt;Using Single Custom Format Specifiers&lt;/a&gt; later in this topic. &lt;br /&gt;
The following example includes the &quot;M&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-21&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-21&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_eb4cf1fb-2deb-468d-9e59-1815119675f3&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_eb4cf1fb-2deb-468d-9e59-1815119675f3&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 8, 18);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;(M) MMM, MMMM&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;en-US&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays (8) Aug, August&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;(M) MMM, MMMM&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;nl-NL&quot;&lt;/span&gt;)));                       
&lt;span style=&quot;color: green;&quot;&gt;// Displays (8) aug, augustus&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;(M) MMM, MMMM&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;lv-LV&quot;&lt;/span&gt;)));                        
&lt;span style=&quot;color: green;&quot;&gt;// Displays (8) Aug, augusts                       &lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;MM_Specifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;MM&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle28&quot;&gt;&lt;/a&gt;The &quot;MM&quot; custom format specifier represents the month as a number from 01 through 12 (or from 1 through 13 for calendars that have 13 months). A single-digit month is formatted with a leading zero. &lt;br /&gt;
The following example includes the &quot;MM&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-22&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-22&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_8934f3a2-f019-4264-92c2-d05b7c5ce44e&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_8934f3a2-f019-4264-92c2-d05b7c5ce44e&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 2, 6, 30, 15);

Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;dd, MM&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture)); 
&lt;span style=&quot;color: green;&quot;&gt;// 02, 01&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;MMM_Specifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;MMM&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle29&quot;&gt;&lt;/a&gt;The &quot;MMM&quot; custom format specifier represents the abbreviated name of the month. The localized abbreviated name of the month is retrieved from the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.abbreviatedmonthnames.aspx&quot;&gt;DateTimeFormatInfoAbbreviatedMonthNames&lt;/a&gt; property of the current or specified culture.&lt;br /&gt;
The following example includes the &quot;MMM&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-23&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-23&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_2865af38-8427-41fc-b84f-775e3926b05f&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_2865af38-8427-41fc-b84f-775e3926b05f&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 8, 29, 19, 27, 15);

Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;ddd d MMM&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;en-US&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays Fri 29 Aug&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;ddd d MMM&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;fr-FR&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays ven. 29 août                                                &lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;MMMM_Specifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;MMMM&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle30&quot;&gt;&lt;/a&gt;The &quot;MMMM&quot; custom format specifier represents the full name of the month. The localized name of the month is retrieved from the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.monthnames.aspx&quot;&gt;DateTimeFormatInfoMonthNames&lt;/a&gt; property of the current or specified culture. &lt;br /&gt;
The following example includes the &quot;MMMM&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-24&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-24&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_66051660-6562-4725-b589-fdd2cba28a79&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_66051660-6562-4725-b589-fdd2cba28a79&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 8, 29, 19, 27, 15);

Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;dddd dd MMMM&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;en-US&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays Friday 29 August&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;dddd dd MMMM&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;it-IT&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays venerdì 29 agosto                                &lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;s&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle31&quot;&gt;&lt;/a&gt;The &quot;s&quot; custom format specifier represents the seconds as a number from 0 through 59. The result represents whole seconds that have passed since the last minute. A single-digit second is formatted without a leading zero. &lt;br /&gt;
If the &quot;s&quot; format specifier is used without other custom format specifiers, it is interpreted as the &quot;s&quot; standard date and time format specifier. For more information about using a single format specifier, see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers&quot;&gt;Using Single Custom Format Specifiers&lt;/a&gt; later in this topic. &lt;br /&gt;
The following example includes the &quot;s&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-25&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-25&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_4269e8b0-c9e2-449c-a5fd-9b42f345728d&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_4269e8b0-c9e2-449c-a5fd-9b42f345728d&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1; 
date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 18, 9, 1);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;h:m:s.F t&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 6:9:1 P&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;h:m:s.F t&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;el-GR&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 6:9:1 µ                        &lt;/span&gt;
date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 18, 9, 1, 500);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;h:m:s.F t&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 6:9:1.5 P&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;h:m:s.F t&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;el-GR&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 6:9:1.5 µ&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;ssSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;ss&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle32&quot;&gt;&lt;/a&gt;The &quot;ss&quot; custom format specifier (plus any number of additional &quot;s&quot; specifiers) represents the seconds as a number from 00 through 59. The result represents whole seconds that have passed since the last minute. A single-digit second is formatted with a leading zero. &lt;br /&gt;
The following example includes the &quot;ss&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-26&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-26&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_fefc638e-85c3-43e7-911a-130d2c5fdaf4&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_fefc638e-85c3-43e7-911a-130d2c5fdaf4&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1; 
date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 18, 9, 1);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss tt&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 06:09:01 PM                        &lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss tt&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hu-HU&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 06:09:01 du.&lt;/span&gt;
date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 18, 9, 1, 500);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.ff tt&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 06:09:01.50 PM                        &lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.ff tt&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hu-HU&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 06:09:01.50 du.&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;tSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;t&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle33&quot;&gt;&lt;/a&gt;The &quot;t&quot; custom format specifier represents the first character of the AM/PM designator. The appropriate localized designator is retrieved from the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.amdesignator.aspx&quot;&gt;DateTimeFormatInfoAMDesignator&lt;/a&gt; or &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.pmdesignator.aspx&quot;&gt;DateTimeFormatInfoPMDesignator&lt;/a&gt; property of the current or specific culture. The AM designator is used for all times from 0:00:00 (midnight) to 11:59:59.999. The PM designator is used for all times from 12:00:00 (noon) to 23:59:59.999. &lt;br /&gt;
If the &quot;t&quot; format specifier is used without other custom format specifiers, it is interpreted as the &quot;t&quot; standard date and time format specifier. For more information about using a single format specifier, see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers&quot;&gt;Using Single Custom Format Specifiers&lt;/a&gt; later in this topic.&lt;br /&gt;
The following example includes the &quot;t&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-27&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-27&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_1573819a-e102-4498-ac88-c8f0b39d55c3&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_1573819a-e102-4498-ac88-c8f0b39d55c3&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1; 
date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 18, 9, 1);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;h:m:s.F t&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 6:9:1 P&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;h:m:s.F t&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;el-GR&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 6:9:1 µ                        &lt;/span&gt;
date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 18, 9, 1, 500);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;h:m:s.F t&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 6:9:1.5 P&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;h:m:s.F t&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;el-GR&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 6:9:1.5 µ&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;ttSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;tt&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle34&quot;&gt;&lt;/a&gt;The &quot;tt&quot; custom format specifier (plus any number of additional &quot;t&quot; specifiers) represents the entire AM/PM designator. The appropriate localized designator is retrieved from the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.amdesignator.aspx&quot;&gt;DateTimeFormatInfoAMDesignator&lt;/a&gt; or &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.pmdesignator.aspx&quot;&gt;DateTimeFormatInfoPMDesignator&lt;/a&gt; property of the current or specific culture. The AM designator is used for all times from 0:00:00 (midnight) to 11:59:59.999. The PM designator is used for all times from 12:00:00 (noon) to 23:59:59.999.&lt;br /&gt;
Make sure to use the &quot;tt&quot; specifier for languages for which it is necessary to maintain the distinction between AM and PM. An example is Japanese, for which the AM and PM designators differ in the second character instead of the first character.&lt;br /&gt;
The following example includes the &quot;tt&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-28&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-28&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_a4ed6c47-98f0-411e-9d17-e3c61c5e772b&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_a4ed6c47-98f0-411e-9d17-e3c61c5e772b&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1; 
date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 18, 9, 1);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss tt&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 06:09:01 PM                        &lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss tt&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hu-HU&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 06:09:01 du.&lt;/span&gt;
date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2008, 1, 1, 18, 9, 1, 500);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.ff tt&quot;&lt;/span&gt;, 
                  CultureInfo.InvariantCulture));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 06:09:01.50 PM                        &lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hh:mm:ss.ff tt&quot;&lt;/span&gt;, 
                  CultureInfo.CreateSpecificCulture(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;hu-HU&quot;&lt;/span&gt;)));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 06:09:01.50 du.&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;ySpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;y&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle35&quot;&gt;&lt;/a&gt;The &quot;y&quot; custom format specifier represents the year as a one-digit or two-digit number. If the year has more than two digits, only the two low-order digits appear in the result. If the first digit of a two-digit year begins with a zero (for example, 2008), the number is formatted without a leading zero. &lt;br /&gt;
If the &quot;y&quot; format specifier is used without other custom format specifiers, it is interpreted as the &quot;y&quot; standard date and time format specifier. For more information about using a single format specifier, see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers&quot;&gt;Using Single Custom Format Specifiers&lt;/a&gt; later in this topic.&lt;br /&gt;
The following example includes the &quot;y&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-29&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-29&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_cf563781-a9f0-47bb-a140-5df60bc746d5&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_cf563781-a9f0-47bb-a140-5df60bc746d5&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(1, 12, 1);
DateTime date2 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2010, 1, 1);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%y&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 1&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 01&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 001&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 0001&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 00001&lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%y&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 10&lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 10&lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 2010      &lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 2010      &lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 02010      &lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;yySpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;yy&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle36&quot;&gt;&lt;/a&gt;The &quot;yy&quot; custom format specifier represents the year as a two-digit number. If the year has more than two digits, only the two low-order digits appear in the result. If the two-digit year has fewer than two significant digits, the number is padded with leading zeros to produce two digits.&lt;br /&gt;
In a parsing operation, a two-digit year that is parsed using the &quot;yy&quot; custom format specifier is interpreted based on the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.calendar.twodigityearmax.aspx&quot;&gt;CalendarTwoDigitYearMax&lt;/a&gt; property of the format provider&#39;s current calendar. The following example parses the string representation of a date that has a two-digit year by using the default Gregorian calendar of the en-US culture, which, in this case, is the current culture. It then changes the current culture&#39;s &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx&quot;&gt;CultureInfo&lt;/a&gt; object to use a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.gregoriancalendar.aspx&quot;&gt;GregorianCalendar&lt;/a&gt; object whose &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.gregoriancalendar.twodigityearmax.aspx&quot;&gt;TwoDigitYearMax&lt;/a&gt; property has been modified.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-30&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-30&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_724c10c4-7d72-4d09-a8f5-b82c40b2783e&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_724c10c4-7d72-4d09-a8f5-b82c40b2783e&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt; System;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt; System.Globalization;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt; System.Threading;

&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; Example
{
   &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; Main()
   {
      &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; fmt = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;dd-MMM-yy&quot;&lt;/span&gt;;
      &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; value = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;24-Jan-49&quot;&lt;/span&gt;;

      Calendar cal = (Calendar) CultureInfo.CurrentCulture.Calendar.Clone();
      Console.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Two Digit Year Range: {0} - {1}&quot;&lt;/span&gt;, 
                        cal.TwoDigitYearMax - 99, cal.TwoDigitYearMax);

      Console.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;{0:d}&quot;&lt;/span&gt;, DateTime.ParseExact(value, fmt, &lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;));
      Console.WriteLine();

      cal.TwoDigitYearMax = 2099;
      CultureInfo culture = (CultureInfo) CultureInfo.CurrentCulture.Clone();
      culture.DateTimeFormat.Calendar = cal;
      Thread.CurrentThread.CurrentCulture = culture;

      Console.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Two Digit Year Range: {0} - {1}&quot;&lt;/span&gt;, 
                        cal.TwoDigitYearMax - 99, cal.TwoDigitYearMax);
      Console.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;{0:d}&quot;&lt;/span&gt;, DateTime.ParseExact(value, fmt, &lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;));
   }
}
&lt;span style=&quot;color: green;&quot;&gt;// The example displays the following output: &lt;/span&gt;
&lt;span style=&quot;color: green;&quot;&gt;//       Two Digit Year Range: 1930 - 2029 &lt;/span&gt;
&lt;span style=&quot;color: green;&quot;&gt;//       1/24/1949 &lt;/span&gt;
&lt;span style=&quot;color: green;&quot;&gt;//        &lt;/span&gt;
&lt;span style=&quot;color: green;&quot;&gt;//       Two Digit Year Range: 2000 - 2099 &lt;/span&gt;
&lt;span style=&quot;color: green;&quot;&gt;//       1/24/2049&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
The following example includes the &quot;yy&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-31&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-31&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_231d172a-5b6e-4cd1-a78d-26de4eecc09a&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_231d172a-5b6e-4cd1-a78d-26de4eecc09a&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(1, 12, 1);
DateTime date2 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2010, 1, 1);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%y&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 1&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 01&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 001&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 0001&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 00001&lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%y&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 10&lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 10&lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 2010      &lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 2010      &lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 02010      &lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;yyySpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;yyy&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle37&quot;&gt;&lt;/a&gt;The &quot;yyy&quot; custom format specifier represents the year with a minimum of three digits. If the year has more than three significant digits, they are included in the result string. If the year has fewer than three digits, the number is padded with leading zeros to produce three digits.&lt;br /&gt;
&lt;div class=&quot;alert&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th align=&quot;left&quot;&gt;&lt;img alt=&quot;Note&quot; class=&quot;cl_IC101471&quot; id=&quot;alert_note&quot; src=&quot;http://i.msdn.microsoft.com/areas/global/content/clear.gif&quot; title=&quot;Note&quot; xmlns=&quot;&quot; /&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;For the Thai Buddhist calendar, which can have five-digit years, this format specifier displays all significant digits.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
The following example includes the &quot;yyy&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-32&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-32&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_86b896ac-9b3f-493f-ba43-f37deb8e48db&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_86b896ac-9b3f-493f-ba43-f37deb8e48db&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(1, 12, 1);
DateTime date2 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2010, 1, 1);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%y&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 1&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 01&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 001&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 0001&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 00001&lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%y&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 10&lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 10&lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 2010      &lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 2010      &lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 02010      &lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;yyyySpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;yyyy&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle38&quot;&gt;&lt;/a&gt;The &quot;yyyy&quot; custom format specifier represents the year with a minimum of four digits. If the year has more than four significant digits, they are included in the result string. If the year has fewer than four digits, the number is padded with leading zeros to produce four digits.&lt;br /&gt;
&lt;div class=&quot;alert&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th align=&quot;left&quot;&gt;&lt;img alt=&quot;Note&quot; class=&quot;cl_IC101471&quot; id=&quot;alert_note&quot; src=&quot;http://i.msdn.microsoft.com/areas/global/content/clear.gif&quot; title=&quot;Note&quot; xmlns=&quot;&quot; /&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;For the Thai Buddhist calendar, which can have five-digit years, this format specifier displays a minimum of four digits.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
The following example includes the &quot;yyyy&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-33&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-33&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_1add5aad-0c3e-4575-9bd9-d47a3d597616&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_1add5aad-0c3e-4575-9bd9-d47a3d597616&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(1, 12, 1);
DateTime date2 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2010, 1, 1);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%y&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 1&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 01&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 001&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 0001&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 00001&lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%y&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 10&lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 10&lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 2010      &lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 2010      &lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 02010      &lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;yyyyySpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;yyyyy&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle39&quot;&gt;&lt;/a&gt;The &quot;yyyyy&quot; custom format specifier (plus any number of additional &quot;y&quot; specifiers) represents the year with a minimum of five digits. If the year has more than five significant digits, they are included in the result string. If the year has fewer than five digits, the number is padded with leading zeros to produce five digits.&lt;br /&gt;
If there are additional &quot;y&quot; specifiers, the number is padded with as many leading zeros as necessary to produce the number of &quot;y&quot; specifiers. &lt;br /&gt;
The following example includes the &quot;yyyyy&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-34&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-34&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_2680039c-cff1-4c89-993e-10fa5e7ded6b&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_2680039c-cff1-4c89-993e-10fa5e7ded6b&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(1, 12, 1);
DateTime date2 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2010, 1, 1);
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%y&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 1&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 01&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 001&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 0001&lt;/span&gt;
Console.WriteLine(date1.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 00001&lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;%y&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 10&lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 10&lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 2010      &lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 2010      &lt;/span&gt;
Console.WriteLine(date2.ToString(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;yyyyy&quot;&lt;/span&gt;));
&lt;span style=&quot;color: green;&quot;&gt;// Displays 02010      &lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;zSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;z&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle40&quot;&gt;&lt;/a&gt;With &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.aspx&quot;&gt;DateTime&lt;/a&gt; values, the &quot;z&quot; custom format specifier represents the signed offset of the local operating system&#39;s time zone from Coordinated Universal Time (UTC), measured in hours. It does not reflect the value of an instance&#39;s &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.kind.aspx&quot;&gt;DateTimeKind&lt;/a&gt; property. For this reason, the &quot;z&quot; format specifier is not recommended for use with &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.aspx&quot;&gt;DateTime&lt;/a&gt; values.&lt;br /&gt;
With &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetimeoffset.aspx&quot;&gt;DateTimeOffset&lt;/a&gt; values, this format specifier represents the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetimeoffset.aspx&quot;&gt;DateTimeOffset&lt;/a&gt; value&#39;s offset from UTC in hours. &lt;br /&gt;
The offset is always displayed with a leading sign. A plus sign (+) indicates hours ahead of UTC, and a minus sign (-) indicates hours behind UTC. A single-digit offset is formatted without a leading zero. &lt;br /&gt;
If the &quot;z&quot; format specifier is used without other custom format specifiers, it is interpreted as a standard date and time format specifier and throws a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.formatexception.aspx&quot;&gt;FormatException&lt;/a&gt;. For more information about using a single format specifier, see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers&quot;&gt;Using Single Custom Format Specifiers&lt;/a&gt; later in this topic. &lt;br /&gt;
The following example includes the &quot;z&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-35&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-35&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_47c0a84e-eae4-47d9-88f5-bd568f22a408&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_47c0a84e-eae4-47d9-88f5-bd568f22a408&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = DateTime.UtcNow;
Console.WriteLine(String.Format(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;{0:%z}, {0:zz}, {0:zzz}&quot;&lt;/span&gt;, 
                  date1));
&lt;span style=&quot;color: green;&quot;&gt;// Displays -7, -07, -07:00                     &lt;/span&gt;

DateTimeOffset date2 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTimeOffset(2008, 8, 1, 0, 0, 0, 
                                          &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; TimeSpan(6, 0, 0));
Console.WriteLine(String.Format(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;{0:%z}, {0:zz}, {0:zzz}&quot;&lt;/span&gt;, 
                  date2));
&lt;span style=&quot;color: green;&quot;&gt;// Displays +6, +06, +06:00&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;zzSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;zz&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle41&quot;&gt;&lt;/a&gt;With &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.aspx&quot;&gt;DateTime&lt;/a&gt; values, the &quot;zz&quot; custom format specifier represents the signed offset of the local operating system&#39;s time zone from UTC, measured in hours. It does not reflect the value of an instance&#39;s &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.kind.aspx&quot;&gt;DateTimeKind&lt;/a&gt; property. For this reason, the &quot;zz&quot; format specifier is not recommended for use with &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.aspx&quot;&gt;DateTime&lt;/a&gt; values.&lt;br /&gt;
With &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetimeoffset.aspx&quot;&gt;DateTimeOffset&lt;/a&gt; values, this format specifier represents the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetimeoffset.aspx&quot;&gt;DateTimeOffset&lt;/a&gt; value&#39;s offset from UTC in hours.&lt;br /&gt;
The offset is always displayed with a leading sign. A plus sign (+) indicates hours ahead of UTC, and a minus sign (-) indicates hours behind UTC. A single-digit offset is formatted with a leading zero. &lt;br /&gt;
The following example includes the &quot;zz&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-36&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-36&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_c3c10ffb-aa96-4d00-b57a-d1ccd0fd3e5d&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_c3c10ffb-aa96-4d00-b57a-d1ccd0fd3e5d&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = DateTime.UtcNow;
Console.WriteLine(String.Format(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;{0:%z}, {0:zz}, {0:zzz}&quot;&lt;/span&gt;, 
                  date1));
&lt;span style=&quot;color: green;&quot;&gt;// Displays -7, -07, -07:00                     &lt;/span&gt;

DateTimeOffset date2 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTimeOffset(2008, 8, 1, 0, 0, 0, 
                                          &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; TimeSpan(6, 0, 0));
Console.WriteLine(String.Format(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;{0:%z}, {0:zz}, {0:zzz}&quot;&lt;/span&gt;, 
                  date2));
&lt;span style=&quot;color: green;&quot;&gt;// Displays +6, +06, +06:00&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;zzzSpecifier&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;zzz&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle42&quot;&gt;&lt;/a&gt;With &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.aspx&quot;&gt;DateTime&lt;/a&gt; values, the &quot;zzz&quot; custom format specifier represents the signed offset of the local operating system&#39;s time zone from UTC, measured in hours and minutes. It does not reflect the value of an instance&#39;s &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.kind.aspx&quot;&gt;DateTimeKind&lt;/a&gt; property. For this reason, the &quot;zzz&quot; format specifier is not recommended for use with &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetime.aspx&quot;&gt;DateTime&lt;/a&gt; values.&lt;br /&gt;
With &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetimeoffset.aspx&quot;&gt;DateTimeOffset&lt;/a&gt; values, this format specifier represents the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.datetimeoffset.aspx&quot;&gt;DateTimeOffset&lt;/a&gt; value&#39;s offset from UTC in hours and minutes.&lt;br /&gt;
The offset is always displayed with a leading sign. A plus sign (+) indicates hours ahead of UTC, and a minus sign (-) indicates hours behind UTC. A single-digit offset is formatted with a leading zero. &lt;br /&gt;
The following example includes the &quot;zzz&quot; custom format specifier in a custom format string.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-37&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-37&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_e4dda8bc-1518-4b63-ad17-30ae58a9d170&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_e4dda8bc-1518-4b63-ad17-30ae58a9d170&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date1 = DateTime.UtcNow;
Console.WriteLine(String.Format(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;{0:%z}, {0:zz}, {0:zzz}&quot;&lt;/span&gt;, 
                  date1));
&lt;span style=&quot;color: green;&quot;&gt;// Displays -7, -07, -07:00                     &lt;/span&gt;

DateTimeOffset date2 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTimeOffset(2008, 8, 1, 0, 0, 0, 
                                          &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; TimeSpan(6, 0, 0));
Console.WriteLine(String.Format(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;{0:%z}, {0:zz}, {0:zzz}&quot;&lt;/span&gt;, 
                  date2));
&lt;span style=&quot;color: green;&quot;&gt;// Displays +6, +06, +06:00&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;timeSeparator&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;:&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle43&quot;&gt;&lt;/a&gt;The &quot;:&quot; custom format specifier represents the time separator, which is used to differentiate hours, minutes, and seconds. The appropriate localized time separator is retrieved from the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.timeseparator.aspx&quot;&gt;DateTimeFormatInfoTimeSeparator&lt;/a&gt; property of the current or specified culture. &lt;br /&gt;
If the &quot;:&quot; format specifier is used without other custom format specifiers, it is interpreted as a standard date and time format specifier and throws a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.formatexception.aspx&quot;&gt;FormatException&lt;/a&gt;. For more information about using a single format specifier, see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers&quot;&gt;Using Single Custom Format Specifiers&lt;/a&gt; later in this topic.&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;dateSeparator&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;The &quot;/&quot; Custom Format Specifier&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle44&quot;&gt;&lt;/a&gt;The &quot;/&quot; custom format specifier represents the date separator, which is used to differentiate years, months, and days. The appropriate localized date separator is retrieved from the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.dateseparator.aspx&quot;&gt;DateTimeFormatInfoDateSeparator&lt;/a&gt; property of the current or specified culture.&lt;br /&gt;
If the &quot;/&quot; format specifier is used without other custom format specifiers, it is interpreted as a standard date and time format specifier and throws a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.formatexception.aspx&quot;&gt;FormatException&lt;/a&gt;. For more information about using a single format specifier, see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers&quot;&gt;Using Single Custom Format Specifiers&lt;/a&gt; later in this topic.&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#table&quot;&gt;Back to table&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;Notes&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;Notes&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle45&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;UsingSingleSpecifiers&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;Using Single Custom Format Specifiers&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle46&quot;&gt;&lt;/a&gt;A custom date and time format string consists of two or more characters. Date and time formatting methods interpret any single-character string as a standard date and time format string. If they do not recognize the character as a valid format specifier, they throw a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.formatexception.aspx&quot;&gt;FormatException&lt;/a&gt;. For example, a format string that consists only of the specifier &quot;h&quot; is interpreted as a standard date and time format string. However, in this particular case, an exception is thrown because there is no &quot;h&quot; standard date and time&lt;span&gt;&lt;span class=&quot;input&quot;&gt;&lt;/span&gt;&lt;/span&gt;format specifier. &lt;br /&gt;
To use any of the custom date and time format specifiers as the only specifier in a format string (that is, to use the &quot;d&quot;, &quot;f&quot;, &quot;F&quot;, &quot;g&quot;, &quot;h&quot;, &quot;H&quot;, &quot;K&quot;, &quot;m&quot;, &quot;M&quot;, &quot;s&quot;, &quot;t&quot;, &quot;y&quot;, &quot;z&quot;, &quot;:&quot;, or &quot;/&quot; custom format specifier by itself), include a space before or after the specifier, or include a percent (&quot;%&quot;) format specifier before the single custom date and time specifier.&lt;br /&gt;
For example, &quot;&lt;span class=&quot;code&quot;&gt;%h&quot;&lt;/span&gt; is interpreted as a custom date and time format string that displays the hour represented by the current date and time value. You can also use the &quot; h&quot; or &quot;h &quot; format string, although this includes a space in the result string along with the hour. The following example illustrates these three format strings.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-38&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-38&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_f13bfd63-bc9d-402c-800a-d44e8acc5f56&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_f13bfd63-bc9d-402c-800a-d44e8acc5f56&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime dat1 = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2009, 6, 15, 13, 45, 0);

Console.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;&#39;{0:%h}&#39;&quot;&lt;/span&gt;, dat1);
Console.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;&#39;{0: h}&#39;&quot;&lt;/span&gt;, dat1);
Console.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;&#39;{0:h }&#39;&quot;&lt;/span&gt;, dat1);
&lt;span style=&quot;color: green;&quot;&gt;// The example displays the following output: &lt;/span&gt;
&lt;span style=&quot;color: green;&quot;&gt;//       &#39;1&#39; &lt;/span&gt;
&lt;span style=&quot;color: green;&quot;&gt;//       &#39; 1&#39; &lt;/span&gt;
&lt;span style=&quot;color: green;&quot;&gt;//       &#39;1 &#39;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;escape&quot;&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;Using the Escape Character&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle47&quot;&gt;&lt;/a&gt;The &quot;d&quot;, &quot;f&quot;, &quot;F&quot;, &quot;g&quot;, &quot;h&quot;, &quot;H&quot;, &quot;K&quot;, &quot;m&quot;, &quot;M&quot;, &quot;s&quot;, &quot;t&quot;, &quot;y&quot;, &quot;z&quot;, &quot;:&quot;, or &quot;/&quot; characters in a format string are interpreted as custom format specifiers rather than as literal characters. To prevent a character from being interpreted as a format specifier, you can precede it with a backslash (\), which is the escape character. The escape character signifies that the following character is a character literal that should be included in the result string unchanged.&lt;br /&gt;
To include a backslash in a result string, you must escape it with another backslash (&lt;span class=&quot;code&quot;&gt;\\&lt;/span&gt;).&lt;br /&gt;
&lt;div class=&quot;alert&quot;&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th align=&quot;left&quot;&gt;&lt;img alt=&quot;Note&quot; class=&quot;cl_IC101471&quot; id=&quot;alert_note&quot; src=&quot;http://i.msdn.microsoft.com/areas/global/content/clear.gif&quot; title=&quot;Note&quot; xmlns=&quot;&quot; /&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Some compilers, such as the C++ and C# compilers, may also interpret a single backslash character as an escape character. To ensure that a string is interpreted correctly when formatting, you can use the verbatim string literal character (the @ character) before the string in C#, or add another backslash character before each backslash in C# and C++. The following C# example illustrates both approaches.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
The following example uses the escape character to prevent the formatting operation from interpreting the &quot;h&quot; and &quot;m&quot; characters as format specifiers. &lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-39&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-39&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_126b694c-040d-4a1c-9eaf-ddf7b67832f8&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_126b694c-040d-4a1c-9eaf-ddf7b67832f8&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DateTime date = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DateTime(2009, 06, 15, 13, 45, 30, 90);
&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; fmt1 = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;h \\h m \\m&quot;&lt;/span&gt;;
&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; fmt2 = &lt;span style=&quot;color: #a31515;&quot;&gt;@&quot;h \h m \m&quot;&lt;/span&gt;;

Console.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;{0} ({1}) -&amp;gt; {2}&quot;&lt;/span&gt;, date, fmt1, date.ToString(fmt1));
Console.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;{0} ({1}) -&amp;gt; {2}&quot;&lt;/span&gt;, date, fmt2, date.ToString(fmt2));
&lt;span style=&quot;color: green;&quot;&gt;// The example displays the following output: &lt;/span&gt;
&lt;span style=&quot;color: green;&quot;&gt;//       6/15/2009 1:45:30 PM (h \h m \m) -&amp;gt; 1 h 45 m &lt;/span&gt;
&lt;span style=&quot;color: green;&quot;&gt;//       6/15/2009 1:45:30 PM (h \h m \m) -&amp;gt; 1 h 45 m      &lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;Control Panel Settings&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle48&quot;&gt;&lt;/a&gt;The &lt;span class=&quot;label&quot;&gt;Regional and Language Options&lt;/span&gt; settings in Control Panel influence the result string produced by a formatting operation that includes many of the custom date and time format specifiers. These settings are used to initialize the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.aspx&quot;&gt;DateTimeFormatInfo&lt;/a&gt; object associated with the current thread culture, which provides values used to govern formatting. Computers that use different settings generate different result strings.&lt;br /&gt;
In addition, if you use the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ky2chs3h.aspx&quot;&gt;CultureInfo#ctor(String)&lt;/a&gt; constructor to instantiate a new &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx&quot;&gt;CultureInfo&lt;/a&gt; object that represents the same culture as the current system culture, any customizations established by the &lt;span class=&quot;label&quot;&gt;Regional and Language Options&lt;/span&gt; item in Control Panel will be applied to the new &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx&quot;&gt;CultureInfo&lt;/a&gt; object. You can use the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/7h898a16.aspx&quot;&gt;CultureInfo#ctor(String, Boolean)&lt;/a&gt; constructo to create a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx&quot;&gt;CultureInfo&lt;/a&gt; object that does not reflect a system&#39;s customizations.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;DateTimeFormatInfo Properties&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;sectionToggle49&quot;&gt;&lt;/a&gt;Formatting is influenced by properties of the current &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.aspx&quot;&gt;DateTimeFormatInfo&lt;/a&gt; object, which is provided implicitly by the current thread culture or explicitly by the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.iformatprovider.aspx&quot;&gt;IFormatProvider&lt;/a&gt; parameter of the method that invokes formatting. For the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.iformatprovider.aspx&quot;&gt;IFormatProvider&lt;/a&gt; parameter, you should specify a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx&quot;&gt;CultureInfo&lt;/a&gt; object, which represents a culture, or a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.aspx&quot;&gt;DateTimeFormatInfo&lt;/a&gt; object. &lt;br /&gt;
The result string produced by many of the custom date and time format specifiers also depends on properties of the current &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.aspx&quot;&gt;DateTimeFormatInfo&lt;/a&gt; object. Your application can change the result produced by some custom date and time format specifiers by changing the corresponding &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.aspx&quot;&gt;DateTimeFormatInfo&lt;/a&gt; property. For example, the &quot;ddd&quot; format specifier adds an abbreviated weekday name found in the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.abbreviateddaynames.aspx&quot;&gt;AbbreviatedDayNames&lt;/a&gt; string array to the result string. Similarly, the &quot;MMMM&quot; format specifier adds a full month name found in the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.monthnames.aspx&quot;&gt;MonthNames&lt;/a&gt; string array to the result string.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/6746133144429277070/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2013/01/custom-date-and-time-format-strings-in-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/6746133144429277070'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/6746133144429277070'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2013/01/custom-date-and-time-format-strings-in-c.html' title='Custom Date and Time Format Strings in C#'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-7607004511325075910</id><published>2013-01-10T14:20:00.001+03:00</published><updated>2013-01-10T14:20:39.412+03:00</updated><title type='text'>How to: Format Data in the Windows Forms DataGridView Control</title><content type='html'>&lt;h1 class=&quot;title&quot;&gt;
&lt;strong&gt;.NET Framework 4.5        &lt;/strong&gt;&lt;/h1&gt;
&lt;div class=&quot;lw_vs&quot;&gt;
&lt;div id=&quot;versionclick&quot;&gt;
&lt;div class=&quot;cl_lw_vs_seperator&quot; id=&quot;vsseperator&quot;&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;a href=&quot;javascript:;&quot; id=&quot;vsLink&quot;&gt;                        Other Versions                    &lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;cl_vs_arrow clip10x10&quot;&gt;
&lt;img alt=&quot;&quot; class=&quot;cl_lw_vs_arrow&quot; id=&quot;vsArrow&quot; src=&quot;http://msdn.microsoft.com/Areas/Epx/Content/Images/ImageSprite.png&quot; /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ul id=&quot;vsPanel&quot; style=&quot;display: none;&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/f9x2790s(v=vs.100).aspx&quot; title=&quot;&quot;&gt;Visual Studio 2010&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/f9x2790s(v=vs.90).aspx&quot; title=&quot;&quot;&gt;Visual Studio 2008&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/f9x2790s(v=vs.85).aspx&quot; title=&quot;&quot;&gt;.NET Framework 3.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/f9x2790s(v=vs.80).aspx&quot; title=&quot;&quot;&gt;Visual Studio 2005&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/f9x2790s(v=vs.90).aspx&quot; title=&quot;&quot;&gt;.NET Framework 3.5&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/f9x2790s(v=vs.80).aspx&quot; title=&quot;&quot;&gt;.NET Framework 2.0&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;cl_lw_vs_seperator&quot; id=&quot;ratingCounterSeperator&quot; style=&quot;display: block;&quot;&gt;
&lt;/div&gt;
&lt;div id=&quot;ratingCounter&quot; style=&quot;display: block; margin: 0px 0px 0px 13px;&quot;&gt;
&lt;span class=&quot;ratingText&quot; id=&quot;rcA&quot;&gt;            1 out of 3 rated this helpful &lt;span id=&quot;rateThisPrefix&quot;&gt;- &lt;/span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/f9x2790s.aspx?cs-save-lang=1&amp;amp;cs-lang=csharp#feedback&quot; id=&quot;rateThisTopic&quot; title=&quot;Rate this topic&quot;&gt;Rate this topic&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;clear: both;&quot;&gt;
&lt;/div&gt;
&lt;!--Published via DxPublisher.--&gt;&lt;div id=&quot;mainSection&quot;&gt;
&lt;div id=&quot;mainBody&quot;&gt;
&lt;!----&gt;&lt;br /&gt;
&lt;div class=&quot;introduction&quot;&gt;
The following procedures demonstrate basic formatting of cell values using the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.defaultcellstyle.aspx&quot;&gt;DefaultCellStyle&lt;/a&gt; property of a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.aspx&quot;&gt;DataGridView&lt;/a&gt; control and of specific columns in a control. For information about advanced data formatting, see &lt;span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/z1cc356h.aspx&quot;&gt;How to: Customize Data Formatting in the Windows Forms DataGridView Control&lt;/a&gt;&lt;/span&gt;.&lt;/div&gt;
&lt;h3 class=&quot;procedureSubHeading&quot;&gt;
To format currency and date values&lt;/h3&gt;
&lt;div class=&quot;subSection&quot;&gt;
&lt;ul&gt;
&lt;li&gt;Set the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcellstyle.format.aspx&quot;&gt;Format&lt;/a&gt; property of a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcellstyle.aspx&quot;&gt;DataGridViewCellStyle&lt;/a&gt;. The following code example sets the format for specific columns using the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcolumn.defaultcellstyle.aspx&quot;&gt;DefaultCellStyle&lt;/a&gt; property of the columns. Values in the&lt;span class=&quot;code&quot;&gt; UnitPrice &lt;/span&gt;column appear in the current culture-specific currency format, with negative values surrounded by parentheses. Values in the&lt;span class=&quot;code&quot;&gt; ShipDate &lt;/span&gt;column appear in the current culture-specific short date format. For more information about &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcellstyle.format.aspx&quot;&gt;Format&lt;/a&gt; values, see &lt;span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/26etazsy.aspx&quot;&gt;Formatting Types&lt;/a&gt;&lt;/span&gt;.&lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-1&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/f9x2790s.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-1&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_fb62c92f-93b6-4343-8872-80aaa19bab6b&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_fb62c92f-93b6-4343-8872-80aaa19bab6b&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.dataGridView1.Columns[&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;UnitPrice&quot;&lt;/span&gt;].DefaultCellStyle.Format = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;c&quot;&lt;/span&gt;;
&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.dataGridView1.Columns[&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;ShipDate&quot;&lt;/span&gt;].DefaultCellStyle.Format = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;d&quot;&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h3 class=&quot;procedureSubHeading&quot;&gt;
To customize the display of null database values&lt;/h3&gt;
&lt;div class=&quot;subSection&quot;&gt;
&lt;ul&gt;
&lt;li&gt;Set the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcellstyle.nullvalue.aspx&quot;&gt;NullValue&lt;/a&gt; property of a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcellstyle.aspx&quot;&gt;DataGridViewCellStyle&lt;/a&gt;. The following code example uses the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.defaultcellstyle.aspx&quot;&gt;DataGridViewDefaultCellStyle&lt;/a&gt; property to display &quot;no entry&quot; in all cells containing values equal to &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.dbnull.value.aspx&quot;&gt;DBNullValue&lt;/a&gt;. &lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-2&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/f9x2790s.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-2&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_033ab7ae-abe5-475d-b749-1893df78a731&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_033ab7ae-abe5-475d-b749-1893df78a731&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.dataGridView1.DefaultCellStyle.NullValue = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;no entry&quot;&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h3 class=&quot;procedureSubHeading&quot;&gt;
To enable wordwrap in text-based cells&lt;/h3&gt;
&lt;div class=&quot;subSection&quot;&gt;
&lt;ul&gt;
&lt;li&gt;Set the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcellstyle.wrapmode.aspx&quot;&gt;WrapMode&lt;/a&gt; property of a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcellstyle.aspx&quot;&gt;DataGridViewCellStyle&lt;/a&gt; to one of the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewtristate.aspx&quot;&gt;DataGridViewTriState&lt;/a&gt; enumeration values. The following code example uses the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.defaultcellstyle.aspx&quot;&gt;DataGridViewDefaultCellStyle&lt;/a&gt; property to set the wrap mode for the entire control. &lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-3&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/f9x2790s.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-3&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_8d9b9f60-5f58-433d-9181-bd7a586bfef1&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_8d9b9f60-5f58-433d-9181-bd7a586bfef1&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.dataGridView1.DefaultCellStyle.WrapMode =
    DataGridViewTriState.True;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h3 class=&quot;procedureSubHeading&quot;&gt;
To specify the text alignment of DataGridView cells&lt;/h3&gt;
&lt;div class=&quot;subSection&quot;&gt;
&lt;ul&gt;
&lt;li&gt;Set the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcellstyle.alignment.aspx&quot;&gt;Alignment&lt;/a&gt; property of a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcellstyle.aspx&quot;&gt;DataGridViewCellStyle&lt;/a&gt; to one of the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcontentalignment.aspx&quot;&gt;DataGridViewContentAlignment&lt;/a&gt; enumeration values. The following code example sets the alignment for a specific column using the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcolumn.defaultcellstyle.aspx&quot;&gt;DefaultCellStyle&lt;/a&gt; property of the column. &lt;br /&gt;
&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-4&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/f9x2790s.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-4&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_c2388d56-6948-4f80-a1ed-ce09627262f0&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_c2388d56-6948-4f80-a1ed-ce09627262f0&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.dataGridView1.Columns[&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;CustomerName&quot;&lt;/span&gt;].DefaultCellStyle
    .Alignment = DataGridViewContentAlignment.MiddleRight;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;

&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;Example&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;exampleToggle&quot;&gt;&lt;!----&gt;&lt;/a&gt;&lt;div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; id=&quot;code-snippet-5&quot; xmlns=&quot;&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabActive&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot;&gt;C#&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerTab&quot; dir=&quot;ltr&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/f9x2790s.aspx?cs-save-lang=1&amp;amp;cs-lang=vb#code-snippet-5&quot;&gt;VB&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:if (window.epx.codeSnippet)window.epx.codeSnippet.copyCode(&#39;CodeSnippetContainerCode_75334c3d-7f2f-47d0-b782-d735ae3b4a70&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_75334c3d-7f2f-47d0-b782-d735ae3b4a70&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; SetFormatting()
{
    &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.dataGridView1.Columns[&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;UnitPrice&quot;&lt;/span&gt;].DefaultCellStyle.Format = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;c&quot;&lt;/span&gt;;
    &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.dataGridView1.Columns[&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;ShipDate&quot;&lt;/span&gt;].DefaultCellStyle.Format = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;d&quot;&lt;/span&gt;;
    &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.dataGridView1.Columns[&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;CustomerName&quot;&lt;/span&gt;].DefaultCellStyle
        .Alignment = DataGridViewContentAlignment.MiddleRight;
    &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.dataGridView1.DefaultCellStyle.NullValue = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;no entry&quot;&lt;/span&gt;;
    &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.dataGridView1.DefaultCellStyle.WrapMode =
        DataGridViewTriState.True;
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;LW_CollapsibleArea_TitleDiv&quot;&gt;
&lt;div&gt;
&lt;a class=&quot;LW_CollapsibleArea_TitleAhref&quot; href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;span class=&quot;cl_CollapsibleArea_expanding LW_CollapsibleArea_Img&quot;&gt;&lt;/span&gt;&lt;span class=&quot;LW_CollapsibleArea_Title&quot;&gt;Compiling the Code&lt;/span&gt;&lt;/a&gt;&lt;div class=&quot;LW_CollapsibleArea_HrDiv&quot;&gt;
&lt;hr class=&quot;LW_CollapsibleArea_Hr&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;sectionblock&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; id=&quot;buildInstructionsToggle&quot;&gt;&lt;!----&gt;&lt;/a&gt;These examples require:  &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.aspx&quot;&gt;DataGridView&lt;/a&gt; control named &lt;span class=&quot;code&quot;&gt;dataGridView1&lt;/span&gt; that contains a column named &lt;span class=&quot;code&quot;&gt;UnitPrice&lt;/span&gt;, a column named &lt;span class=&quot;code&quot;&gt;ShipDate&lt;/span&gt;, and a column named &lt;span class=&quot;code&quot;&gt;CustomerName&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;References to the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.aspx&quot;&gt;System&lt;/a&gt;, &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.drawing.aspx&quot;&gt;System.Drawing&lt;/a&gt;, and &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.aspx&quot;&gt;System.Windows.Forms&lt;/a&gt; assemblies.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/7607004511325075910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2013/01/how-to-format-data-in-windows-forms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/7607004511325075910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/7607004511325075910'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2013/01/how-to-format-data-in-windows-forms.html' title='How to: Format Data in the Windows Forms DataGridView Control'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-468701206220361321</id><published>2013-01-03T23:41:00.003+03:00</published><updated>2013-01-03T23:41:34.145+03:00</updated><title type='text'>Using Meta Tags with Master Pages in ASP.NET</title><content type='html'>&lt;h1 class=&quot;fn&quot; id=&quot;ctl00_ArticleTitle&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;By &lt;span class=&quot;author&quot;&gt;&lt;a href=&quot;http://www.codeproject.com/script/Membership/View.aspx?mid=163770&quot; rel=&quot;author&quot;&gt;Jim Azar&lt;/a&gt;&lt;/span&gt;, 					&lt;span class=&quot;date&quot;&gt;24 May 2007&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;!-- Yes, I&#39;m weak --&gt;&lt;form action=&quot;/Articles/17368/Using-Meta-Tags-with-Master-Pages-in-ASP-NET&quot; id=&quot;aspnetForm&quot; method=&quot;post&quot; name=&quot;aspnetForm&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;
&lt;div&gt;
&lt;a href=&quot;http://www.codeproject.com/KB/aspnet/PageTags/PageTags-source-cs.zip&quot;&gt;Download source code (C#) - 3 Kb &lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;article-text&quot;&gt;
&lt;a href=&quot;http://www.codeproject.com/KB/aspnet/PageTags/PageTags-source-vb.zip&quot;&gt;Download source code (VB) - 3 Kb &lt;/a&gt;&lt;/div&gt;
&lt;h2 class=&quot;article-text&quot;&gt;
Introduction&lt;/h2&gt;
&lt;div class=&quot;article-text&quot;&gt;
The Master Pages introduced in &lt;span class=&quot;search-highlight&quot;&gt;ASP.NET&lt;/span&gt; 2.0 are a great feature, however, they don&#39;t provide a good way to perform the most basic search engine optimization. If you want your web pages to be listed properly and ranked well in search engines, then you need to specify good titles and meta tag descriptions on each page. This article explains how to extend the @Page directive on your &lt;span class=&quot;search-highlight&quot;&gt;ASP.NET&lt;/span&gt; pages so that you can specify the meta tag description and meta tag keywords on each content page when using master pages. &lt;/div&gt;
&lt;h2 class=&quot;article-text&quot;&gt;
Background&lt;/h2&gt;
&lt;div class=&quot;article-text&quot;&gt;
When optimizing your web pages for search engines, some of the most important elements on the page are the &lt;title&gt; tag and the description meta tag. The &lt;title&gt; and meta &lt;span class=&quot;search-highlight&quot;&gt;tags&lt;/span&gt; are usually specified in the &lt;head&gt; section of the HTML on each page as seen in the example below from the &lt;a href=&quot;http://www.rhinoback.com/&quot; target=&quot;_blank&quot;&gt;Rhinoback online backup site&lt;/a&gt;: &lt;/p&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain0&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg0&quot; preid=&quot;0&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse0&quot; preid=&quot;0&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/17368/Using-Meta-Tags-with-Master-Pages-in-ASP-NET#&quot; preid=&quot;0&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;article-text&quot;&gt;
&lt;pre id=&quot;pre0&quot; lang=&quot;html&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;html&lt;/span&gt; &lt;span class=&quot;code-attribute&quot;&gt;xmlns&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;http://www.w3.org/1999/xhtml&quot;&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;
&lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;
&lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;
   Rhinoback Professional Secure Online Backup Services for Small 
   and Medium Business - SMB
&lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;
&lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;meta&lt;/span&gt; &lt;span class=&quot;code-attribute&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;description&quot;&lt;/span&gt; &lt;span class=&quot;code-attribute&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;Professional Online Backup Services. 
      Rhinoback provides robust backup functionality at affordable prices.  
      Premium features, premium services, low prices.  Get the most for 
      your money with Rhinoback!&quot;&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;
&lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;meta&lt;/span&gt; &lt;span class=&quot;code-attribute&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;keywords&quot;&lt;/span&gt; &lt;span class=&quot;code-attribute&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;backup, online backup, secure backup, 
      cheap backup, free backup, offsite backup,internet backup, 
      secure files, offsite data storage, privacy, security, features, 
      low prices, premium service, remote backup&quot;&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;
&lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;
&lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;
     &lt;span class=&quot;code-keyword&quot;&gt;&lt;!--&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&lt;span class=&quot;code-comment&quot;&gt; page content &lt;/span&gt;--&gt;&lt;/span&gt;
&lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;
&lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p class=&quot;article-text&quot;&gt;
The text from the &lt;title&gt; tag is displayed at the top of most browsers. See the title of the Internet Explorer window in the example below:&lt;/p&gt;
&lt;p class=&quot;article-text&quot;&gt;
&lt;a href=&quot;http://www.rhinoback.com/&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Sample of Rhinoback page with title tag&quot; border=&quot;0&quot; height=&quot;216&quot; src=&quot;http://www.codeproject.com/KB/aspnet/PageTags/RhinobackPage.jpg&quot; width=&quot;593&quot; /&gt; &lt;/a&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p class=&quot;article-text&quot;&gt;
The meta description text is displayed by the search engine when your page is listed. The example below is from a Google search. The text below the underlined title comes directly from the meta description tag. Without a meta description tag, your page may be listed with a description that was extracted from text found somewhere on the page. It is always better to specify the text for the description of each page rather than leave it up to a search engine robot.&lt;/p&gt;
&lt;p class=&quot;article-text&quot;&gt;
&lt;a href=&quot;http://www.rhinoback.com/&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;91&quot; lt=&quot;Sample of Rhinoback listing in Google&quot; src=&quot;http://www.codeproject.com/KB/aspnet/PageTags/RhinobackGoogle.jpg&quot; width=&quot;592&quot; /&gt; &lt;/a&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p class=&quot;article-text&quot;&gt;
Master Pages were introduced in &lt;span class=&quot;search-highlight&quot;&gt;ASP.NET&lt;/span&gt; 2.0 and have proven to be a valuable feature. This article does not attempt to explain the details of master pages or how to implement them, that is well covered in numerous other articles. When using master pages the &lt;head&gt; section is part of the master page and is automatically included on all of the content pages. Fortunately the developers at Microsoft included the &lt;strong&gt;Title&lt;/strong&gt; attribute on the @Page directive that enables the developer to specify the title of the page on the content pages rather than on the master page.&lt;/p&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain1&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg1&quot; preid=&quot;1&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse1&quot; preid=&quot;1&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/17368/Using-Meta-Tags-with-Master-Pages-in-ASP-NET#&quot; preid=&quot;1&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;article-text&quot;&gt;
&lt;pre id=&quot;pre1&quot; lang=&quot;html&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-pagedirective&quot;&gt;&lt;%@&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt; Page Language&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;C#&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; MasterPageFile&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;~/Page&lt;span class=&quot;search-highlight&quot;&gt;Tags&lt;/span&gt;.master&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; 
    AutoEventWireup&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;true&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; CodeFile&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;home.aspx.cs&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; Inherits&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;home&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; 
    Title&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;My home page title&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; &lt;/span&gt;&lt;span class=&quot;code-pagedirective&quot;&gt;%&gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p class=&quot;article-text&quot;&gt;
The @Page directive above is from a content page in an &lt;span class=&quot;search-highlight&quot;&gt;ASP.NET&lt;/span&gt; 2.0 website that uses a master page. As discussed above, you may need to specify some meta &lt;span class=&quot;search-highlight&quot;&gt;tags&lt;/span&gt; at the content page level rather than at the master page level. You may have discovered that the @Page directive does have a &lt;strong&gt;Description&lt;/strong&gt; attribute, however, it does not create a meta description tag for your page. In fact, anything that you specify on the &lt;strong&gt;Description&lt;/strong&gt; attribute is completely ignored and not used for anything.&lt;/p&gt;
&lt;p class=&quot;article-text&quot;&gt;
In my case, it was completely unacceptable to have the same description on all pages of my site. I also wanted to specify keywords for each page that may vary from page to page. My first cut at a solution to this problem involved using the code-behind to insert the desired meta &lt;span class=&quot;search-highlight&quot;&gt;tags&lt;/span&gt; onto each pages&#39; &lt;head&gt; section as shown in the Page_Load method of a content page below: &lt;/p&gt;
&lt;h3 class=&quot;article-text&quot;&gt;
C#&lt;/h3&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain2&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg2&quot; preid=&quot;2&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse2&quot; preid=&quot;2&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/17368/Using-Meta-Tags-with-Master-Pages-in-ASP-NET#&quot; preid=&quot;2&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;article-text&quot;&gt;
&lt;pre id=&quot;pre2&quot; lang=&quot;cs&quot; style=&quot;margin-top: 0px;&quot;&gt;    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;void&lt;/span&gt; Page_Load(&lt;span class=&quot;code-keyword&quot;&gt;object&lt;/span&gt; sender, EventArgs e)
    {
            HtmlMeta tag = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; HtmlMeta();
            tag.Name = &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;description&quot;&lt;/span&gt;;
            tag.Content = &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;My description for this page&quot;&lt;/span&gt;;
            Header.Controls.Add(tag);
    }
&lt;/pre&gt;
&lt;/div&gt;
&lt;h3 class=&quot;article-text&quot;&gt;
VB&lt;/h3&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain3&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg3&quot; preid=&quot;3&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse3&quot; preid=&quot;3&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/17368/Using-Meta-Tags-with-Master-Pages-in-ASP-NET#&quot; preid=&quot;3&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;article-text&quot;&gt;
&lt;pre id=&quot;pre3&quot; lang=&quot;vb&quot; style=&quot;margin-top: 0px;&quot;&gt;    &lt;span class=&quot;code-keyword&quot;&gt;Sub&lt;/span&gt; Page_Load(&lt;span class=&quot;code-keyword&quot;&gt;ByVal&lt;/span&gt; sender &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Object&lt;/span&gt;, &lt;span class=&quot;code-keyword&quot;&gt;ByVal&lt;/span&gt; e &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; EventArgs)
            &lt;span class=&quot;code-keyword&quot;&gt;Dim&lt;/span&gt; tag &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; HtmlMeta = &lt;span class=&quot;code-keyword&quot;&gt;New&lt;/span&gt; HtmlMeta()
            tag.Name = &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;description&quot;&lt;/span&gt;
            tag.Content = &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;My description for this page&quot;&lt;/span&gt;
            Header.Controls.Add(tag)
    &lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Sub&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p class=&quot;article-text&quot;&gt;
The problem with this solution is that the title of the page, the meta description, and the content of a page are all related and I really want the title and description to be together and also in the same ASPX file as the content. The &lt;code&gt;Page_Load&lt;/code&gt; method can easily be placed within &lt;script&gt; &lt;span class=&quot;search-highlight&quot;&gt;tags&lt;/span&gt; on the ASPX page, but I wanted to find a solution that was easier to maintain and would allow for quick and easy inspection of the &lt;span class=&quot;search-highlight&quot;&gt;tags&lt;/span&gt; on each page. &lt;/p&gt;
&lt;p class=&quot;article-text&quot;&gt;
The following solution meets my objectives by extending the @Page directive to include the meta &lt;span class=&quot;search-highlight&quot;&gt;tags&lt;/span&gt; that I want to specify for each page individually. &lt;/p&gt;
&lt;h2 class=&quot;article-text&quot;&gt;
Solution&lt;/h2&gt;
&lt;p class=&quot;article-text&quot;&gt;
I created a base page class that inherits from &lt;code&gt;System.Web.UI.Page&lt;/code&gt; and then I modified my content pages to inherit from my &lt;code&gt;BasePage&lt;/code&gt; class. The &lt;code&gt;BasePage&lt;/code&gt; class contains the code that adds the meta &lt;span class=&quot;search-highlight&quot;&gt;tags&lt;/span&gt; to the header controls collection on the page. Since all of my content pages are inheriting from &lt;code&gt;BasePage&lt;/code&gt;, this code only needs to exist in one place and not on every page. &lt;/p&gt;
&lt;h3 class=&quot;article-text&quot;&gt;
C#&lt;/h3&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain4&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg4&quot; preid=&quot;4&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse4&quot; preid=&quot;4&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/17368/Using-Meta-Tags-with-Master-Pages-in-ASP-NET#&quot; preid=&quot;4&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;article-text&quot;&gt;
&lt;pre id=&quot;pre4&quot; lang=&quot;cs&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-comment&quot;&gt;/*&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; ********************************************** 
 * Page directive extender - base page class    *
 *  by Jim Azar - http://www.rhinoback.com      *
 * **********************************************/&lt;/span&gt;

&lt;span class=&quot;code-keyword&quot;&gt;using&lt;/span&gt; System;
&lt;span class=&quot;code-keyword&quot;&gt;using&lt;/span&gt; System.Web.UI;
&lt;span class=&quot;code-keyword&quot;&gt;using&lt;/span&gt; System.Web.UI.HtmlControls;
&lt;span class=&quot;code-keyword&quot;&gt;using&lt;/span&gt; System.Text.RegularExpressions;

&lt;span class=&quot;code-SummaryComment&quot;&gt;///&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; &lt;span class=&quot;code-SummaryComment&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-SummaryComment&quot;&gt;SUMMARY&lt;/span&gt;&lt;span class=&quot;code-SummaryComment&quot;&gt;&gt;&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;code-SummaryComment&quot;&gt;///&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; Base class with properties for meta &lt;span class=&quot;search-highlight&quot;&gt;tags&lt;/span&gt; for content pages 
&lt;/span&gt;&lt;span class=&quot;code-SummaryComment&quot;&gt;///&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; &lt;span class=&quot;code-SummaryComment&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-SummaryComment&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;code-SummaryComment&quot;&gt;SUMMARY&lt;/span&gt;&lt;span class=&quot;code-SummaryComment&quot;&gt;&gt;&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;class&lt;/span&gt; BasePage : Page
    {
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;string&lt;/span&gt; _keywords;
    &lt;span class=&quot;code-keyword&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;string&lt;/span&gt; _description;
    &lt;span class=&quot;code-comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; Constructor
&lt;/span&gt;    &lt;span class=&quot;code-comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; Add an event handler to Init event for the control
&lt;/span&gt;    &lt;span class=&quot;code-comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; so we can execute code when a server control (page)
&lt;/span&gt;    &lt;span class=&quot;code-comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; that inherits from this base class is initialized.
&lt;/span&gt;    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; BasePage()
        {
        Init += &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; EventHandler(BasePage_Init);
        }

    &lt;span class=&quot;code-comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; Whenever a page that uses this base class is initialized
&lt;/span&gt;    &lt;span class=&quot;code-comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; add meta keywords and descriptions if available
&lt;/span&gt;    &lt;span class=&quot;code-keyword&quot;&gt;void&lt;/span&gt; BasePage_Init(&lt;span class=&quot;code-keyword&quot;&gt;object&lt;/span&gt; sender, EventArgs e)
        {

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!String.IsNullOrEmpty(Meta_Keywords))
            {
            HtmlMeta tag = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; HtmlMeta();
            tag.Name = &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;keywords&quot;&lt;/span&gt;;
            tag.Content = Meta_Keywords;
            Header.Controls.Add(tag);
            }

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!String.IsNullOrEmpty(Meta_Description))
            {
            HtmlMeta tag = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; HtmlMeta();
            tag.Name = &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;description&quot;&lt;/span&gt;;
            tag.Content = Meta_Description;
            Header.Controls.Add(tag);
            }
        }

    &lt;span class=&quot;code-SummaryComment&quot;&gt;///&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; &lt;span class=&quot;code-SummaryComment&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-SummaryComment&quot;&gt;SUMMARY&lt;/span&gt;&lt;span class=&quot;code-SummaryComment&quot;&gt;&gt;&lt;/span&gt;
&lt;/span&gt;    &lt;span class=&quot;code-SummaryComment&quot;&gt;///&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; Gets or sets the Meta Keywords tag for the page
&lt;/span&gt;    &lt;span class=&quot;code-SummaryComment&quot;&gt;///&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; &lt;span class=&quot;code-SummaryComment&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-SummaryComment&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;code-SummaryComment&quot;&gt;SUMMARY&lt;/span&gt;&lt;span class=&quot;code-SummaryComment&quot;&gt;&gt;&lt;/span&gt;
&lt;/span&gt;    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;string&lt;/span&gt; Meta_Keywords
        {
        &lt;span class=&quot;code-keyword&quot;&gt;get&lt;/span&gt; 
            { 
            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; _keywords; 
            }
        &lt;span class=&quot;code-keyword&quot;&gt;set&lt;/span&gt; 
            { 
            &lt;span class=&quot;code-comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; strip out any excessive white-space, newlines and linefeeds
&lt;/span&gt;            _keywords = Regex.Replace(value, &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;\\s+&quot;&lt;/span&gt;, &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt; &quot;&lt;/span&gt;); 
            }
        }

    &lt;span class=&quot;code-SummaryComment&quot;&gt;///&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; &lt;span class=&quot;code-SummaryComment&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-SummaryComment&quot;&gt;SUMMARY&lt;/span&gt;&lt;span class=&quot;code-SummaryComment&quot;&gt;&gt;&lt;/span&gt;
&lt;/span&gt;    &lt;span class=&quot;code-SummaryComment&quot;&gt;///&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; Gets or sets the Meta Description tag for the page
&lt;/span&gt;    &lt;span class=&quot;code-SummaryComment&quot;&gt;///&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; &lt;span class=&quot;code-SummaryComment&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-SummaryComment&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;code-SummaryComment&quot;&gt;SUMMARY&lt;/span&gt;&lt;span class=&quot;code-SummaryComment&quot;&gt;&gt;&lt;/span&gt;
&lt;/span&gt;    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;string&lt;/span&gt; Meta_Description
        {
        &lt;span class=&quot;code-keyword&quot;&gt;get&lt;/span&gt; 
            { 
            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; _description; 
            }
        &lt;span class=&quot;code-keyword&quot;&gt;set&lt;/span&gt; 
            {
            &lt;span class=&quot;code-comment&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; strip out any excessive white-space, newlines and linefeeds
&lt;/span&gt;            _description = Regex.Replace(value, &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;\\s+&quot;&lt;/span&gt;, &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt; &quot;&lt;/span&gt;); 
            }
        }
    }&lt;/pre&gt;
&lt;/div&gt;
&lt;h3 class=&quot;article-text&quot;&gt;
VB&lt;/h3&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain5&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg5&quot; preid=&quot;5&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse5&quot; preid=&quot;5&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/17368/Using-Meta-Tags-with-Master-Pages-in-ASP-NET#&quot; preid=&quot;5&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;article-text&quot;&gt;
&lt;pre id=&quot;pre5&quot; lang=&quot;vb&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-comment&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;* ********************************************** 
&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;* Page directive extender - base page class    *
&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;*  by Jim Azar - http://www.rhinoback.com      *
&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;* **********************************************/
&lt;/span&gt;
&lt;span class=&quot;code-keyword&quot;&gt;Imports&lt;/span&gt; System
&lt;span class=&quot;code-keyword&quot;&gt;Imports&lt;/span&gt; System.Web.UI
&lt;span class=&quot;code-keyword&quot;&gt;Imports&lt;/span&gt; System.Web.UI.HtmlControls
&lt;span class=&quot;code-keyword&quot;&gt;Imports&lt;/span&gt; System.Text.RegularExpressions


&lt;span class=&quot;code-comment&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; Base class with properties for meta &lt;span class=&quot;search-highlight&quot;&gt;tags&lt;/span&gt; for content pages 
&lt;/span&gt;
&lt;span class=&quot;code-keyword&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Class&lt;/span&gt; BasePage
    &lt;span class=&quot;code-keyword&quot;&gt;Inherits&lt;/span&gt; Page

    &lt;span class=&quot;code-keyword&quot;&gt;Dim&lt;/span&gt; _keywords &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;String&lt;/span&gt;
    &lt;span class=&quot;code-keyword&quot;&gt;Dim&lt;/span&gt; _description &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;String&lt;/span&gt;
    &lt;span class=&quot;code-comment&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; Constructor
&lt;/span&gt;    &lt;span class=&quot;code-comment&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; Add an event handler to Init event for the control
&lt;/span&gt;    &lt;span class=&quot;code-comment&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; so we can execute code when a server control (page)
&lt;/span&gt;    &lt;span class=&quot;code-comment&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; that inherits from this base class is initialized.
&lt;/span&gt;    &lt;span class=&quot;code-keyword&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Sub&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;New&lt;/span&gt;()
        &lt;span class=&quot;code-keyword&quot;&gt;AddHandler&lt;/span&gt; Init, &lt;span class=&quot;code-keyword&quot;&gt;New&lt;/span&gt; EventHandler(&lt;span class=&quot;code-keyword&quot;&gt;AddressOf&lt;/span&gt; BasePage_Init)
    &lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Sub&lt;/span&gt;

    &lt;span class=&quot;code-comment&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; Whenever a page that uses this base class is initialized
&lt;/span&gt;    &lt;span class=&quot;code-comment&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; add meta keywords and descriptions if available
&lt;/span&gt;    &lt;span class=&quot;code-keyword&quot;&gt;Sub&lt;/span&gt; BasePage_Init(&lt;span class=&quot;code-keyword&quot;&gt;ByVal&lt;/span&gt; sender &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Object&lt;/span&gt;, &lt;span class=&quot;code-keyword&quot;&gt;ByVal&lt;/span&gt; e &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; EventArgs)

        &lt;span class=&quot;code-keyword&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Not&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;String&lt;/span&gt;.IsNullOrEmpty(Meta_Keywords) &lt;span class=&quot;code-keyword&quot;&gt;Then&lt;/span&gt;
            &lt;span class=&quot;code-keyword&quot;&gt;Dim&lt;/span&gt; tag &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; HtmlMeta = &lt;span class=&quot;code-keyword&quot;&gt;New&lt;/span&gt; HtmlMeta()
            tag.Name = &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;keywords&quot;&lt;/span&gt;
            tag.Content = Meta_Keywords
            Header.Controls.Add(tag)
        &lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;If&lt;/span&gt;

        &lt;span class=&quot;code-keyword&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Not&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;String&lt;/span&gt;.IsNullOrEmpty(Meta_Description) &lt;span class=&quot;code-keyword&quot;&gt;Then&lt;/span&gt;
            &lt;span class=&quot;code-keyword&quot;&gt;Dim&lt;/span&gt; tag &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; HtmlMeta = &lt;span class=&quot;code-keyword&quot;&gt;New&lt;/span&gt; HtmlMeta()
            tag.Name = &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;description&quot;&lt;/span&gt;
            tag.Content = Meta_Description
            Header.Controls.Add(tag)
        &lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;If&lt;/span&gt;
    &lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Sub&lt;/span&gt;


    &lt;span class=&quot;code-comment&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;Gets or sets the Meta Keywords tag for the page
&lt;/span&gt;    &lt;span class=&quot;code-keyword&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Property&lt;/span&gt; Meta_Keywords() &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;String&lt;/span&gt;
        &lt;span class=&quot;code-keyword&quot;&gt;Get&lt;/span&gt;
            &lt;span class=&quot;code-keyword&quot;&gt;Return&lt;/span&gt; _keywords
        &lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Get&lt;/span&gt;
        &lt;span class=&quot;code-keyword&quot;&gt;set&lt;/span&gt; 
            &lt;span class=&quot;code-comment&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; strip out any excessive white-space, newlines and linefeeds
&lt;/span&gt;            _keywords = Regex.Replace(value, &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;\\s+&quot;&lt;/span&gt;, &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt; &quot;&lt;/span&gt;)
        &lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Set&lt;/span&gt;
    &lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Property&lt;/span&gt;


    &lt;span class=&quot;code-comment&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; Gets or sets the Meta Description tag for the page
&lt;/span&gt;    &lt;span class=&quot;code-keyword&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Property&lt;/span&gt; Meta_Description() &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;String&lt;/span&gt;
        &lt;span class=&quot;code-keyword&quot;&gt;Get&lt;/span&gt;
            &lt;span class=&quot;code-keyword&quot;&gt;Return&lt;/span&gt; _description
        &lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Get&lt;/span&gt;
        &lt;span class=&quot;code-keyword&quot;&gt;Set&lt;/span&gt;(&lt;span class=&quot;code-keyword&quot;&gt;ByVal&lt;/span&gt; value &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;String&lt;/span&gt;)
            &lt;span class=&quot;code-comment&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt; strip out any excessive white-space, newlines and linefeeds
&lt;/span&gt;            _description = Regex.Replace(value, &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;\\s+&quot;&lt;/span&gt;, &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt; &quot;&lt;/span&gt;)
        &lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Set&lt;/span&gt;
    &lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Property&lt;/span&gt;
&lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Class&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p class=&quot;article-text&quot;&gt;
The &lt;code&gt;Meta_Keywords&lt;/code&gt; and &lt;code&gt;Meta_Description&lt;/code&gt; properties are public and can be set when the class (or derived class) is instantiated. When a page that inherits from this class is initialized, the &lt;code&gt;Base_Init&lt;/code&gt; event handler is invoked and adds the meta &lt;span class=&quot;search-highlight&quot;&gt;tags&lt;/span&gt; to the page.&lt;/p&gt;
&lt;p class=&quot;article-text&quot;&gt;
On each content page, simply change the inheritance so that they inherit from &lt;code&gt;BasePage&lt;/code&gt; instead of &lt;code&gt;page&lt;/code&gt; or &lt;code&gt;System.Web.UI.Page&lt;/code&gt;. See below: &lt;/p&gt;
&lt;h3 class=&quot;article-text&quot;&gt;
C#&lt;/h3&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain6&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg6&quot; preid=&quot;6&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse6&quot; preid=&quot;6&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/17368/Using-Meta-Tags-with-Master-Pages-in-ASP-NET#&quot; preid=&quot;6&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;article-text&quot;&gt;
&lt;pre id=&quot;pre6&quot; lang=&quot;cs&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;partial&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;class&lt;/span&gt; home : BasePage 
{
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;void&lt;/span&gt; Page_Load(&lt;span class=&quot;code-keyword&quot;&gt;object&lt;/span&gt; sender, EventArgs e)
    {

    }
}&lt;/pre&gt;
&lt;/div&gt;
&lt;h3 class=&quot;article-text&quot;&gt;
VB&lt;/h3&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain7&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg7&quot; preid=&quot;7&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse7&quot; preid=&quot;7&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/17368/Using-Meta-Tags-with-Master-Pages-in-ASP-NET#&quot; preid=&quot;7&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;article-text&quot;&gt;
&lt;pre id=&quot;pre7&quot; lang=&quot;vb&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;Partial&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Class&lt;/span&gt; home
    &lt;span class=&quot;code-keyword&quot;&gt;Inherits&lt;/span&gt; BasePage
    &lt;span class=&quot;code-keyword&quot;&gt;Sub&lt;/span&gt; Page_Load(&lt;span class=&quot;code-keyword&quot;&gt;ByVal&lt;/span&gt; sender &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Object&lt;/span&gt;, &lt;span class=&quot;code-keyword&quot;&gt;ByVal&lt;/span&gt; e &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; EventArgs)
    
    &lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Sub&lt;/span&gt;
&lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Class&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p class=&quot;article-text&quot;&gt;
Now that each content page is inheriting from &lt;code&gt;BasePage&lt;/code&gt;, they have the properties and the code to insert the meta &lt;span class=&quot;search-highlight&quot;&gt;tags&lt;/span&gt;. Now we can specify the &lt;code&gt;Meta_Keywords&lt;/code&gt; and &lt;code&gt;Meta_Description&lt;/code&gt; values on the @Page directive on the ASPX file. See the examples below: &lt;/p&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain8&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg8&quot; preid=&quot;8&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse8&quot; preid=&quot;8&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/17368/Using-Meta-Tags-with-Master-Pages-in-ASP-NET#&quot; preid=&quot;8&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;article-text&quot;&gt;
&lt;pre id=&quot;pre8&quot; lang=&quot;html&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-pagedirective&quot;&gt;&lt;%@&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt; Page Language&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;C#&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; MasterPageFile&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;~/Page&lt;span class=&quot;search-highlight&quot;&gt;Tags&lt;/span&gt;.master&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; 
  AutoEventWireup&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;true&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; CodeFile&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;home.aspx.cs&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; Inherits&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;home&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; 
  CodeFileBaseClass&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;BasePage&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; 
  
  Title&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;My home page title&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; 
  
  Meta_Keywords&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;page directive, extension, dotnet, &lt;span class=&quot;search-highlight&quot;&gt;asp.net&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt;
                              
  Meta_Description&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;This is the meta description for my home page.&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt;          
&lt;/span&gt;&lt;span class=&quot;code-pagedirective&quot;&gt;%&gt;&lt;/span&gt;

&lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;asp:Content&lt;/span&gt; &lt;span class=&quot;code-attribute&quot;&gt;ID&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;Content1&quot;&lt;/span&gt; &lt;span class=&quot;code-attribute&quot;&gt;ContentPlaceHolderID&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;ContentPlaceHolder1&quot;&lt;/span&gt; 
    &lt;span class=&quot;code-attribute&quot;&gt;Runat&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;Server&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;
    &lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;h3&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;My home page content&lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;h3&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;
    &lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;
    This is the content on my home page.  This page has an appropriate title
    tag and also has meta &lt;span class=&quot;search-highlight&quot;&gt;tags&lt;/span&gt; for keywords and description that are 
    relative to this page. The title tag is essential to good search engine 
    optimization and the meta description is the text that the search engine
    will display when your page is listed in search results.  The title and 
    meta description should be set specific to each page and should describe
    the content of the page. 
    &lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;
&lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;asp:Content&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p class=&quot;article-text&quot;&gt;
Note the addition of the &lt;code&gt;CodeFileBaseClass&lt;/code&gt; attribute. This is required so that page can reference the public properties specified in the &lt;code&gt;BasePage&lt;/code&gt; class.&lt;/p&gt;
&lt;h2 class=&quot;article-text&quot;&gt;
Points of Interest&lt;/h2&gt;
&lt;p class=&quot;article-text&quot;&gt;
You may have noticed the regular expression in the &lt;code&gt;BasePage&lt;/code&gt; class. This is here so that you can break the description and keyword &lt;span class=&quot;search-highlight&quot;&gt;tags&lt;/span&gt; up onto mulitple lines in your ASPX file, making them more readable and maintainable. Consider the following example from the &lt;a href=&quot;http://www.ideascope.com/&quot; target=&quot;_blank&quot;&gt;IdeaScope Customer Feedback Management&lt;/a&gt; website:&lt;/p&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain9&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg9&quot; preid=&quot;9&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse9&quot; preid=&quot;9&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/17368/Using-Meta-Tags-with-Master-Pages-in-ASP-NET#&quot; preid=&quot;9&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;article-text&quot;&gt;
&lt;pre id=&quot;pre9&quot; lang=&quot;html&quot; style=&quot;margin-top: 0px;&quot;&gt;&lt;span class=&quot;code-pagedirective&quot;&gt;&lt;%@&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt; Page Language&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;C#&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; MasterPageFile&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;~/IdeaScope.master&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; 
  AutoEventWireup&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;true&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; CodeFile&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;is.aspx.cs&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; Inherits&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;_is&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt;
  CodeFileBaseClass&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;BasePage&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; 
  
  Title&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;Effective Customer Feedback Management, 
      Improve Customer Commmunication&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; 
  
  Meta_Keywords&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;Customer Feedback, Customer Opinion, feedback, opinion,
       idea, ideas, idea management, customer feedback management,         
        product management, product manager, product marketing,         
        product marketing manager&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt;
                              
  Meta_Description&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;IdeaScope is an on-demand and embedded solution that 
       allows you to capture, prioritize and centrally manage customer 
       feedback. Make your customer feedback process more efficient. Save 
       time and involve more stakeholders without significant cost.&quot;&lt;/span&gt;&lt;span class=&quot;code-attribute&quot;&gt; 
  &lt;/span&gt;&lt;span class=&quot;code-pagedirective&quot;&gt;%&gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p class=&quot;article-text&quot;&gt;
Without the regular expression replacement, these &lt;span class=&quot;search-highlight&quot;&gt;tags&lt;/span&gt; would contain new lines and excess spaces at the beginning and ending of each line. I suspect that some search engine spiders might get upset about that, and the primary reason for including these &lt;span class=&quot;search-highlight&quot;&gt;tags&lt;/span&gt; is to make search engines happy.&lt;/p&gt;
&lt;p class=&quot;article-text&quot;&gt;
There is one last thing that you might want to do to tidy up this solution. The &lt;span class=&quot;search-highlight&quot;&gt;ASP.NET&lt;/span&gt; validation in Visual Studio 2005 is not going to recognize &lt;strong&gt;Meta_Keywords&lt;/strong&gt; or &lt;strong&gt;Meta_Description&lt;/strong&gt;. You will get warnings from the compiler saying that these are not valid attributes for the @Page directive. You will also see those red squiggley lines under those attributes in Visual Studio. Your code will compile and run fine. If you are like me and don&#39;t want to see any warnings or validation errors, then you will want to add the following lines to Visual Studio&#39;s schema for the @Page directive. &lt;/p&gt;
&lt;div class=&quot;pre-action-link&quot; id=&quot;premain10&quot; style=&quot;display: block;&quot; width=&quot;100%&quot;&gt;
&lt;img height=&quot;9&quot; id=&quot;preimg10&quot; preid=&quot;10&quot; src=&quot;http://www.codeproject.com/images/minus.gif&quot; style=&quot;cursor: pointer;&quot; width=&quot;9&quot; /&gt;&lt;span id=&quot;precollapse10&quot; preid=&quot;10&quot; style=&quot;cursor: pointer; margin-bottom: 0px;&quot;&gt; Collapse&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/17368/Using-Meta-Tags-with-Master-Pages-in-ASP-NET#&quot; preid=&quot;10&quot;&gt;Copy Code&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;article-text&quot;&gt;
&lt;pre id=&quot;pre10&quot; lang=&quot;xml&quot; style=&quot;margin-top: 0px;&quot;&gt;  &lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;xsd:attribute&lt;/span&gt; &lt;span class=&quot;code-attribute&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;Meta_Keywords&quot;&lt;/span&gt; &lt;span class=&quot;code-attribute&quot;&gt;vs:nonfilterable&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;true&quot;&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;
  &lt;span class=&quot;code-keyword&quot;&gt;&lt;&lt;/span&gt;&lt;span class=&quot;code-leadattribute&quot;&gt;xsd:attribute&lt;/span&gt; &lt;span class=&quot;code-attribute&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;Meta_Description&quot;&lt;/span&gt; &lt;span class=&quot;code-attribute&quot;&gt;vs:nonfilterable&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;=&quot;&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;true&quot;&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;code-keyword&quot;&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p class=&quot;article-text&quot;&gt;
These nodes should be inserted as child nodes of &lt;code lang=&quot;xml&quot;&gt;&lt;xsd:complexType name=&quot;PageDef&quot;&gt;&lt;/code&gt; The schema file is located at the following location if you installed Visual Studio 2005 in the default location: &lt;/p&gt;
&lt;div class=&quot;article-text&quot;&gt;
&lt;code&gt;C:\Program Files\Microsoft Visual Studio 8\Common7\Packages\schemas\html\page_directives.xsd &lt;/code&gt;&lt;/div&gt;
&lt;p class=&quot;article-text&quot;&gt;
This article demonstrates how to extend the @Page directive to support meta keywords and meta descriptions. You can easily add other meta &lt;span class=&quot;search-highlight&quot;&gt;tags&lt;/span&gt; to the sample code. Complete source files and a sample project are included for C# and VB. Thanks to Scott Guthrie&#39;s blog post, &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2005/08/02/421405.aspx&quot; target=&quot;_blank&quot;&gt;Obsure but cool feature in &lt;span class=&quot;search-highlight&quot;&gt;ASP.NET&lt;/span&gt; 2.0&lt;/a&gt; for the information that led up to this solution.&lt;/p&gt;
&lt;p class=&quot;article-text&quot;&gt;
Your comments and suggestions to improve this article are welcome.&lt;/p&gt;
&lt;h2&gt;
License&lt;/h2&gt;
&lt;div id=&quot;LicenseTerms&quot;&gt;
&lt;p&gt;
This article, along with any associated source code and files, is licensed under &lt;a href=&quot;http://www.codeproject.com/info/cpol10.aspx&quot; rel=&quot;license&quot;&gt;The Code Project Open License (CPOL)&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;br /&gt;&lt;/p&gt;
&lt;/form&gt;
&lt;p&gt;
 &lt;br /&gt;&lt;/p&gt;
&lt;/title&gt;&lt;/div&gt;
&lt;/form&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/468701206220361321/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2013/01/using-meta-tags-with-master-pages-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/468701206220361321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/468701206220361321'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2013/01/using-meta-tags-with-master-pages-in.html' title='Using Meta Tags with Master Pages in ASP.NET'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-8098784150101620121</id><published>2012-11-28T20:54:00.001+03:00</published><updated>2012-11-28T20:54:48.064+03:00</updated><title type='text'>HTML Tutorial - Introduction to tables</title><content type='html'>&lt;h2&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.1&quot;&gt;11.1&lt;/a&gt; Introduction to tables&lt;/h2&gt;
&lt;br /&gt;
The HTML table model allows authors to arrange data -- text, preformatted  text, images, links, forms, form fields, other tables, etc. -- into rows and  columns of cells.&lt;br /&gt;
&lt;br /&gt;
Each table may have an associated caption (see the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-CAPTION&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;CAPTION&lt;/samp&gt;&lt;/a&gt; element)  that provides a short description of the table&#39;s purpose. A longer description  may also be provided (via the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-summary&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;summary&lt;/samp&gt;&lt;/a&gt; attribute)  for the benefit of people using speech or Braille-based user agents.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#rowgroups&quot;&gt;Table rows&lt;/a&gt; may be grouped into a head, foot, and  body sections, (via the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-THEAD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;THEAD&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TFOOT&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TFOOT&lt;/samp&gt;&lt;/a&gt; and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TBODY&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TBODY&lt;/samp&gt;&lt;/a&gt;  elements, respectively). Row groups convey additional structural information and  may be rendered by user agents in ways that emphasize this structure. User  agents may exploit the head/body/foot division to support scrolling of body  sections independently of the head and foot sections. When long tables are  printed, the head and foot information may be repeated on each page that  contains table data.&lt;br /&gt;
&lt;br /&gt;
Authors may also &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#colgroups&quot;&gt;group columns&lt;/a&gt; to provide additional  structural information that may be exploited by user agents. Furthermore,  authors may declare column properties at the start of a table definition (via  the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; elements) in a way  that enables user agents to render the table incrementally rather than having to  wait for all the table data to arrive before rendering.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#cells&quot;&gt;Table cells&lt;/a&gt; may either contain &quot;header&quot; information (see  the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TH&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TH&lt;/samp&gt;&lt;/a&gt;  element) or &quot;data&quot; (see the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TD&lt;/samp&gt;&lt;/a&gt; element). Cells may span multiple rows and columns.  The HTML 4 table model allows authors to label each cell so that &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#non-visual-rendering&quot;&gt;non-visual user agents&lt;/a&gt; may more easily  communicate heading information about the cell to the user. Not only do these  mechanisms greatly assist users with visual disabilities, they make it possible  for multi-modal wireless browsers with limited display capabilities (e.g.,  Web-enabled pagers and phones) to handle tables.&lt;br /&gt;
&lt;br /&gt;
Tables should not be used purely as a means to layout document content as  this may present problems when rendering to non-visual media. Additionally, when  used with graphics, these tables may force users to scroll horizontally to view  a table designed on a system with a larger display. To minimize these problems,  authors should use &lt;a href=&quot;http://www.w3.org/TR/html401/present/styles.html&quot;&gt;style sheets&lt;/a&gt; to control  layout rather than tables.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;note&quot;&gt;
&lt;em&gt;&lt;strong&gt;Note.&lt;/strong&gt; This specification includes more detailed  information about tables in sections on &lt;a href=&quot;http://www.w3.org/TR/html401/appendix/notes.html#notes-tables&quot;&gt;table design rationale and  implementation issues&lt;/a&gt;.&lt;/em&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
Here&#39;s a simple table that illustrates some of the features of the HTML table  model. The following table definition:&lt;br /&gt;
&lt;pre&gt;&lt;table border=&quot;1&quot; summary=&quot;This table gives some statistics about fruit
                   flies: average height and weight, and percentage
                   with red eyes (for both males and females).&quot;&gt;
&lt;caption&gt;&lt;em&gt;A test table with merged cells&lt;/em&gt;&lt;/caption&gt;
&lt;tr&gt;&lt;th rowspan=&quot;2&quot;&gt;&lt;th colspan=&quot;2&quot;&gt;Average
    &lt;th rowspan=&quot;2&quot;&gt;Red
eyes
&lt;tr&gt;&lt;th&gt;height&lt;th&gt;weight
&lt;tr&gt;&lt;th&gt;Males&lt;td&gt;1.9&lt;td&gt;0.003&lt;td&gt;40%
&lt;tr&gt;&lt;th&gt;Females&lt;td&gt;1.7&lt;td&gt;0.002&lt;td&gt;43%
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/th&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/th&gt;&lt;/th&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;/pre&gt;
might be rendered something like this on a tty device:&lt;br /&gt;
&lt;pre&gt;          A test table with merged cells
    /-----------------------------------------\
    |          |      Average      |   Red    |
    |          |-------------------|  eyes    |
    |          |  height |  weight |          |
    |-----------------------------------------|
    |  Males   | 1.9     | 0.003   |   40%    |
    |-----------------------------------------|
    | Females  | 1.7     | 0.002   |   43%    |
    \-----------------------------------------/
&lt;/pre&gt;
or like this by a graphical user agent:&lt;br /&gt;
&lt;img alt=&quot;A table with merged cells&quot; src=&quot;http://www.w3.org/TR/html401/images/mergedcells.gif&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.2&quot;&gt;11.2&lt;/a&gt; Elements for constructing tables&lt;/h2&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.2.1&quot;&gt;11.2.1&lt;/a&gt; The &lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;edef-TABLE&quot;&gt;&lt;samp class=&quot;edef&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt; element&lt;/h3&gt;
&lt;br /&gt;
&lt;div class=&quot;dtd-fragment&quot;&gt;
&lt;pre class=&quot;dtd-fragment&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/pre&gt;
&lt;/div&gt;
- -
     (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)&amp;gt;
%attrs;                              -- &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#coreattrs&quot;&gt;%coreattrs&lt;/a&gt;, &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#i18n&quot;&gt;%i18n&lt;/a&gt;, &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#events&quot;&gt;%events&lt;/a&gt; --
  &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-summary&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;summary&lt;/samp&gt;&lt;/a&gt;     &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#Text&quot;&gt;%Text;&lt;/a&gt;         #IMPLIED  -- purpose/structure for speech output--
  &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-width-TABLE&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;width&lt;/samp&gt;&lt;/a&gt;       &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#Length&quot;&gt;%Length;&lt;/a&gt;       #IMPLIED  -- table width --
  &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-border-TABLE&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;border&lt;/samp&gt;&lt;/a&gt;      &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#Pixels&quot;&gt;%Pixels;&lt;/a&gt;       #IMPLIED  -- controls frame width around table --
  &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-frame&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;frame&lt;/samp&gt;&lt;/a&gt;       &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#TFrame&quot;&gt;%TFrame;&lt;/a&gt;       #IMPLIED  -- which parts of frame to render --
  &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-rules&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;rules&lt;/samp&gt;&lt;/a&gt;       &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#TRules&quot;&gt;%TRules;&lt;/a&gt;       #IMPLIED  -- rulings between rows and cols --
  &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-cellspacing&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;cellspacing&lt;/samp&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#Length&quot;&gt;%Length;&lt;/a&gt;       #IMPLIED  -- spacing between cells --
  &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-cellpadding&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;cellpadding&lt;/samp&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#Length&quot;&gt;%Length;&lt;/a&gt;       #IMPLIED  -- spacing within cells --
  &amp;gt;
&lt;br /&gt;
&lt;em&gt;Start tag: &lt;strong&gt;required&lt;/strong&gt;, End tag: &lt;strong&gt;required&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;adef-list&quot;&gt;
&lt;em&gt;Attribute definitions&lt;/em&gt;&lt;br /&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-summary&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;summary&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-text&quot;&gt;&lt;em&gt;text&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-sensitive&quot;&gt;[CS]&lt;/a&gt;&lt;dd&gt;This attribute provides a summary of the table&#39;s purpose and structure for  user agents rendering to non-visual media such as speech and Braille.&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-align-TABLE&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;align&lt;/samp&gt;&lt;/a&gt; = &lt;samp&gt;left|center|right&lt;/samp&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-insensitive&quot;&gt;[CI]&lt;/a&gt;&lt;dd&gt;&lt;a href=&quot;http://www.w3.org/TR/html401/conform.html#deprecated&quot;&gt;&lt;strong&gt;Deprecated.&lt;/strong&gt;&lt;/a&gt; This  attribute specifies the position of the table with respect to the document.  Permitted values: &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;samp&gt;left:&lt;/samp&gt; The table is to the left of the document.
&lt;li&gt;&lt;samp&gt;center:&lt;/samp&gt; The table is to the center of the document.
&lt;li&gt;&lt;samp&gt;right:&lt;/samp&gt; The table is to the right of the document. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-width-TABLE&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;width&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-length&quot;&gt;&lt;em&gt;length&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-neutral&quot;&gt;[CN]&lt;/a&gt;&lt;dd&gt;This attribute specifies the desired width of the entire table and is  intended for visual user agents. When the value is a percentage value, the value  is relative to the user agent&#39;s available horizontal space. In the absence of  any width specification, table width is determined by the user agent. &lt;/dd&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dl&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;aref-list&quot;&gt;
&lt;em&gt;Attributes defined elsewhere&lt;/em&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-id&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;id&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-class&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;class&lt;/samp&gt;&lt;/a&gt;  (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/global.html#id-and-class&quot;&gt;document-wide identifiers&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;lang&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#language-info&quot;&gt;language information&lt;/a&gt;), &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;dir&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#bidirection&quot;&gt;text direction&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-title&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;title&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/global.html#title&quot;&gt;element  title&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/present/styles.html#adef-style&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;style&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/present/styles.html#style-element&quot;&gt;inline style information&lt;/a&gt; )
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onclick&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onclick&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-ondblclick&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;ondblclick&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmousedown&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmousedown&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseup&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseup&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseover&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseover&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmousemove&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmousemove&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseout&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseout&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeypress&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeypress&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeydown&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeydown&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeyup&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeyup&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#events&quot;&gt;intrinsic events&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/present/graphics.html#adef-bgcolor&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;bgcolor&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/present/graphics.html#background-color&quot;&gt;background color&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-frame&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;frame&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-rules&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;rules&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-border-TABLE&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;border&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#borders&quot;&gt;borders and rules&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-cellspacing&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;cellspacing&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-cellpadding&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;cellpadding&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#margins&quot;&gt;cell margins&lt;/a&gt;) &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;
The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt; element contains all other elements that specify  caption, rows, content, and formatting.&lt;br /&gt;
&lt;br /&gt;
The following informative list describes what operations user agents may  carry out when rendering a table:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Make the table &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-summary&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;summary&lt;/samp&gt;&lt;/a&gt; available to the user. Authors should provide a  summary of a table&#39;s content and structure so that people using non-visual user  agents may better understand it.
&lt;li&gt;Render the caption, if one is defined.
&lt;li&gt;Render the table header, if one is specified. Render the table footer, if  one is specified. User agents must know where to render the header and footer.  For instance, if the output medium is paged, user agents may put the header at  the top of each page and the footer at the bottom. Similarly, if the user agent  provides a mechanism to scroll the rows, the header may appear at the top of the  scrolled area and the footer at the bottom.
&lt;li&gt;Calculate the &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#column-calc&quot;&gt;number of columns&lt;/a&gt; in the table. &lt;span class=&quot;index-inst&quot; title=&quot;table::number of rows|row::number of in table&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx-table&quot;&gt;Note that the number of rows in a table&lt;/a&gt;&lt;/span&gt; is equal to  the number of &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TR&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TR&lt;/samp&gt;&lt;/a&gt; elements contained by the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt; element.
&lt;li&gt;Group the columns according to any &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#colgroups&quot;&gt;column group&lt;/a&gt;  specifications.
&lt;li&gt;Render the cells, row by row and grouped in appropriate columns, between the  header and footer. Visual user agents should &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#visual-formatting&quot;&gt;format  the table&lt;/a&gt; according to HTML attributes and style sheet specification. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
The HTML table model has been designed so that, with author assistance, user  agents may render tables &lt;span class=&quot;index-inst&quot; title=&quot;table::incremental 
rendering of&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx-table-1&quot;&gt;&lt;em&gt;incrementally&lt;/em&gt;&lt;/a&gt;&lt;/span&gt; (i.e., as table rows arrive)  rather than having to wait for all the data before beginning to render.&lt;br /&gt;
&lt;br /&gt;
In order for a user agent to format a table in one pass, authors must tell  the user agent:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;The number of columns in the table. Please consult the section on &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#column-calc&quot;&gt;calculating the number of columns in a table&lt;/a&gt; for details  on how to supply this information.
&lt;li&gt;The widths of these columns. Please consult the section on &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#column-width&quot;&gt;calculating the width of columns&lt;/a&gt; for details on how to  supply this information. &lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
More precisely, a user agent may render a table in a single pass when the  column widths are specified using a combination of &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt;  elements. If any of the columns are specified in relative or percentage terms  (see the section on &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#column-width&quot;&gt;calculating the width of  columns&lt;/a&gt;), authors must also specify the width of the table itself.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;table-directionality&quot;&gt;Table directionality&lt;/a&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.2.1.1&quot;&gt; &lt;/a&gt;&lt;/h4&gt;
&lt;br /&gt;
The &lt;span class=&quot;index-inst&quot; title=&quot;table::directionality of|direction::of 
table information&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx-table-2&quot;&gt;directionality of a table&lt;/a&gt;&lt;/span&gt; is either the inherited  directionality (the default is left-to-right) or that specified by the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;dir&lt;/samp&gt;&lt;/a&gt;  attribute for the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt; element.&lt;br /&gt;
&lt;br /&gt;
For a left-to-right table, column zero is on the left side and row zero is at  the top. For a right-to-left table, column zero is on the right side and row  zero is at the top.&lt;br /&gt;
&lt;br /&gt;
When a user agent allots extra cells to a row (see the section on &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#column-calc&quot;&gt;calculating the number of columns in a table&lt;/a&gt;), extra row  cells are added to the right of the table for left-to-right tables and to the  left side for right-to-left tables.&lt;br /&gt;
&lt;br /&gt;
Note that &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt; is the only element on which &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;dir&lt;/samp&gt;&lt;/a&gt; reverses the  visual order of the columns; a single table row (&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TR&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TR&lt;/samp&gt;&lt;/a&gt;) or a group of  columns (&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt;) cannot be independently reversed.&lt;br /&gt;
&lt;br /&gt;
When set for the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt; element, the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;dir&lt;/samp&gt;&lt;/a&gt; attribute also  affects the direction of text within table cells (since the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;dir&lt;/samp&gt;&lt;/a&gt; attribute is  inherited by block-level elements).&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
To specify a right-to-left table, set the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;dir&lt;/samp&gt;&lt;/a&gt; attribute as  follows:&lt;br /&gt;
&lt;pre&gt;&lt;table dir=&quot;RTL&quot;&gt;
&lt;em&gt;...the rest of the table...&lt;/em&gt;
&lt;/table&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
The direction of text in individual cells can be changed by setting the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;dir&lt;/samp&gt;&lt;/a&gt;  attribute in an element that defines the cell. Please consult the section on &lt;a href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#bidirection&quot;&gt;bidirectional text&lt;/a&gt; for more information on  text direction issues.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.2.2&quot;&gt;11.2.2&lt;/a&gt; &lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;caption&quot;&gt;Table Captions:&lt;/a&gt; The &lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;edef-CAPTION&quot;&gt;&lt;samp class=&quot;edef&quot;&gt;CAPTION&lt;/samp&gt;&lt;/a&gt; element&lt;/h3&gt;
&lt;br /&gt;
&lt;div class=&quot;dtd-fragment&quot;&gt;
&lt;pre class=&quot;dtd-fragment&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;CAPTION&lt;/samp&gt;&lt;/pre&gt;
&lt;/div&gt;
- - (&lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#inline&quot;&gt;%inline;&lt;/a&gt;)*     -- table caption --&amp;gt;

%attrs;                              -- &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#coreattrs&quot;&gt;%coreattrs&lt;/a&gt;, &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#i18n&quot;&gt;%i18n&lt;/a&gt;, &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#events&quot;&gt;%events&lt;/a&gt; --
  &amp;gt;
&lt;br /&gt;
&lt;em&gt;Start tag: &lt;strong&gt;required&lt;/strong&gt;, End tag: &lt;strong&gt;required&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;adef-list&quot;&gt;
&lt;em&gt;Attribute definitions&lt;/em&gt;&lt;br /&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-align-CAPTION&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;align&lt;/samp&gt;&lt;/a&gt; = &lt;samp&gt;top|bottom|left|right&lt;/samp&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-insensitive&quot;&gt;[CI]&lt;/a&gt;&lt;dd&gt;&lt;a href=&quot;http://www.w3.org/TR/html401/conform.html#deprecated&quot;&gt;&lt;strong&gt;Deprecated.&lt;/strong&gt;&lt;/a&gt; For  visual user agents, this attribute specifies the position of the caption with  respect to the table. Possible values: &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;samp&gt;top:&lt;/samp&gt; The caption is at the top of the table. This is the  default value.
&lt;li&gt;&lt;samp&gt;bottom:&lt;/samp&gt; The caption is at the bottom of the table.
&lt;li&gt;&lt;samp&gt;left:&lt;/samp&gt; The caption is at the left of the table.
&lt;li&gt;&lt;samp&gt;right:&lt;/samp&gt; The caption is at the right of the table. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dl&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;aref-list&quot;&gt;
&lt;em&gt;Attributes defined elsewhere&lt;/em&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-id&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;id&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-class&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;class&lt;/samp&gt;&lt;/a&gt;  (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/global.html#id-and-class&quot;&gt;document-wide identifiers&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;lang&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#language-info&quot;&gt;language information&lt;/a&gt;), &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;dir&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#bidirection&quot;&gt;text direction&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-title&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;title&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/global.html#title&quot;&gt;element  title&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/present/styles.html#adef-style&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;style&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/present/styles.html#style-element&quot;&gt;inline style information&lt;/a&gt; )
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onclick&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onclick&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-ondblclick&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;ondblclick&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmousedown&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmousedown&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseup&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseup&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseover&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseover&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmousemove&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmousemove&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseout&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseout&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeypress&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeypress&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeydown&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeydown&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeyup&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeyup&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#events&quot;&gt;intrinsic events&lt;/a&gt; ) &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;
When present, the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-CAPTION&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;CAPTION&lt;/samp&gt;&lt;/a&gt; element&#39;s text should &lt;span class=&quot;index-inst&quot; title=&quot;table::caption for&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx-table-3&quot;&gt;describe the nature of the  table.&lt;/a&gt;&lt;/span&gt; The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-CAPTION&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;CAPTION&lt;/samp&gt;&lt;/a&gt; element is only permitted immediately after the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt;  start tag. A &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt; element may only contain one &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-CAPTION&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;CAPTION&lt;/samp&gt;&lt;/a&gt;  element.&lt;br /&gt;
&lt;br /&gt;
Visual user agents allow sighted people to quickly grasp the structure of the  table from the headings as well as the caption. A consequence of this is that  captions will often be inadequate as a summary of the purpose and structure of  the table from the perspective of people relying on non-visual user agents.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;index-inst&quot; title=&quot;table::summary of contents|summary::of table 
contents&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx-table-4&quot;&gt;Authors should therefore take care to provide  additional&lt;/a&gt;&lt;/span&gt; information summarizing the purpose and structure of the  table using the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-summary&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;summary&lt;/samp&gt;&lt;/a&gt; attribute of the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt; element. This  is especially important for tables without captions. Examples below illustrate  the use of the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-summary&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;summary&lt;/samp&gt;&lt;/a&gt; attribute.&lt;br /&gt;
&lt;br /&gt;
Visual user agents should avoid &lt;span class=&quot;index-inst&quot; title=&quot;clipping::table text&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx-clipping&quot;&gt;clipping&lt;/a&gt;&lt;/span&gt; any part  of the table including the caption, unless a means is provided to access all  parts, e.g., by horizontal or vertical scrolling. We recommend that the caption  text be wrapped to the same width as the table. (See also the section on &lt;a href=&quot;http://www.w3.org/TR/html401/appendix/notes.html#layout&quot;&gt;recommended layout algorithms&lt;/a&gt;.)&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.2.3&quot;&gt;11.2.3&lt;/a&gt; &lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;rowgroups&quot;&gt;Row groups:&lt;/a&gt; the &lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;edef-THEAD&quot;&gt;&lt;samp class=&quot;edef&quot;&gt;THEAD&lt;/samp&gt;&lt;/a&gt;, &lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;edef-TFOOT&quot;&gt;&lt;samp class=&quot;edef&quot;&gt;TFOOT&lt;/samp&gt;&lt;/a&gt;, and &lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;edef-TBODY&quot;&gt;&lt;samp class=&quot;edef&quot;&gt;TBODY&lt;/samp&gt;&lt;/a&gt; elements&lt;/h3&gt;
&lt;br /&gt;
&lt;div class=&quot;dtd-fragment&quot;&gt;
&lt;pre class=&quot;dtd-fragment&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;THEAD&lt;/samp&gt;&lt;/pre&gt;
&lt;/div&gt;
- O (TR)+           -- table header --&amp;gt;
&lt;samp class=&quot;einst&quot;&gt;TFOOT&lt;/samp&gt;    - O (TR)+           -- table footer --&amp;gt;
&lt;br /&gt;
&lt;em&gt;Start tag: &lt;strong&gt;required&lt;/strong&gt;, End tag: &lt;strong&gt;optional&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;dtd-fragment&quot;&gt;
&lt;pre class=&quot;dtd-fragment&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TBODY&lt;/samp&gt;&lt;/pre&gt;
&lt;/div&gt;
O O (TR)+           -- table body --&amp;gt;
&lt;br /&gt;
&lt;em&gt;Start tag: &lt;strong&gt;optional&lt;/strong&gt;, End tag: &lt;strong&gt;optional&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;dtd-fragment&quot;&gt;
&lt;pre class=&quot;dtd-fragment&quot;&gt;%attrs;&lt;/pre&gt;
&lt;/div&gt;
-- &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#coreattrs&quot;&gt;%coreattrs&lt;/a&gt;, &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#i18n&quot;&gt;%i18n&lt;/a&gt;, &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#events&quot;&gt;%events&lt;/a&gt; --
  &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#cellhalign&quot;&gt;%cellhalign;&lt;/a&gt;                         -- horizontal alignment in cells --
  &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#cellvalign&quot;&gt;%cellvalign;&lt;/a&gt;                         -- vertical alignment in cells --
  &amp;gt;
&lt;br /&gt;
&lt;div class=&quot;aref-list&quot;&gt;
&lt;em&gt;Attributes defined elsewhere&lt;/em&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-id&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;id&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-class&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;class&lt;/samp&gt;&lt;/a&gt;  (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/global.html#id-and-class&quot;&gt;document-wide identifiers&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;lang&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#language-info&quot;&gt;language information&lt;/a&gt;), &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;dir&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#bidirection&quot;&gt;text direction&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-title&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;title&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/global.html#title&quot;&gt;element  title&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/present/styles.html#adef-style&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;style&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/present/styles.html#style-element&quot;&gt;inline style information&lt;/a&gt; )
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onclick&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onclick&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-ondblclick&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;ondblclick&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmousedown&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmousedown&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseup&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseup&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseover&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseover&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmousemove&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmousemove&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseout&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseout&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeypress&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeypress&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeydown&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeydown&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeyup&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeyup&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#events&quot;&gt;intrinsic events&lt;/a&gt; )
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-align-TD&quot;&gt;&lt;samp class=&quot;ainst-TD&quot;&gt;align&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-char&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;char&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-charoff&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;charoff&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-valign&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;valign&lt;/samp&gt;&lt;/a&gt;  (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#alignment&quot;&gt;cell alignment&lt;/a&gt;) &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span class=&quot;index-inst&quot; title=&quot;row group|table::row group in&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx-row_group&quot;&gt;Table rows may be grouped&lt;/a&gt;&lt;/span&gt; into a table head, table  foot, and one or more table body sections, using the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-THEAD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;THEAD&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TFOOT&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TFOOT&lt;/samp&gt;&lt;/a&gt;  and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TBODY&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TBODY&lt;/samp&gt;&lt;/a&gt; elements, respectively. This division enables user  agents to support scrolling of table bodies independently of the table head and  foot. When long tables are printed, the table head and foot information may be  repeated on each page that contains table data.&lt;br /&gt;
&lt;br /&gt;
The table head and table foot should contain information about the table&#39;s  columns. The table body should contain rows of table data.&lt;br /&gt;
&lt;br /&gt;
When present, each &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-THEAD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;THEAD&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TFOOT&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TFOOT&lt;/samp&gt;&lt;/a&gt;, and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TBODY&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TBODY&lt;/samp&gt;&lt;/a&gt;  contains a &lt;em&gt;row group&lt;/em&gt;. Each row group must contain at least one row,  defined by the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TR&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TR&lt;/samp&gt;&lt;/a&gt; element.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
This example illustrates the order and structure of table heads, feet, and  bodies.&lt;br /&gt;
&lt;pre&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt; &lt;em&gt;...header information...&lt;/em&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tfoot&gt;
&lt;tr&gt; &lt;em&gt;...footer information...&lt;/em&gt;
&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;tbody&gt;
&lt;tr&gt; &lt;em&gt;...first row of block one data...&lt;/em&gt;
&lt;tr&gt; &lt;em&gt;...second row of block one data...&lt;/em&gt;
&lt;/tr&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;tbody&gt;
&lt;tr&gt; &lt;em&gt;...first row of block two data...&lt;/em&gt;
&lt;tr&gt; &lt;em&gt;...second row of block two data...&lt;/em&gt;
&lt;tr&gt; &lt;em&gt;...third row of block two data...&lt;/em&gt;
&lt;/tr&gt;
&lt;/tr&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TFOOT&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TFOOT&lt;/samp&gt;&lt;/a&gt; must appear before &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TBODY&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TBODY&lt;/samp&gt;&lt;/a&gt; within a &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt;  definition so that user agents can render the foot before receiving all of the  (potentially numerous) rows of data. The following summarizes which tags are  required and which may be omitted:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TBODY&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TBODY&lt;/samp&gt;&lt;/a&gt; start tag is always required except when the table  contains only one table body and no table head or foot sections. The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TBODY&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TBODY&lt;/samp&gt;&lt;/a&gt;  end tag may always be safely omitted.
&lt;li&gt;The start tags for &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-THEAD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;THEAD&lt;/samp&gt;&lt;/a&gt; and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TFOOT&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TFOOT&lt;/samp&gt;&lt;/a&gt; are required  when the table head and foot sections are present respectively, but the  corresponding end tags may always be safely omitted. &lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Conforming user agent parsers must obey these rules for reasons of backward  compatibility.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
The table of the previous example could be shortened by removing certain end  tags, as in:&lt;br /&gt;
&lt;pre&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt; &lt;em&gt;...header information...&lt;/em&gt;
&lt;tfoot&gt;
&lt;tr&gt; &lt;em&gt;...footer information...&lt;/em&gt;
&lt;tbody&gt;
&lt;tr&gt; &lt;em&gt;...first row of block one data...&lt;/em&gt;
&lt;tr&gt; &lt;em&gt;...second row of block one data...&lt;/em&gt;
&lt;tbody&gt;
&lt;tr&gt; &lt;em&gt;...first row of block two data...&lt;/em&gt;
&lt;tr&gt; &lt;em&gt;...second row of block two data...&lt;/em&gt;
&lt;tr&gt; &lt;em&gt;...third row of block two data...&lt;/em&gt;
&lt;/tr&gt;
&lt;/tr&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/tr&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/tr&gt;
&lt;/tfoot&gt;&lt;/tr&gt;
&lt;/thead&gt;&lt;/table&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-THEAD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;THEAD&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TFOOT&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TFOOT&lt;/samp&gt;&lt;/a&gt;, and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TBODY&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TBODY&lt;/samp&gt;&lt;/a&gt;  sections must contain the same number of columns.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.2.4&quot;&gt;11.2.4&lt;/a&gt; &lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;colgroups&quot;&gt;Column groups:&lt;/a&gt; the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; elements&lt;/h3&gt;
&lt;br /&gt;
&lt;span class=&quot;index-inst&quot; title=&quot;column group|table::column group in&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx-column_group&quot;&gt;Column groups&lt;/a&gt;&lt;/span&gt; allow authors to create  structural divisions within a table. Authors may highlight this structure  through style sheets or HTML attributes (e.g., the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-rules&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;rules&lt;/samp&gt;&lt;/a&gt; attribute  for the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt; element). For an example of the visual presentation  of column groups, please consult the &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#sample&quot;&gt;sample table&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
A table may either contain a single implicit column group (no &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; element  delimits the columns) or any number of explicit column groups (each delimited by  an instance of the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; element).&lt;br /&gt;
&lt;br /&gt;
The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; element allows authors to share attributes among  several columns without implying any structural grouping. The &quot;span&quot; of the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt;  element is the number of columns that will share the element&#39;s attributes.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
The &lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;edef-COLGROUP&quot;&gt;&lt;samp class=&quot;edef&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; element&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.2.4.1&quot;&gt; &lt;/a&gt;&lt;/h4&gt;
&lt;br /&gt;
&lt;div class=&quot;dtd-fragment&quot;&gt;
&lt;pre class=&quot;dtd-fragment&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/pre&gt;
&lt;/div&gt;
- O (COL)*          -- table column group --&amp;gt;
%attrs;                              -- &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#coreattrs&quot;&gt;%coreattrs&lt;/a&gt;, &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#i18n&quot;&gt;%i18n&lt;/a&gt;, &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#events&quot;&gt;%events&lt;/a&gt; --
  &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-span-COLGROUP&quot;&gt;&lt;samp class=&quot;ainst-COLGROUP&quot;&gt;span&lt;/samp&gt;&lt;/a&gt;        &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-number&quot;&gt;NUMBER&lt;/a&gt;         1         -- default number of columns in group --
  &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-width-COLGROUP&quot;&gt;&lt;samp class=&quot;ainst-COLGROUP&quot;&gt;width&lt;/samp&gt;&lt;/a&gt;       &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#MultiLength&quot;&gt;%MultiLength;&lt;/a&gt;  #IMPLIED  -- default width for enclosed COLs --
  &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#cellhalign&quot;&gt;%cellhalign;&lt;/a&gt;                         -- horizontal alignment in cells --
  &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#cellvalign&quot;&gt;%cellvalign;&lt;/a&gt;                         -- vertical alignment in cells --
  &amp;gt;
&lt;br /&gt;
&lt;em&gt;Start tag: &lt;strong&gt;required&lt;/strong&gt;, End tag: &lt;strong&gt;optional&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;adef-list&quot;&gt;
&lt;em&gt;Attribute definitions&lt;/em&gt;&lt;br /&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-span-COLGROUP&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;span&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-number&quot;&gt;&lt;em&gt;number&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-neutral&quot;&gt;[CN]&lt;/a&gt;&lt;dd&gt;This attribute, which must be an integer &amp;gt; 0, specifies the number of  columns in a column group. Values mean the following: &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;In the absence of a &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-span-COLGROUP&quot;&gt;&lt;samp class=&quot;ainst-COLGROUP&quot;&gt;span&lt;/samp&gt;&lt;/a&gt;  attribute, each &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; defines a column group containing one column.
&lt;li&gt;If the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-span-COLGROUP&quot;&gt;&lt;samp class=&quot;ainst-COLGROUP&quot;&gt;span&lt;/samp&gt;&lt;/a&gt; attribute is set to N &amp;gt; 0, the current &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; element defines a column group containing N  columns. &lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
User agents must ignore this attribute if the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; element  contains one or more &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; elements.&lt;br /&gt;
&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-width-COLGROUP&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;width&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-multi-length&quot;&gt;&lt;em&gt;multi-length&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-neutral&quot;&gt;[CN]&lt;/a&gt;&lt;dd&gt;This attribute specifies a default width for each column in the current  column group. In addition to the standard pixel, percentage, and relative  values, this attribute allows the special form &quot;0*&quot; (zero asterisk) which means  that the width of the each column in the group should be the minimum width  necessary to hold the column&#39;s contents. This implies that a column&#39;s entire  contents must be known before its width may be correctly computed. Authors  should be aware that specifying &quot;0*&quot; will prevent visual user agents from  rendering a table incrementally.&lt;br /&gt;
This attribute is overridden for any column in the column group whose &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-width-COL&quot;&gt;&lt;samp class=&quot;ainst-COL&quot;&gt;width&lt;/samp&gt;&lt;/a&gt; is specified via a &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt;  element.&lt;/dd&gt;&lt;br /&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dl&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;aref-list&quot;&gt;
&lt;em&gt;Attributes defined elsewhere&lt;/em&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-id&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;id&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-class&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;class&lt;/samp&gt;&lt;/a&gt;  (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/global.html#id-and-class&quot;&gt;document-wide identifiers&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;lang&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#language-info&quot;&gt;language information&lt;/a&gt;), &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;dir&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#bidirection&quot;&gt;text direction&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-title&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;title&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/global.html#title&quot;&gt;element  title&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/present/styles.html#adef-style&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;style&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/present/styles.html#style-element&quot;&gt;inline style information&lt;/a&gt; )
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onclick&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onclick&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-ondblclick&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;ondblclick&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmousedown&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmousedown&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseup&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseup&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseover&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseover&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmousemove&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmousemove&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseout&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseout&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeypress&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeypress&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeydown&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeydown&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeyup&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeyup&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#events&quot;&gt;intrinsic events&lt;/a&gt; )
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-align-TD&quot;&gt;&lt;samp class=&quot;ainst-TD&quot;&gt;align&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-char&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;char&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-charoff&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;charoff&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-valign&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;valign&lt;/samp&gt;&lt;/a&gt;  (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#alignment&quot;&gt;cell alignment&lt;/a&gt;) &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;
The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; element creates an explicit column group. The  number of columns in the column group may be specified in two, mutually  exclusive ways:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;The element&#39;s &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-span-COLGROUP&quot;&gt;&lt;samp class=&quot;ainst-COLGROUP&quot;&gt;span&lt;/samp&gt;&lt;/a&gt; attribute (default value 1) specifies the  number of columns in the group.
&lt;li&gt;Each &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; element in the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt;  represents one or more columns in the group. &lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
The advantage of using the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-span-COLGROUP&quot;&gt;&lt;samp class=&quot;ainst-COLGROUP&quot;&gt;span&lt;/samp&gt;&lt;/a&gt;  attribute is that authors may group together information about column widths.  Thus, if a table contains forty columns, all of which have a width of 20 pixels,  it is easier to write:&lt;br /&gt;
&lt;pre class=&quot;example&quot;&gt;   &lt;colgroup span=&quot;40&quot; width=&quot;20&quot;&gt;
   &lt;/colgroup&gt;
&lt;/pre&gt;
&lt;br /&gt;
than:&lt;br /&gt;
&lt;pre class=&quot;example&quot;&gt;   &lt;colgroup&gt;
      &lt;col width=&quot;20&quot;&gt;&lt;/col&gt;
      &lt;col width=&quot;20&quot;&gt;&lt;/col&gt;
      &lt;em&gt;...a total of forty COL elements...&lt;/em&gt;
   &lt;/colgroup&gt;
&lt;/pre&gt;
&lt;br /&gt;
When it is necessary to single out a column (e.g., for style information, to  specify width information, etc.) within a group, authors must identify that  column with a &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; element. Thus, to apply special style information to  the last column of the previous table, we single it out as follows:&lt;br /&gt;
&lt;pre class=&quot;example&quot;&gt;   &lt;colgroup width=&quot;20&quot;&gt;
      &lt;col span=&quot;39&quot;&gt;&lt;/col&gt;
      &lt;col id=&quot;format-me-specially&quot;&gt;&lt;/col&gt;
   &lt;/colgroup&gt;
&lt;/pre&gt;
&lt;br /&gt;
The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-width-COLGROUP&quot;&gt;&lt;samp class=&quot;ainst-COLGROUP&quot;&gt;width&lt;/samp&gt;&lt;/a&gt; attribute of the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; element  is inherited by all 40 columns. The first &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; element refers to  the first 39 columns (doing nothing special to them) and the second one assigns  an &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-id&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;id&lt;/samp&gt;&lt;/a&gt;  value to the fortieth column so that style sheets may refer to it.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
The table in the following example contains two column groups. The first  column group contains 10 columns and the second contains 5 columns. The default  width for each column in the first column group is 50 pixels. The width of each  column in the second column group will be the minimum required for that  column.&lt;br /&gt;
&lt;pre&gt;&lt;table&gt;
&lt;colgroup span=&quot;10&quot; width=&quot;50&quot;&gt;
&lt;colgroup span=&quot;5&quot; width=&quot;0*&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;td&gt; &lt;em&gt;...&lt;/em&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/thead&gt;&lt;/colgroup&gt;&lt;/colgroup&gt;&lt;/table&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h4&gt;
The &lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;edef-COL&quot;&gt;&lt;samp class=&quot;edef&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; element&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.2.4.2&quot;&gt; &lt;/a&gt;&lt;/h4&gt;
&lt;br /&gt;
&lt;div class=&quot;dtd-fragment&quot;&gt;
&lt;pre class=&quot;dtd-fragment&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/pre&gt;
&lt;/div&gt;
- O EMPTY           -- table column --&amp;gt;
%attrs;                              -- &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#coreattrs&quot;&gt;%coreattrs&lt;/a&gt;, &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#i18n&quot;&gt;%i18n&lt;/a&gt;, &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#events&quot;&gt;%events&lt;/a&gt; --
  &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-span-COL&quot;&gt;&lt;samp class=&quot;ainst-COL&quot;&gt;span&lt;/samp&gt;&lt;/a&gt;        &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-number&quot;&gt;NUMBER&lt;/a&gt;         1         -- COL attributes affect N columns --
  &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-width-COL&quot;&gt;&lt;samp class=&quot;ainst-COL&quot;&gt;width&lt;/samp&gt;&lt;/a&gt;       &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#MultiLength&quot;&gt;%MultiLength;&lt;/a&gt;  #IMPLIED  -- column width specification --
  &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#cellhalign&quot;&gt;%cellhalign;&lt;/a&gt;                         -- horizontal alignment in cells --
  &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#cellvalign&quot;&gt;%cellvalign;&lt;/a&gt;                         -- vertical alignment in cells --
  &amp;gt;
&lt;br /&gt;
&lt;em&gt;Start tag: &lt;strong&gt;required&lt;/strong&gt;, End tag: &lt;strong&gt;forbidden&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;adef-list&quot;&gt;
&lt;em&gt;Attribute definitions&lt;/em&gt;&lt;br /&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-span-COL&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;span&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-number&quot;&gt;&lt;em&gt;number&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-neutral&quot;&gt;[CN]&lt;/a&gt;&lt;dd&gt;This attribute, whose value must be an integer &amp;gt; 0, specifies the number  of columns &quot;spanned&quot; by the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; element; the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; element shares its  attributes with all the columns it spans. The default value for this attribute  is 1 (i.e., the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; element refers to a single column). If the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-span-COL&quot;&gt;&lt;samp class=&quot;ainst-COL&quot;&gt;span&lt;/samp&gt;&lt;/a&gt; attribute is set to N &amp;gt; 1, the current &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt;  element shares its attributes with the next N-1 columns.&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-width-COL&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;width&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-multi-length&quot;&gt;&lt;em&gt;multi-length&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-neutral&quot;&gt;[CN]&lt;/a&gt;&lt;dd&gt;This attribute specifies a default width for each column spanned by the  current &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; element. It has the same meaning as the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-width-COLGROUP&quot;&gt;&lt;samp class=&quot;ainst-COLGROUP&quot;&gt;width&lt;/samp&gt;&lt;/a&gt; attribute for the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; element  and overrides it. &lt;/dd&gt;&lt;br /&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dl&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;aref-list&quot;&gt;
&lt;em&gt;Attributes defined elsewhere&lt;/em&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-id&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;id&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-class&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;class&lt;/samp&gt;&lt;/a&gt;  (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/global.html#id-and-class&quot;&gt;document-wide identifiers&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;lang&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#language-info&quot;&gt;language information&lt;/a&gt;), &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;dir&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#bidirection&quot;&gt;text direction&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-title&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;title&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/global.html#title&quot;&gt;element  title&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/present/styles.html#adef-style&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;style&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/present/styles.html#style-element&quot;&gt;inline style information&lt;/a&gt; )
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onclick&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onclick&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-ondblclick&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;ondblclick&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmousedown&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmousedown&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseup&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseup&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseover&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseover&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmousemove&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmousemove&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseout&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseout&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeypress&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeypress&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeydown&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeydown&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeyup&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeyup&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#events&quot;&gt;intrinsic events&lt;/a&gt; )
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-align-TD&quot;&gt;&lt;samp class=&quot;ainst-TD&quot;&gt;align&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-char&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;char&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-charoff&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;charoff&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-valign&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;valign&lt;/samp&gt;&lt;/a&gt;  (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#alignment&quot;&gt;cell alignment&lt;/a&gt;) &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;
The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; element allows authors to group together attribute  specifications for table columns. The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; does &lt;strong&gt;not&lt;/strong&gt; group columns together structurally -- that is the role of  the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; element. &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; elements are empty  and serve only as a support for attributes. They may appear inside or outside an  explicit column group (i.e., &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt;  element).&lt;br /&gt;
&lt;br /&gt;
The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-width-COL&quot;&gt;&lt;samp class=&quot;ainst-COL&quot;&gt;width&lt;/samp&gt;&lt;/a&gt; attribute for &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; refers to the width  of each column in the element&#39;s span.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
&lt;span class=&quot;index-inst&quot; title=&quot;column::number of in a table|table::number 
of columns&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;column-calc&quot;&gt;Calculating the number of columns in a table&lt;/a&gt;&lt;/span&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.2.4.3&quot;&gt; &lt;/a&gt;&lt;/h4&gt;
&lt;br /&gt;
There are two ways to determine the number of columns in a table (in order of  precedence):&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;If the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt; element contains any &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; or &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt;  elements, user agents should calculate the number of columns by summing the  following: &lt;ul&gt;
&lt;li&gt;For each &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; element, take the value of its &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-span-COL&quot;&gt;&lt;samp class=&quot;ainst-COL&quot;&gt;span&lt;/samp&gt;&lt;/a&gt; attribute  (default value 1).
&lt;li&gt;For each &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; element containing at least one &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; element, ignore the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-span-COLGROUP&quot;&gt;&lt;samp class=&quot;ainst-COLGROUP&quot;&gt;span&lt;/samp&gt;&lt;/a&gt; attribute for the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; element.  For each &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; element, perform the calculation of step 1.
&lt;li&gt;For each empty &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; element, take the value of its &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-span-COLGROUP&quot;&gt;&lt;samp class=&quot;ainst-COLGROUP&quot;&gt;span&lt;/samp&gt;&lt;/a&gt;  attribute (default value 1). &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Otherwise, if the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt; element contains no &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; or &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt;  elements, user agents should base the number of columns on what is required by  the rows. The number of columns is equal to the number of columns required by  the row with the most columns, including cells that span multiple columns. For  any row that has fewer than this number of columns, the end of that row should  be padded with empty cells. The &quot;end&quot; of a row depends on the &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#table-directionality&quot;&gt;table directionality&lt;/a&gt;. &lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
It is an error if a table contains &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; or &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt;  elements and the two calculations do not result in the same number of  columns.&lt;br /&gt;
&lt;br /&gt;
Once the user agent has calculated the number of columns in the table, it may  group them into &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#colgroups&quot;&gt;column groups.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
For example, for each of the following tables, the two column calculation  methods should result in three columns. The first three tables may be rendered  incrementally.&lt;br /&gt;
&lt;pre&gt;&lt;table&gt;
&lt;colgroup span=&quot;3&quot;&gt;&lt;/colgroup&gt;
&lt;tr&gt;&lt;td&gt; &lt;em&gt;...&lt;/em&gt;
&lt;em&gt;...rows...&lt;/em&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col&gt;&lt;/col&gt;
&lt;col span=&quot;2&quot;&gt;&lt;/col&gt;
&lt;/colgroup&gt;
&lt;tr&gt;&lt;td&gt; &lt;em&gt;...&lt;/em&gt;
&lt;em&gt;...rows...&lt;/em&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col&gt;&lt;/col&gt;
&lt;/colgroup&gt;
&lt;colgroup span=&quot;2&quot;&gt;
&lt;tr&gt;&lt;td&gt; &lt;em&gt;...&lt;/em&gt;
&lt;em&gt;...rows...&lt;/em&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/colgroup&gt;&lt;/table&gt;
&lt;table&gt;
&lt;tr&gt;
  &lt;td&gt;&lt;td&gt;&lt;td&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h4&gt;
&lt;span class=&quot;index-inst&quot; title=&quot;column::width of in a table|table::width of 
columns&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;column-width&quot;&gt;Calculating the width of columns&lt;/a&gt;&lt;/span&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.2.4.4&quot;&gt; &lt;/a&gt;&lt;/h4&gt;
&lt;br /&gt;
Authors may specify column widths in three ways:&lt;br /&gt;
&lt;br /&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;strong&gt;Fixed&lt;/strong&gt;&lt;dd&gt;A fixed width specification is given in pixels (e.g., &lt;samp class=&quot;ainst&quot;&gt;width&lt;/samp&gt;=&quot;30&quot;). A fixed-width specification enables incremental  rendering.&lt;br /&gt;
&lt;dt&gt;&lt;strong&gt;Percentage&lt;/strong&gt;&lt;dd&gt;A percentage specification (e.g., &lt;samp class=&quot;ainst&quot;&gt;width&lt;/samp&gt;=&quot;20%&quot;) is  based on the percentage of the horizontal space available to the table (between  the current left and right margins, including floats). Note that this space does  not depend on the table itself, and thus percentage specifications enable  incremental rendering.&lt;br /&gt;
&lt;dt&gt;&lt;strong&gt;Proportional&lt;/strong&gt;&lt;dd&gt;Proportional specifications (e.g., &lt;samp class=&quot;ainst&quot;&gt;width&lt;/samp&gt;=&quot;3*&quot;)  refer to portions of the horizontal space &lt;em&gt;required&lt;/em&gt; by a table. If the  table width is given a fixed value via the &lt;samp class=&quot;ainst&quot;&gt;width&lt;/samp&gt;  attribute of the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt; element, user agents may render the table  incrementally even with proportional columns.  However, if the table does not have a fixed width, user agents must receive  all table data before they can determine the horizontal space required by the  table. Only then may this space be allotted to proportional  columns.&lt;/dd&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dl&gt;
&lt;br /&gt;
If an author specifies no width information for a column, a user agent may  not be able to incrementally format the table since it must wait for the entire  column of data to arrive in order to allot an appropriate width.&lt;br /&gt;
&lt;br /&gt;
If column widths prove to be too narrow for the contents of a particular  table cell, user agents may choose to reflow the table.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
The table in this example contains six columns. The first one does not belong  to an explicit column group. The next three belong to the first explicit column  group and the last two belong to the second explicit column group. This table  cannot be formatted incrementally since it contains proportional column width  specifications and no value for the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-width-TABLE&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;width&lt;/samp&gt;&lt;/a&gt;  attribute for the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt; element.&lt;br /&gt;
Once the (visual) user agent has received the table&#39;s data: the available  horizontal space will be alloted by the user agent as follows: First the user  agent will allot 30 pixels to columns one and two. Then, the minimal space  required for the third column will be reserved. The remaining horizontal space  will be divided into six equal portions (since 2* + 1* + 3* = 6 portions).  Column four (2*) will receive two of these portions, column five (1*) will  receive one, and column six (3*) will receive three.&lt;br /&gt;
&lt;pre&gt;    
&lt;table&gt;
&lt;colgroup&gt;
   &lt;col width=&quot;30&quot;&gt;&lt;/col&gt;
&lt;colgroup&gt;
   &lt;col width=&quot;30&quot;&gt;&lt;/col&gt;
   &lt;col width=&quot;0*&quot;&gt;&lt;/col&gt;
   &lt;col width=&quot;2*&quot;&gt;&lt;/col&gt;
&lt;colgroup align=&quot;center&quot;&gt;
   &lt;col width=&quot;1*&quot;&gt;&lt;/col&gt;
   &lt;col align=&quot;char&quot; char=&quot;:&quot; width=&quot;3*&quot;&gt;&lt;/col&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;td&gt; &lt;em&gt;...&lt;/em&gt;
&lt;em&gt;...rows...&lt;/em&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/thead&gt;&lt;/colgroup&gt;&lt;/colgroup&gt;&lt;/colgroup&gt;&lt;/table&gt;
&lt;/pre&gt;
We have set the value of the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-align-TD&quot;&gt;&lt;samp class=&quot;ainst-TD&quot;&gt;align&lt;/samp&gt;&lt;/a&gt; attribute  in the third column group to &quot;center&quot;. All cells in every column in this group  will inherit this value, but may override it. In fact, the final &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; does just that, by  specifying that every cell in the column it governs will be aligned along the  &quot;:&quot; character.&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
In the following table, the column width specifications allow the user agent  to format the table incrementally:&lt;br /&gt;
&lt;pre&gt;    
&lt;table style=&quot;width: 200px;&quot;&gt;
&lt;colgroup span=&quot;10&quot; width=&quot;15&quot;&gt;
&lt;colgroup width=&quot;*&quot;&gt;
   &lt;col id=&quot;penultimate-column&quot;&gt;&lt;/col&gt;
   &lt;col id=&quot;last-column&quot;&gt;&lt;/col&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;td&gt; &lt;em&gt;...&lt;/em&gt;
&lt;em&gt;...rows...&lt;/em&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/thead&gt;&lt;/colgroup&gt;&lt;/colgroup&gt;&lt;/table&gt;
&lt;/pre&gt;
The first ten columns will be 15 pixels wide each. The last two columns will  each receive half of the remaining 50 pixels. Note that the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; elements appear  only so that an &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-id&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;id&lt;/samp&gt;&lt;/a&gt; value may be specified for the last two  columns.&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
&lt;em&gt;&lt;strong&gt;Note.&lt;/strong&gt; Although the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-width-TABLE&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;width&lt;/samp&gt;&lt;/a&gt;  attribute on the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt; element is not deprecated, authors are encouraged  to use style sheets to specify table widths.&lt;/em&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.2.5&quot;&gt;11.2.5&lt;/a&gt; &lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;rows&quot;&gt;Table rows:&lt;/a&gt; The &lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;edef-TR&quot;&gt;&lt;samp class=&quot;edef&quot;&gt;TR&lt;/samp&gt;&lt;/a&gt; element&lt;/h3&gt;
&lt;br /&gt;
&lt;div class=&quot;dtd-fragment&quot;&gt;
&lt;pre class=&quot;dtd-fragment&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TR&lt;/samp&gt;&lt;/pre&gt;
&lt;/div&gt;
- O (TH|TD)+        -- table row --&amp;gt;
%attrs;                              -- &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#coreattrs&quot;&gt;%coreattrs&lt;/a&gt;, &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#i18n&quot;&gt;%i18n&lt;/a&gt;, &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#events&quot;&gt;%events&lt;/a&gt; --
  &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#cellhalign&quot;&gt;%cellhalign;&lt;/a&gt;                         -- horizontal alignment in cells --
  &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#cellvalign&quot;&gt;%cellvalign;&lt;/a&gt;                         -- vertical alignment in cells --
  &amp;gt;
&lt;br /&gt;
&lt;em&gt;Start tag: &lt;strong&gt;required&lt;/strong&gt;, End tag: &lt;strong&gt;optional&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;aref-list&quot;&gt;
&lt;em&gt;Attributes defined elsewhere&lt;/em&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-id&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;id&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-class&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;class&lt;/samp&gt;&lt;/a&gt;  (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/global.html#id-and-class&quot;&gt;document-wide identifiers&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;lang&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#language-info&quot;&gt;language information&lt;/a&gt;), &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;dir&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#bidirection&quot;&gt;text direction&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-title&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;title&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/global.html#title&quot;&gt;element  title&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/present/styles.html#adef-style&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;style&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/present/styles.html#style-element&quot;&gt;inline style information&lt;/a&gt; )
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onclick&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onclick&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-ondblclick&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;ondblclick&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmousedown&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmousedown&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseup&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseup&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseover&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseover&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmousemove&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmousemove&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseout&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseout&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeypress&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeypress&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeydown&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeydown&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeyup&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeyup&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#events&quot;&gt;intrinsic events&lt;/a&gt; )
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/present/graphics.html#adef-bgcolor&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;bgcolor&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/present/graphics.html#background-color&quot;&gt;background color&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-align-TD&quot;&gt;&lt;samp class=&quot;ainst-TD&quot;&gt;align&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-char&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;char&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-charoff&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;charoff&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-valign&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;valign&lt;/samp&gt;&lt;/a&gt;  (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#alignment&quot;&gt;cell alignment&lt;/a&gt;) &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;
The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TR&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TR&lt;/samp&gt;&lt;/a&gt; elements acts as a container for a row of table cells.  The end tag may be omitted.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
This sample table contains three rows, each begun by the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TR&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TR&lt;/samp&gt;&lt;/a&gt; element:&lt;br /&gt;
&lt;pre&gt;&lt;table summary=&quot;This table charts the number of cups
                   of coffee consumed by each senator, the type 
                   of coffee (decaf or regular), and whether 
                   taken with sugar.&quot;&gt;
&lt;caption&gt;Cups of coffee consumed by each senator&lt;/caption&gt;
&lt;tr&gt; &lt;em&gt;...A header row...&lt;/em&gt;
&lt;tr&gt; &lt;em&gt;...First row of data...&lt;/em&gt;
&lt;tr&gt; &lt;em&gt;...Second row of data...&lt;/em&gt;
&lt;em&gt;...the rest of the table...&lt;/em&gt;
&lt;/tr&gt;
&lt;/tr&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.2.6&quot;&gt;11.2.6&lt;/a&gt; &lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;cells&quot;&gt;Table cells:&lt;/a&gt; The &lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;edef-TH&quot;&gt;&lt;samp class=&quot;edef&quot;&gt;TH&lt;/samp&gt;&lt;/a&gt; and &lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;edef-TD&quot;&gt;&lt;samp class=&quot;edef&quot;&gt;TD&lt;/samp&gt;&lt;/a&gt; elements&lt;/h3&gt;
&lt;br /&gt;
&lt;div class=&quot;dtd-fragment&quot;&gt;
&lt;pre class=&quot;dtd-fragment&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TH&lt;/samp&gt;&lt;/pre&gt;
&lt;/div&gt;
|&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TD&lt;/samp&gt;&lt;/a&gt;)  - O (&lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#flow&quot;&gt;%flow;&lt;/a&gt;)*       -- table header cell, table data cell--&amp;gt;

&lt;!-- Scope is simpler than headers attribute for common tables --&gt;


&lt;!-- TH is for headers, TD for data, but for cells acting as both use TD --&gt;
%attrs;                              -- &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#coreattrs&quot;&gt;%coreattrs&lt;/a&gt;, &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#i18n&quot;&gt;%i18n&lt;/a&gt;, &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#events&quot;&gt;%events&lt;/a&gt; --
  &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-abbr&quot;&gt;&lt;samp class=&quot;ainst-TH&quot;&gt;abbr&lt;/samp&gt;&lt;/a&gt;        &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#Text&quot;&gt;%Text;&lt;/a&gt;         #IMPLIED  -- abbreviation for header cell --
  &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-axis&quot;&gt;&lt;samp class=&quot;ainst-TH&quot;&gt;axis&lt;/samp&gt;&lt;/a&gt;        &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-cdata&quot;&gt;CDATA&lt;/a&gt;          #IMPLIED  -- comma-separated list of related headers--
  &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-headers&quot;&gt;&lt;samp class=&quot;ainst-TH&quot;&gt;headers&lt;/samp&gt;&lt;/a&gt;     &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-idrefs&quot;&gt;IDREFS&lt;/a&gt;         #IMPLIED  -- list of id&#39;s for header cells --
  &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-scope&quot;&gt;&lt;samp class=&quot;ainst-TH&quot;&gt;scope&lt;/samp&gt;&lt;/a&gt;       &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#Scope&quot;&gt;%Scope;&lt;/a&gt;        #IMPLIED  -- scope covered by header cells --
  &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-rowspan&quot;&gt;&lt;samp class=&quot;ainst-TH&quot;&gt;rowspan&lt;/samp&gt;&lt;/a&gt;     &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-number&quot;&gt;NUMBER&lt;/a&gt;         1         -- number of rows spanned by cell --
  &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-colspan&quot;&gt;&lt;samp class=&quot;ainst-TH&quot;&gt;colspan&lt;/samp&gt;&lt;/a&gt;     &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-number&quot;&gt;NUMBER&lt;/a&gt;         1         -- number of cols spanned by cell --
  &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#cellhalign&quot;&gt;%cellhalign;&lt;/a&gt;                         -- horizontal alignment in cells --
  &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#cellvalign&quot;&gt;%cellvalign;&lt;/a&gt;                         -- vertical alignment in cells --
  &amp;gt;
&lt;br /&gt;
&lt;em&gt;Start tag: &lt;strong&gt;required&lt;/strong&gt;, End tag: &lt;strong&gt;optional&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;adef-list&quot;&gt;
&lt;em&gt;Attribute definitions&lt;/em&gt;&lt;br /&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-headers&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;headers&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-idrefs&quot;&gt;&lt;em&gt;idrefs&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-sensitive&quot;&gt;[CS]&lt;/a&gt;&lt;dd&gt;This attribute specifies the list of header cells that provide header  information for the current data cell. The value of this attribute is a  space-separated list of cell names; those cells must be named by setting their &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-id&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;id&lt;/samp&gt;&lt;/a&gt;  attribute. Authors generally use the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-headers&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;headers&lt;/samp&gt;&lt;/a&gt; attribute  to help non-visual user agents render header information about data cells (e.g.,  header information is spoken prior to the cell data), but the attribute may also  be used in conjunction with style sheets. See also the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-scope&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;scope&lt;/samp&gt;&lt;/a&gt; attribute.&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-scope&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;scope&lt;/samp&gt;&lt;/a&gt; = &lt;em&gt;scope-name&lt;/em&gt;&lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-insensitive&quot;&gt;[CI]&lt;/a&gt;&lt;dd&gt;This attribute specifies the set of data cells for which the current header  cell provides header information. This attribute may be used in place of the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-headers&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;headers&lt;/samp&gt;&lt;/a&gt; attribute, particularly for simple tables. When  specified, this attribute must have one of the following values: &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;row:&lt;/strong&gt; The current cell provides header information for the  rest of the row that contains it (see also the section on &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#table-directionality&quot;&gt;table directionality&lt;/a&gt;).
&lt;li&gt;&lt;strong&gt;col:&lt;/strong&gt; The current cell provides header information for the  rest of the column that contains it.
&lt;li&gt;&lt;strong&gt;rowgroup:&lt;/strong&gt; The header cell provides header information for  the rest of the &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#rowgroups&quot;&gt;row group&lt;/a&gt; that contains it.
&lt;li&gt;&lt;strong&gt;colgroup:&lt;/strong&gt; The header cell provides header information for  the rest of the &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#colgroups&quot;&gt;column group&lt;/a&gt; that contains it. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-abbr&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;abbr&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-text&quot;&gt;&lt;em&gt;text&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-sensitive&quot;&gt;[CS]&lt;/a&gt;&lt;dd&gt;This attribute should be used to provide an abbreviated form of the cell&#39;s  content, and may be rendered by user agents when appropriate in place of the  cell&#39;s content. Abbreviated names should be short since user agents may render  them repeatedly. For instance, speech synthesizers may render the abbreviated  headers relating to a particular cell before rendering that cell&#39;s content.&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-axis&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;axis&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-cdata&quot;&gt;&lt;em&gt;cdata&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-insensitive&quot;&gt;[CI]&lt;/a&gt;&lt;dd&gt;This attribute may be used to place a cell into conceptual categories that  can be considered to form axes in an n-dimensional space. User agents may give  users access to these categories (e.g., the user may query the user agent for  all cells that belong to certain categories, the user agent may present a table  in the form of a table of contents, etc.). Please consult the section on &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#multi-dimension&quot;&gt;categorizing cells&lt;/a&gt; for more information. The value  of this attribute is a comma-separated list of category names.&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-rowspan&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;rowspan&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-number&quot;&gt;&lt;em&gt;number&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-neutral&quot;&gt;[CN]&lt;/a&gt;&lt;dd&gt;This attribute specifies the number of rows spanned by the current cell. The  default value of this attribute is one (&quot;1&quot;). The value zero (&quot;0&quot;) means that  the cell spans all rows from the current row to the last row of the table  section (&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-THEAD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;THEAD&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TBODY&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TBODY&lt;/samp&gt;&lt;/a&gt;, or &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TFOOT&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TFOOT&lt;/samp&gt;&lt;/a&gt;)  in which the cell is defined.&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-colspan&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;colspan&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-number&quot;&gt;&lt;em&gt;number&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-neutral&quot;&gt;[CN]&lt;/a&gt;&lt;dd&gt;This attribute specifies the number of columns spanned by the current cell.  The default value of this attribute is one (&quot;1&quot;). The value zero (&quot;0&quot;) means  that the cell spans all columns from the current column to the last column of  the column group (&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt;) in which the cell is defined.&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-nowrap&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;nowrap&lt;/samp&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-insensitive&quot;&gt;[CI]&lt;/a&gt;&lt;dd&gt;&lt;a href=&quot;http://www.w3.org/TR/html401/conform.html#deprecated&quot;&gt;&lt;strong&gt;Deprecated.&lt;/strong&gt;&lt;/a&gt; When  present, this boolean attribute tells visual user agents to disable automatic  text wrapping for this cell. &lt;a href=&quot;http://www.w3.org/TR/html401/present/styles.html&quot;&gt;Style sheets&lt;/a&gt;  should be used instead of this attribute to achieve wrapping effects. &lt;strong&gt;Note.&lt;/strong&gt; if used carelessly, this attribute may result in  excessively wide cells.&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-width-TH&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;width&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-length&quot;&gt;&lt;em&gt;length&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-neutral&quot;&gt;[CN]&lt;/a&gt;&lt;dd&gt;&lt;a href=&quot;http://www.w3.org/TR/html401/conform.html#deprecated&quot;&gt;&lt;strong&gt;Deprecated.&lt;/strong&gt;&lt;/a&gt; This  attribute supplies user agents with a recommended cell width.&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-height-TH&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;height&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-length&quot;&gt;&lt;em&gt;length&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-neutral&quot;&gt;[CN]&lt;/a&gt;&lt;dd&gt;&lt;a href=&quot;http://www.w3.org/TR/html401/conform.html#deprecated&quot;&gt;&lt;strong&gt;Deprecated.&lt;/strong&gt;&lt;/a&gt; This  attribute supplies user agents with a recommended cell height. &lt;/dd&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dl&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;aref-list&quot;&gt;
&lt;em&gt;Attributes defined elsewhere&lt;/em&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-id&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;id&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-class&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;class&lt;/samp&gt;&lt;/a&gt;  (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/global.html#id-and-class&quot;&gt;document-wide identifiers&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;lang&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#language-info&quot;&gt;language information&lt;/a&gt;), &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;dir&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#bidirection&quot;&gt;text direction&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-title&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;title&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/global.html#title&quot;&gt;element  title&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/present/styles.html#adef-style&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;style&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/present/styles.html#style-element&quot;&gt;inline style information&lt;/a&gt; )
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onclick&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onclick&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-ondblclick&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;ondblclick&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmousedown&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmousedown&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseup&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseup&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseover&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseover&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmousemove&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmousemove&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onmouseout&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onmouseout&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeypress&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeypress&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeydown&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeydown&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#adef-onkeyup&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;onkeyup&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/interact/scripts.html#events&quot;&gt;intrinsic events&lt;/a&gt; )
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/present/graphics.html#adef-bgcolor&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;bgcolor&lt;/samp&gt;&lt;/a&gt; (&lt;a href=&quot;http://www.w3.org/TR/html401/present/graphics.html#background-color&quot;&gt;background color&lt;/a&gt;)
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-align-TD&quot;&gt;&lt;samp class=&quot;ainst-TD&quot;&gt;align&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-char&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;char&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-charoff&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;charoff&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-valign&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;valign&lt;/samp&gt;&lt;/a&gt;  (&lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#alignment&quot;&gt;cell alignment&lt;/a&gt;) &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;
Table cells may contain two types of information: &lt;span class=&quot;index-inst&quot; title=&quot;table::header cells|header cell::in table&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx-table-9&quot;&gt;header  information&lt;/a&gt;&lt;/span&gt; and &lt;span class=&quot;index-inst&quot; title=&quot;table::data 
cells|data cell::in table&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx-table-10&quot;&gt;data.&lt;/a&gt;&lt;/span&gt; This distinction enables user agents to  render header and data cells distinctly, even in the absence of style sheets.  For example, visual user agents may present header cell text with a bold font.  Speech synthesizers may render header information with a distinct voice  inflection.&lt;br /&gt;
&lt;br /&gt;
The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TH&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TH&lt;/samp&gt;&lt;/a&gt; element defines a cell that contains header  information. User agents have two pieces of header information available: the  contents of the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TH&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TH&lt;/samp&gt;&lt;/a&gt; element and the value of the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-abbr&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;abbr&lt;/samp&gt;&lt;/a&gt; attribute. User  agents must render either the contents of the cell or the value of the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-abbr&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;abbr&lt;/samp&gt;&lt;/a&gt;  attribute. For visual media, the latter may be appropriate when there is  insufficient space to render the full contents of the cell. For non-visual media &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-abbr&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;abbr&lt;/samp&gt;&lt;/a&gt;  may be used as an abbreviation for table headers when these are rendered along  with the contents of the cells to which they apply.&lt;br /&gt;
&lt;br /&gt;
The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-headers&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;headers&lt;/samp&gt;&lt;/a&gt; and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-scope&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;scope&lt;/samp&gt;&lt;/a&gt; attributes also  allow authors to help non-visual user agents process header information. Please  consult the section on &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#non-visual-rendering&quot;&gt;labeling cells for  non-visual user agents&lt;/a&gt; for information and examples.&lt;br /&gt;
&lt;br /&gt;
The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TD&lt;/samp&gt;&lt;/a&gt; element defines a cell that contains data.&lt;br /&gt;
&lt;br /&gt;
Cells may be empty (i.e., contain no data).&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
For example, the following table contains four columns of data, each headed  by a column description.&lt;br /&gt;
&lt;pre&gt;&lt;table summary=&quot;This table charts the number of cups
                   of coffee consumed by each senator, the type 
                   of coffee (decaf or regular), and whether 
                   taken with sugar.&quot;&gt;
&lt;caption&gt;Cups of coffee consumed by each senator&lt;/caption&gt;
&lt;tr&gt;
   &lt;th&gt;Name&lt;/th&gt;
   &lt;th&gt;Cups&lt;/th&gt;
   &lt;th&gt;Type of Coffee&lt;/th&gt;
   &lt;th&gt;Sugar?&lt;/th&gt;
&lt;tr&gt;
   &lt;td&gt;T. Sexton&lt;/td&gt;
   &lt;td&gt;10&lt;/td&gt;
   &lt;td&gt;Espresso&lt;/td&gt;
   &lt;td&gt;No&lt;/td&gt;
&lt;tr&gt;
   &lt;td&gt;J. Dinnen&lt;/td&gt;
   &lt;td&gt;5&lt;/td&gt;
   &lt;td&gt;Decaf&lt;/td&gt;
   &lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tr&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/pre&gt;
A user agent rendering to a tty device might display this as follows:&lt;br /&gt;
&lt;pre&gt;&lt;strong&gt;Name         Cups       Type of Coffee   Sugar?&lt;/strong&gt;
T. Sexton    10         Espresso         No
J. Dinnen    5          Decaf            Yes
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h4&gt;
&lt;span class=&quot;index-inst&quot; title=&quot;table::cells that span several
rows/columns&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx-table-11&quot;&gt;Cells that span several rows or columns&lt;/a&gt;&lt;/span&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.2.6.1&quot;&gt; &lt;/a&gt;&lt;/h4&gt;
&lt;br /&gt;
Cells may span several rows or columns. The number of rows or columns spanned  by a cell is set by the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-rowspan&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;rowspan&lt;/samp&gt;&lt;/a&gt; and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-colspan&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;colspan&lt;/samp&gt;&lt;/a&gt; attributes  for the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TH&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TH&lt;/samp&gt;&lt;/a&gt; and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TD&lt;/samp&gt;&lt;/a&gt; elements.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
In this table definition, we specify that the cell in row four, column two  should span a total of three columns, including the current column.&lt;br /&gt;
&lt;pre&gt;&lt;table border=&quot;1&quot;&gt;
&lt;caption&gt;Cups of coffee consumed by each senator&lt;/caption&gt;
&lt;tr&gt;&lt;th&gt;Name&lt;th&gt;Cups&lt;th&gt;Type of Coffee&lt;th&gt;Sugar?
&lt;tr&gt;&lt;td&gt;T. Sexton&lt;td&gt;10&lt;td&gt;Espresso&lt;td&gt;No
&lt;tr&gt;&lt;td&gt;J. Dinnen&lt;td&gt;5&lt;td&gt;Decaf&lt;td&gt;Yes
&lt;tr&gt;&lt;td&gt;A. Soria&lt;td colspan=&quot;3&quot;&gt;&lt;em&gt;Not available&lt;/em&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/th&gt;&lt;/th&gt;&lt;/th&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;/pre&gt;
This table might be rendered on a tty device by a visual user agent as  follows:&lt;br /&gt;
&lt;pre&gt;Cups of coffee consumed by each senator
 --------------------------------------
 |   Name  |Cups|Type of Coffee|Sugar?|
 --------------------------------------
 |T. Sexton|10  |Espresso      |No    |
 --------------------------------------
 |J. Dinnen|5   |Decaf         |Yes   |
 --------------------------------------
 |A. Soria |Not available             |
 --------------------------------------
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
The next example illustrates (with the help of table borders) how cell  definitions that span more than one row or column affect the definition of later  cells. Consider the following table definition:&lt;br /&gt;
&lt;pre&gt;&lt;table border=&quot;1&quot;&gt;
&lt;tr&gt;&lt;td&gt;1 &lt;td rowspan=&quot;2&quot;&gt;2 &lt;td&gt;3
&lt;tr&gt;&lt;td&gt;4 &lt;td&gt;6
&lt;tr&gt;&lt;td&gt;7 &lt;td&gt;8 &lt;td&gt;9
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;/pre&gt;
As cell &quot;2&quot; spans the first and second rows, the definition of the second row  will take it into account. Thus, the second &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TD&lt;/samp&gt;&lt;/a&gt; in row two actually  defines the row&#39;s third cell. Visually, the table might be rendered to a tty  device as:&lt;br /&gt;
&lt;pre&gt;-------------
| 1 | 2 | 3 | 
----|   |----
| 4 |   | 6 |
----|---|----
| 7 | 8 | 9 |
-------------
&lt;/pre&gt;
while a graphical user agent might render this as:&lt;br /&gt;
&lt;img alt=&quot;Image of a table with rowspan=2&quot; src=&quot;http://www.w3.org/TR/html401/images/rowspan.gif&quot; /&gt;&lt;br /&gt;
Note that if the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TD&lt;/samp&gt;&lt;/a&gt; defining cell &quot;6&quot; had been omitted, an extra empty  cell would have been added by the user agent to complete the row.&lt;br /&gt;
Similarly, in the following table definition:&lt;br /&gt;
&lt;pre&gt;&lt;table border=&quot;1&quot;&gt;
&lt;tr&gt;&lt;td&gt;1 &lt;td&gt;2 &lt;td&gt;3
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;4 &lt;td&gt;6
&lt;tr&gt;&lt;td&gt;7 &lt;td&gt;8 &lt;td&gt;9
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;/pre&gt;
cell &quot;4&quot; spans two columns, so the second &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TD&lt;/samp&gt;&lt;/a&gt; in the row actually  defines the third cell (&quot;6&quot;):&lt;br /&gt;
&lt;pre&gt;-------------
| 1 | 2 | 3 | 
--------|----
| 4     | 6 |
--------|----
| 7 | 8 | 9 |
-------------
&lt;/pre&gt;
A graphical user agent might render this as:&lt;br /&gt;
&lt;img alt=&quot;Image of a table with colspan=2&quot; src=&quot;http://www.w3.org/TR/html401/images/colspan.gif&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
Defining overlapping cells is an error. User agents may vary in how they  handle this error (e.g., rendering may vary).&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;illegal-example&quot;&gt;
The following illegal example illustrates how one might create overlapping  cells. In this table, cell &quot;5&quot; spans two rows and cell &quot;7&quot; spans two columns, so  there is overlap in the cell between &quot;7&quot; and &quot;9&quot;:&lt;br /&gt;
&lt;pre&gt;&lt;table border=&quot;1&quot;&gt;
&lt;tr&gt;&lt;td&gt;1 &lt;td&gt;2 &lt;td&gt;3
&lt;tr&gt;&lt;td&gt;4 &lt;td rowspan=&quot;2&quot;&gt;5 &lt;td&gt;6
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;7 &lt;td&gt;9
&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.3&quot;&gt;11.3&lt;/a&gt; &lt;span class=&quot;index-inst&quot; title=&quot;table::visual 
rendering of&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;visual-formatting&quot;&gt;Table  formatting by visual user agents&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;br /&gt;
&lt;div class=&quot;note&quot;&gt;
&lt;em&gt;&lt;strong&gt;Note.&lt;/strong&gt; The following sections describe the HTML table  attributes that concern visual formatting. When this specification was first  published in 1997, &lt;a class=&quot;informref&quot; href=&quot;http://www.w3.org/TR/html401/references.html#ref-CSS1&quot; rel=&quot;biblioentry&quot;&gt;[CSS1]&lt;/a&gt; did not offer mechanisms to control all aspects of  visual table formatting. Since then, &lt;a class=&quot;informref&quot; href=&quot;http://www.w3.org/TR/html401/references.html#ref-CSS2&quot; rel=&quot;biblioentry&quot;&gt;[CSS2]&lt;/a&gt; has added  properties to allow visual formatting of tables.&lt;/em&gt;&lt;/div&gt;
&lt;br /&gt;
HTML 4 includes mechanisms to control:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#borders&quot;&gt;border styles&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#alignment&quot;&gt;horizontal and vertical alignment&lt;/a&gt; of cell contents
&lt;li&gt;and &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#margins&quot;&gt;cell margins&lt;/a&gt; &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.3.1&quot;&gt;11.3.1&lt;/a&gt; &lt;span class=&quot;index-inst&quot; title=&quot;table::borders and rules of|border::around a table|rule::between table cells&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;borders&quot;&gt;Borders and rules&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;br /&gt;
The following attributes affect a table&#39;s external frame and internal  rules.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;adef-list&quot;&gt;
&lt;em&gt;Attribute definitions&lt;/em&gt;&lt;br /&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-frame&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;frame&lt;/samp&gt;&lt;/a&gt; = &lt;samp&gt;void|above|below|hsides|lhs|rhs|vsides|box|border&lt;/samp&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-insensitive&quot;&gt;[CI]&lt;/a&gt;&lt;dd&gt;This attribute specifies which sides of the frame surrounding a table will  be visible. Possible values: &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;samp&gt;void:&lt;/samp&gt; No sides. This is the default value.
&lt;li&gt;&lt;samp&gt;above:&lt;/samp&gt; The top side only.
&lt;li&gt;&lt;samp&gt;below:&lt;/samp&gt; The bottom side only.
&lt;li&gt;&lt;samp&gt;hsides:&lt;/samp&gt; The top and bottom sides only.
&lt;li&gt;&lt;samp&gt;vsides:&lt;/samp&gt; The right and left sides only.
&lt;li&gt;&lt;samp&gt;lhs:&lt;/samp&gt; The left-hand side only.
&lt;li&gt;&lt;samp&gt;rhs:&lt;/samp&gt; The right-hand side only.
&lt;li&gt;&lt;samp&gt;box:&lt;/samp&gt; All four sides.
&lt;li&gt;&lt;samp&gt;border:&lt;/samp&gt; All four sides. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-rules&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;rules&lt;/samp&gt;&lt;/a&gt; = &lt;samp&gt;none|groups|rows|cols|all&lt;/samp&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-insensitive&quot;&gt;[CI]&lt;/a&gt;&lt;dd&gt;This attribute specifies which rules will appear between cells within a  table. The rendering of rules is user agent dependent. Possible values: &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;samp&gt;none:&lt;/samp&gt; No rules. This is the default value.
&lt;li&gt;&lt;samp&gt;groups:&lt;/samp&gt; Rules will appear between row groups (see &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-THEAD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;THEAD&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TFOOT&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TFOOT&lt;/samp&gt;&lt;/a&gt;, and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TBODY&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TBODY&lt;/samp&gt;&lt;/a&gt;) and column  groups (see &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt; and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt;) only.
&lt;li&gt;&lt;samp&gt;rows:&lt;/samp&gt; Rules will appear between rows only.
&lt;li&gt;&lt;samp&gt;cols:&lt;/samp&gt; Rules will appear between columns only.
&lt;li&gt;&lt;samp&gt;all:&lt;/samp&gt; Rules will appear between all rows and columns. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-border-TABLE&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;border&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-pixels&quot;&gt;&lt;em&gt;pixels&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-neutral&quot;&gt;[CN]&lt;/a&gt;&lt;dd&gt;This attributes specifies the width (in pixels only) of the frame around a  table (see the Note below for more information about this attribute). &lt;/dd&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dl&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
To help distinguish the cells of a table, we can set the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-border-TABLE&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;border&lt;/samp&gt;&lt;/a&gt;  attribute of the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt; element. Consider a previous example:&lt;br /&gt;
&lt;pre&gt;&lt;table border=&quot;1&quot; summary=&quot;This table charts the number of cups
                of coffee consumed by each senator, the type 
                of coffee (decaf or regular), and whether 
                taken with sugar.&quot;&gt;
&lt;caption&gt;Cups of coffee consumed by each senator&lt;/caption&gt;
&lt;tr&gt;
   &lt;th&gt;Name&lt;/th&gt;
   &lt;th&gt;Cups&lt;/th&gt;
   &lt;th&gt;Type of Coffee&lt;/th&gt;
   &lt;th&gt;Sugar?&lt;/th&gt;
&lt;tr&gt;
   &lt;td&gt;T. Sexton&lt;/td&gt;
   &lt;td&gt;10&lt;/td&gt;
   &lt;td&gt;Espresso&lt;/td&gt;
   &lt;td&gt;No&lt;/td&gt;
&lt;tr&gt;
   &lt;td&gt;J. Dinnen&lt;/td&gt;
   &lt;td&gt;5&lt;/td&gt;
   &lt;td&gt;Decaf&lt;/td&gt;
   &lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tr&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
In the following example, the user agent should show borders five pixels  thick on the left-hand and right-hand sides of the table, with rules drawn  between each column.&lt;br /&gt;
&lt;pre&gt;&lt;table border=&quot;5&quot; frame=&quot;vsides&quot; rules=&quot;cols&quot;&gt;
&lt;tr&gt; &lt;td&gt;1 &lt;td&gt;2 &lt;td&gt;3
&lt;tr&gt; &lt;td&gt;4 &lt;td&gt;5 &lt;td&gt;6
&lt;tr&gt; &lt;td&gt;7 &lt;td&gt;8 &lt;td&gt;9
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
The following settings should be observed by user agents for backwards  compatibility.&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Setting &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-border-TABLE&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;border&lt;/samp&gt;&lt;/a&gt;=&quot;0&quot; implies &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-frame&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;frame&lt;/samp&gt;&lt;/a&gt;=&quot;void&quot;  and, unless otherwise specified, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-rules&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;rules&lt;/samp&gt;&lt;/a&gt;=&quot;none&quot;.
&lt;li&gt;Other values of &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-border-TABLE&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;border&lt;/samp&gt;&lt;/a&gt; imply &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-frame&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;frame&lt;/samp&gt;&lt;/a&gt;=&quot;border&quot;  and, unless otherwise specified, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-rules&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;rules&lt;/samp&gt;&lt;/a&gt;=&quot;all&quot;.
&lt;li&gt;The value &quot;border&quot; in the start tag of the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt; element should  be interpreted as the value of the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-frame&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;frame&lt;/samp&gt;&lt;/a&gt;  attribute. It implies &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-rules&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;rules&lt;/samp&gt;&lt;/a&gt;=&quot;all&quot; and some default (non-zero) value for  the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-border-TABLE&quot;&gt;&lt;samp class=&quot;ainst-TABLE&quot;&gt;border&lt;/samp&gt;&lt;/a&gt; attribute. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
For example, the following definitions are equivalent:&lt;br /&gt;
&lt;pre&gt;&lt;table border=&quot;2&quot;&gt;
&lt;table border=&quot;2&quot; frame=&quot;border&quot; rules=&quot;all&quot;&gt;
&lt;/table&gt;
&lt;/table&gt;
&lt;/pre&gt;
as are the following:&lt;br /&gt;
&lt;pre&gt;&lt;table border=&quot;border&quot;&gt;
&lt;table frame=&quot;border&quot; rules=&quot;all&quot;&gt;
&lt;/table&gt;
&lt;/table&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;note&quot;&gt;
&lt;em&gt;&lt;strong&gt;Note.&lt;/strong&gt; The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/objects.html#adef-border-IMG&quot;&gt;&lt;samp class=&quot;ainst-IMG&quot;&gt;border&lt;/samp&gt;&lt;/a&gt;  attribute also defines the border behavior for the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/objects.html#edef-OBJECT&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;OBJECT&lt;/samp&gt;&lt;/a&gt; and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/objects.html#edef-IMG&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;IMG&lt;/samp&gt;&lt;/a&gt;  elements, but takes different values for those elements.&lt;/em&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.3.2&quot;&gt;11.3.2&lt;/a&gt; &lt;span class=&quot;index-inst&quot; title=&quot;table::alignment of contents|alignment::of table contents&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;alignment&quot;&gt;Horizontal and vertical alignment&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;br /&gt;
The following attributes may be set for different table elements (see their  definitions).&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;dtd-fragment&quot;&gt;
&lt;pre class=&quot;dtd-fragment&quot;&gt;&lt;!-- horizontal alignment attributes for cell contents --&gt;
&lt;samp class=&quot;ainst-TD&quot;&gt;align&lt;/samp&gt;&lt;/pre&gt;
&lt;/div&gt;
(left|center|right|justify|char) #IMPLIED
   &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-char&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;char&lt;/samp&gt;&lt;/a&gt;       &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#Character&quot;&gt;%Character;&lt;/a&gt;    #IMPLIED  -- alignment char, e.g. char=&#39;:&#39; --
   &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-charoff&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;charoff&lt;/samp&gt;&lt;/a&gt;    &lt;a href=&quot;http://www.w3.org/TR/html401/sgml/dtd.html#Length&quot;&gt;%Length;&lt;/a&gt;       #IMPLIED  -- offset for alignment char --&quot;
  &amp;gt;
&lt;!-- vertical alignment attributes for cell contents --&gt;
&lt;samp class=&quot;ainst&quot;&gt;valign&lt;/samp&gt;     (top|middle|bottom|baseline) #IMPLIED&quot;
  &amp;gt;
&lt;br /&gt;
&lt;div class=&quot;adef-list&quot;&gt;
&lt;em&gt;Attribute definitions&lt;/em&gt;&lt;br /&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-align-TD&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;align&lt;/samp&gt;&lt;/a&gt; = &lt;samp&gt;left|center|right|justify|char&lt;/samp&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-insensitive&quot;&gt;[CI]&lt;/a&gt;&lt;dd&gt;This attribute specifies the alignment of data and the justification of text  in a cell. Possible values: &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;samp&gt;left:&lt;/samp&gt; Left-flush data/Left-justify text. This is the default  value for table data.
&lt;li&gt;&lt;samp&gt;center:&lt;/samp&gt; Center data/Center-justify text. This is the default  value for table headers.
&lt;li&gt;&lt;samp&gt;right:&lt;/samp&gt; Right-flush data/Right-justify text.
&lt;li&gt;&lt;samp&gt;justify:&lt;/samp&gt; Double-justify text.
&lt;li&gt;&lt;samp&gt;char:&lt;/samp&gt; Align text around a specific character. If a user agent  doesn&#39;t support character alignment, behavior in the presence of this value is  unspecified. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-valign&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;valign&lt;/samp&gt;&lt;/a&gt; = &lt;samp&gt;top|middle|bottom|baseline&lt;/samp&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-insensitive&quot;&gt;[CI]&lt;/a&gt;&lt;dd&gt;This attribute specifies the vertical position of data within a cell.  Possible values: &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;samp&gt;top:&lt;/samp&gt; Cell data is flush with the top of the cell.
&lt;li&gt;&lt;samp&gt;middle:&lt;/samp&gt; Cell data is centered vertically within the cell. This  is the default value.
&lt;li&gt;&lt;samp&gt;bottom:&lt;/samp&gt; Cell data is flush with the bottom of the cell.
&lt;li&gt;&lt;samp&gt;baseline:&lt;/samp&gt; All cells in the same row as a cell whose &lt;samp&gt;valign&lt;/samp&gt; attribute has this value should have their textual data  positioned so that the first text line occurs on a baseline common to all cells  in the row. This constraint does not apply to subsequent text lines in these  cells. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-char&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;char&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-character&quot;&gt;&lt;em&gt;character&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-neutral&quot;&gt;[CN]&lt;/a&gt;&lt;dd&gt;This attribute specifies a single character within a text fragment to act as  an axis for alignment. The default value for this attribute is the decimal point  character for the current language as set by the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;lang&lt;/samp&gt;&lt;/a&gt; attribute (e.g.,  the period (&quot;.&quot;) in English and the comma (&quot;,&quot;) in French). User agents are not  required to support this attribute.&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-charoff&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;charoff&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-length&quot;&gt;&lt;em&gt;length&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-neutral&quot;&gt;[CN]&lt;/a&gt;&lt;dd&gt;When present, this attribute specifies the offset to the first occurrence of  the alignment character on each line. If a line doesn&#39;t include the alignment  character, it should be horizontally shifted to end at the alignment position.  When &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-charoff&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;charoff&lt;/samp&gt;&lt;/a&gt; is used to set the offset of an alignment  character, the direction of offset is determined by the current text direction  (set by the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;dir&lt;/samp&gt;&lt;/a&gt; attribute). In left-to-right texts (the default),  offset is from the left margin. In right-to-left texts, offset is from the right  margin. User agents are not required to support this  attribute.&lt;/dd&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dl&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
The table in this example aligns a row of currency values along a decimal  point. We set the alignment character to &quot;.&quot; explicitly.&lt;br /&gt;
&lt;pre&gt;&lt;table border=&quot;1&quot;&gt;
&lt;colgroup&gt;
&lt;col&gt;&lt;/col&gt;&lt;col align=&quot;char&quot; char=&quot;.&quot;&gt;&lt;/col&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Vegetable &lt;th&gt;Cost per kilo
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Lettuce        &lt;td&gt;$1
&lt;tr&gt;&lt;td&gt;Silver carrots &lt;td&gt;$10.50
&lt;tr&gt;&lt;td&gt;Golden turnips &lt;td&gt;$100.30
&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/th&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;&lt;/colgroup&gt;&lt;/table&gt;
&lt;/pre&gt;
The formatted table may resemble the following:&lt;br /&gt;
&lt;pre&gt;------------------------------
|   Vegetable  |Cost per kilo|
|--------------|-------------|
|Lettuce       |        $1   |
|--------------|-------------|
|Silver carrots|       $10.50|
|--------------|-------------|
|Golden turnips|      $100.30|
------------------------------
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
When the contents of a cell contain more than one instance of the alignment  character specified by &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-char&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;char&lt;/samp&gt;&lt;/a&gt; and the contents wrap, user agent behavior is  undefined. Authors should therefore be attentive in their use of &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-char&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;char&lt;/samp&gt;&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;note&quot;&gt;
&lt;em&gt;&lt;strong&gt;Note.&lt;/strong&gt; Visual user agents typically render &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TH&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TH&lt;/samp&gt;&lt;/a&gt; elements  vertically and horizontally centered within the cell and with a bold font  weight.&lt;/em&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h4&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;alignment-inheritance&quot;&gt;Inheritance of alignment specifications&lt;/a&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.3.2.1&quot;&gt; &lt;/a&gt;&lt;/h4&gt;
&lt;br /&gt;
The alignment of cell contents can be specified on a cell by cell basis, or  inherited from enclosing elements, such as the row, column or the table  itself.&lt;br /&gt;
&lt;br /&gt;
The order of precedence (from highest to lowest) for the attributes &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-align-TD&quot;&gt;&lt;samp class=&quot;ainst-TD&quot;&gt;align&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-char&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;char&lt;/samp&gt;&lt;/a&gt;, and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-charoff&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;charoff&lt;/samp&gt;&lt;/a&gt; is the following:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;An alignment attribute set on an element within a cell&#39;s data (e.g., &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/text.html#edef-P&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;P&lt;/samp&gt;&lt;/a&gt;).
&lt;li&gt;An alignment attribute set on a cell (&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TH&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TH&lt;/samp&gt;&lt;/a&gt; and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TD&lt;/samp&gt;&lt;/a&gt;).
&lt;li&gt;An alignment attribute set on a column grouping element (&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt;). When a  cell is part of a multi-column span, the alignment property is inherited from  the cell definition at the beginning of the span.
&lt;li&gt;An alignment attribute set on a row or row grouping element (&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TR&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TR&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-THEAD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;THEAD&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TFOOT&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TFOOT&lt;/samp&gt;&lt;/a&gt;,  and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TBODY&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TBODY&lt;/samp&gt;&lt;/a&gt;). When a cell is part of a multi-row span, the  alignment property is inherited from the cell definition at the beginning of the  span.
&lt;li&gt;An alignment attribute set on the table (&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt;).
&lt;li&gt;The default alignment value. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
The order of precedence (from highest to lowest) for the attribute &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-valign&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;valign&lt;/samp&gt;&lt;/a&gt;  (as well as the other inherited attributes &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;lang&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;dir&lt;/samp&gt;&lt;/a&gt;, and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/present/styles.html#adef-style&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;style&lt;/samp&gt;&lt;/a&gt;) is the following:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;An attribute set on an element within a cell&#39;s data (e.g., &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/text.html#edef-P&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;P&lt;/samp&gt;&lt;/a&gt;).
&lt;li&gt;An attribute set on a cell (&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TH&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TH&lt;/samp&gt;&lt;/a&gt; and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TD&lt;/samp&gt;&lt;/a&gt;).
&lt;li&gt;An attribute set on a row or row grouping element (&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TR&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TR&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-THEAD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;THEAD&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TFOOT&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TFOOT&lt;/samp&gt;&lt;/a&gt;,  and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TBODY&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TBODY&lt;/samp&gt;&lt;/a&gt;). When a cell is part of a multi-row span, the  attribute value is inherited from the cell definition at the beginning of the  span.
&lt;li&gt;An attribute set on a column grouping element (&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COL&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COL&lt;/samp&gt;&lt;/a&gt; and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-COLGROUP&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;COLGROUP&lt;/samp&gt;&lt;/a&gt;). When a  cell is part of a multi-column span, the attribute value is inherited from the  cell definition at the beginning of the span.
&lt;li&gt;An attribute set on the table (&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TABLE&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TABLE&lt;/samp&gt;&lt;/a&gt;).
&lt;li&gt;The default attribute value. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
Furthermore, when rendering cells, horizontal alignment is determined by  columns in preference to rows, while for vertical alignment, rows are given  preference over columns.&lt;br /&gt;
&lt;br /&gt;
The default alignment for cells depends on the user agent. However, user  agents should substitute the default attribute for the current directionality  (i.e., not just &quot;left&quot; in all cases).&lt;br /&gt;
&lt;br /&gt;
User agents that do not support the &quot;justify&quot; value of the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-align-TD&quot;&gt;&lt;samp class=&quot;ainst-TD&quot;&gt;align&lt;/samp&gt;&lt;/a&gt; attribute  should use the value of the inherited directionality in its place.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;note&quot;&gt;
&lt;em&gt;&lt;strong&gt;Note.&lt;/strong&gt; Note that a cell may inherit an  attribute not from its parent but from the first cell in a span. This is an  exception to the general attribute inheritance rules.&lt;/em&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.3.3&quot;&gt;11.3.3&lt;/a&gt; &lt;span class=&quot;index-inst&quot; title=&quot;white 
space::around table contents| table::cell margins&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;margins&quot;&gt;Cell margins&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;br /&gt;
&lt;div class=&quot;adef-list&quot;&gt;
&lt;em&gt;Attribute definitions&lt;/em&gt;&lt;br /&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-cellspacing&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;cellspacing&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-length&quot;&gt;&lt;em&gt;length&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-neutral&quot;&gt;[CN]&lt;/a&gt;&lt;dd&gt;This attribute specifies how much space the user agent should leave between  the left side of the table and the left-hand side of the leftmost column, the  top of the table and the top side of the topmost row, and so on for the right  and bottom of the table. The attribute also specifies the amount of space to  leave between cells.&lt;br /&gt;
&lt;dt&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;adef-cellpadding&quot;&gt;&lt;samp class=&quot;adef&quot;&gt;cellpadding&lt;/samp&gt;&lt;/a&gt; = &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#type-length&quot;&gt;&lt;em&gt;length&lt;/em&gt;&lt;/a&gt; &lt;a href=&quot;http://www.w3.org/TR/html401/types.html#case-neutral&quot;&gt;[CN]&lt;/a&gt;&lt;dd&gt;This attribute specifies the amount of space between the border of the cell  and its contents. If the value of this attribute is a pixel length, all four  margins should be this distance from the contents. If the value of the attribute  is a percentage length, the top and bottom margins should be equally separated  from the content based on a percentage of the available vertical space, and the  left and right margins should be equally separated from the content based on a  percentage of the available horizontal space. &lt;/dd&gt;&lt;br /&gt;&lt;/dt&gt;
&lt;/dd&gt;&lt;/dt&gt;
&lt;/dl&gt;
&lt;/div&gt;
&lt;br /&gt;
These two attributes control spacing between and within cells. The following  illustration explains how they relate:&lt;br /&gt;
&lt;br /&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;img alt=&quot;Image illustrating how cellspacing and cellpadding attributes relate.&quot; src=&quot;http://www.w3.org/TR/html401/images/cellsppad.gif&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
In the following example, the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-cellspacing&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;cellspacing&lt;/samp&gt;&lt;/a&gt;  attribute specifies that cells should be separated from each other and from the  table frame by twenty pixels. The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-cellpadding&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;cellpadding&lt;/samp&gt;&lt;/a&gt;  attribute specifies that the top margin of the cell and the bottom margin of the  cell will each be separated from the cell&#39;s contents by 10% of the available  vertical space (the total being 20%). Similarly, the left margin of the cell and  the right margin of the cell will each be separated from the cell&#39;s contents by  10% of the available horizontal space (the total being 20%).&lt;br /&gt;
&lt;pre&gt;&lt;table cellpadding=&quot;20%&quot; cellspacing=&quot;20&quot;&gt;
&lt;tr&gt; &lt;td&gt;Data1 &lt;td&gt;Data2 &lt;td&gt;Data3
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
If a table or given column has a fixed width, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-cellspacing&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;cellspacing&lt;/samp&gt;&lt;/a&gt; and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-cellpadding&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;cellpadding&lt;/samp&gt;&lt;/a&gt; may demand more space than assigned. User  agents may give these attributes precedence over the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-width-TH&quot;&gt;&lt;samp class=&quot;ainst-TH&quot;&gt;width&lt;/samp&gt;&lt;/a&gt; attribute  when a conflict occurs, but are not required to.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.4&quot;&gt;11.4&lt;/a&gt; &lt;span class=&quot;index-inst&quot; title=&quot;table::non-visual 
rendering of&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;non-visual-rendering&quot;&gt;Table  rendering by non-visual user agents&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.4.1&quot;&gt;11.4.1&lt;/a&gt; &lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;header-data&quot;&gt;Associating header  information with data cells&lt;/a&gt;&lt;/h3&gt;
&lt;br /&gt;
Non-visual user agents such as speech synthesizers and Braille-based devices  may use the following &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TD&lt;/samp&gt;&lt;/a&gt; and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TH&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TH&lt;/samp&gt;&lt;/a&gt; element attributes to render table cells more  intuitively:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;For a given data cell, the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-headers&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;headers&lt;/samp&gt;&lt;/a&gt; attribute  lists which cells provide pertinent header information. For this purpose, each  header cell must be named using the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-id&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;id&lt;/samp&gt;&lt;/a&gt; attribute. Note that  it&#39;s not always possible to make a clean division of cells into headers or data.  You should use the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TD&lt;/samp&gt;&lt;/a&gt; element for such cells together with the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-id&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;id&lt;/samp&gt;&lt;/a&gt; or &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-scope&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;scope&lt;/samp&gt;&lt;/a&gt;  attributes as appropriate.
&lt;li&gt;&lt;span class=&quot;index-inst&quot; title=&quot;header cell::scope of|scope::of table 
header cell&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx-header_cell-1&quot;&gt;For a given header cell&lt;/a&gt;&lt;/span&gt;, the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-scope&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;scope&lt;/samp&gt;&lt;/a&gt; attribute tells  the user agent the data cells for which this header provides information.  Authors may choose to use this attribute instead of &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-headers&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;headers&lt;/samp&gt;&lt;/a&gt; according  to which is more convenient; the two attributes fulfill the same function. The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-headers&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;headers&lt;/samp&gt;&lt;/a&gt; attribute is generally needed when headers are  placed in irregular positions with respect to the data they apply to.
&lt;li&gt;&lt;span class=&quot;index-inst&quot; title=&quot;header cell::abbreviation&quot;&gt;The &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-abbr&quot; name=&quot;idx-header_cell-2&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;abbr&lt;/samp&gt;&lt;/a&gt; attribute&lt;/span&gt; specifies an abbreviated header for  header cells so that user agents may render header information more rapidly. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
In the following example, we assign header information to cells by setting  the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-headers&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;headers&lt;/samp&gt;&lt;/a&gt; attribute. Each cell in the same column refers to  the same header cell (via the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-id&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;id&lt;/samp&gt;&lt;/a&gt; attribute).&lt;br /&gt;
&lt;pre&gt;&lt;table border=&quot;1&quot; summary=&quot;This table charts the number of cups
                of coffee consumed by each senator, the type 
                of coffee (decaf or regular), and whether 
                taken with sugar.&quot;&gt;
&lt;caption&gt;Cups of coffee consumed by each senator&lt;/caption&gt;
&lt;tr&gt;
   &lt;th id=&quot;t1&quot;&gt;Name&lt;/th&gt;
   &lt;th id=&quot;t2&quot;&gt;Cups&lt;/th&gt;
   &lt;th abbr=&quot;Type&quot; id=&quot;t3&quot;&gt;Type of Coffee&lt;/th&gt;
   &lt;th id=&quot;t4&quot;&gt;Sugar?&lt;/th&gt;
&lt;tr&gt;
   &lt;td headers=&quot;t1&quot;&gt;T. Sexton&lt;/td&gt;
   &lt;td headers=&quot;t2&quot;&gt;10&lt;/td&gt;
   &lt;td headers=&quot;t3&quot;&gt;Espresso&lt;/td&gt;
   &lt;td headers=&quot;t4&quot;&gt;No&lt;/td&gt;
&lt;tr&gt;
   &lt;td headers=&quot;t1&quot;&gt;J. Dinnen&lt;/td&gt;
   &lt;td headers=&quot;t2&quot;&gt;5&lt;/td&gt;
   &lt;td headers=&quot;t3&quot;&gt;Decaf&lt;/td&gt;
   &lt;td headers=&quot;t4&quot;&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tr&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/pre&gt;
A speech synthesizer might render this table as follows:&lt;br /&gt;
&lt;pre&gt;Caption: Cups of coffee consumed by each senator
Summary: This table charts the number of cups
         of coffee consumed by each senator, the type 
         of coffee (decaf or regular), and whether 
         taken with sugar.
Name: T. Sexton,   Cups: 10,   Type: Espresso,   Sugar: No
Name: J. Dinnen,   Cups: 5,    Type: Decaf,      Sugar: Yes
&lt;/pre&gt;
Note how the header &quot;Type of Coffee&quot; is abbreviated to &quot;Type&quot; using the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-abbr&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;abbr&lt;/samp&gt;&lt;/a&gt;  attribute.&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
Here is the same example substituting the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-scope&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;scope&lt;/samp&gt;&lt;/a&gt; attribute for  the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-headers&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;headers&lt;/samp&gt;&lt;/a&gt; attribute. Note the value &quot;col&quot; for the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-scope&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;scope&lt;/samp&gt;&lt;/a&gt;  attribute, meaning &quot;all cells in the current column&quot;:&lt;br /&gt;
&lt;pre&gt;&lt;table border=&quot;1&quot; summary=&quot;This table charts the number of cups
                of coffee consumed by each senator, the type 
                of coffee (decaf or regular), and whether 
                taken with sugar.&quot;&gt;
&lt;caption&gt;Cups of coffee consumed by each senator&lt;/caption&gt;
&lt;tr&gt;
   &lt;th scope=&quot;col&quot;&gt;Name&lt;/th&gt;
   &lt;th scope=&quot;col&quot;&gt;Cups&lt;/th&gt;
   &lt;th abbr=&quot;Type&quot; scope=&quot;col&quot;&gt;Type of Coffee&lt;/th&gt;
   &lt;th scope=&quot;col&quot;&gt;Sugar?&lt;/th&gt;
&lt;tr&gt;
   &lt;td&gt;T. Sexton&lt;/td&gt;
   &lt;td&gt;10&lt;/td&gt;
   &lt;td&gt;Espresso&lt;/td&gt;
   &lt;td&gt;No&lt;/td&gt;
&lt;tr&gt;
   &lt;td&gt;J. Dinnen&lt;/td&gt;
   &lt;td&gt;5&lt;/td&gt;
   &lt;td&gt;Decaf&lt;/td&gt;
   &lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tr&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot; id=&quot;course-ex&quot;&gt;
Here&#39;s a somewhat more complex example illustrating other values for the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-scope&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;scope&lt;/samp&gt;&lt;/a&gt;  attribute:&lt;br /&gt;
&lt;pre&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;5&quot; cellspacing=&quot;2&quot; summary=&quot;History courses offered in the community of
           Bath arranged by course name, tutor, summary, 
           code, and fee&quot;&gt;
&lt;tr&gt;
    &lt;th colspan=&quot;5&quot; scope=&quot;colgroup&quot;&gt;Community Courses -- Bath Autumn 1997&lt;/th&gt;
  &lt;/tr&gt;
&lt;tr&gt;
    &lt;th abbr=&quot;Name&quot; scope=&quot;col&quot;&gt;Course Name&lt;/th&gt;
    &lt;th abbr=&quot;Tutor&quot; scope=&quot;col&quot;&gt;Course Tutor&lt;/th&gt;
    &lt;th scope=&quot;col&quot;&gt;Summary&lt;/th&gt;
    &lt;th scope=&quot;col&quot;&gt;Code&lt;/th&gt;
    &lt;th scope=&quot;col&quot;&gt;Fee&lt;/th&gt;
  &lt;/tr&gt;
&lt;tr&gt;
    &lt;td scope=&quot;row&quot;&gt;After the Civil War&lt;/td&gt;
    &lt;td&gt;Dr. John Wroughton&lt;/td&gt;
    &lt;td&gt;
       The course will examine the turbulent years in England
       after 1646. &lt;em&gt;6 weekly meetings starting Monday 13th
      October.&lt;/em&gt;
    &lt;/td&gt;
    &lt;td&gt;H27&lt;/td&gt;
    &lt;td&gt;£32&lt;/td&gt;
  &lt;/tr&gt;
&lt;tr&gt;
    &lt;td scope=&quot;row&quot;&gt;An Introduction to Anglo-Saxon England&lt;/td&gt;
    &lt;td&gt;Mark Cottle&lt;/td&gt;
    &lt;td&gt;
       One day course introducing the early medieval
       period reconstruction the Anglo-Saxons and
       their society. &lt;em&gt;Saturday 18th October.&lt;/em&gt;
    &lt;/td&gt;
    &lt;td&gt;H28&lt;/td&gt;
    &lt;td&gt;£18&lt;/td&gt;
  &lt;/tr&gt;
&lt;tr&gt;
    &lt;td scope=&quot;row&quot;&gt;The Glory that was Greece&lt;/td&gt;
    &lt;td&gt;Valerie Lorenz&lt;/td&gt;
    &lt;td&gt;
     Birthplace of democracy, philosophy, heartland of theater, home of
     argument. The Romans may have done it but the Greeks did it
     first. &lt;em&gt;Saturday day school 25th October 1997&lt;/em&gt;
    &lt;/td&gt;
    &lt;td&gt;H30&lt;/td&gt;
    &lt;td&gt;£18&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
&lt;/pre&gt;
A graphical user agent might render this as:&lt;br /&gt;
&lt;img alt=&quot;A table with merged cells&quot; src=&quot;http://www.w3.org/TR/html401/images/table2.gif&quot; /&gt;&lt;br /&gt;
Note the use of the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-scope&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;scope&lt;/samp&gt;&lt;/a&gt; attribute with the &quot;row&quot; value. Although the first  cell in each row contains data, not header information, the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-scope&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;scope&lt;/samp&gt;&lt;/a&gt; attribute makes  the data cell behave like a row header cell. This allows speech synthesizers to  provide the relevant course name upon request or to state it immediately before  each cell&#39;s content.&lt;/div&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.4.2&quot;&gt;11.4.2&lt;/a&gt; &lt;span class=&quot;index-inst&quot; title=&quot;table::categorization of cells&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;multi-dimension&quot;&gt;Categorizing  cells&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;br /&gt;
Users browsing a table with a speech-based user agent may wish to hear an  explanation of a cell&#39;s contents in addition to the contents themselves. One way  the user might provide an explanation is by speaking associated header  information before speaking the data cell&#39;s contents (see the section on &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#header-data&quot;&gt;associating header information with data cells&lt;/a&gt;).&lt;br /&gt;
&lt;br /&gt;
Users may also want information about more than one cell, in which case  header information provided at the cell level (by &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-headers&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;headers&lt;/samp&gt;&lt;/a&gt;, &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-scope&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;scope&lt;/samp&gt;&lt;/a&gt;,  and &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-abbr&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;abbr&lt;/samp&gt;&lt;/a&gt;) may not provide adequate context. Consider the  following table, which classifies expenses for meals, hotels, and transport in  two locations (San Jose and Seattle) over several days:&lt;br /&gt;
&lt;br /&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;img alt=&quot;Image of a table listing travel expenses at two locations: San Jose and Seattle, by date, and category (meals, hotels, and transport), shown with subtitles&quot; height=&quot;207&quot; src=&quot;http://www.w3.org/TR/html401/images/table1.gif&quot; width=&quot;399&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
Users might want to extract information from the table in the form of  queries:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&quot;What did I spend for all my meals?&quot;
&lt;li&gt;&quot;What did I spend for meals on 25 August?&quot;
&lt;li&gt;&quot;What did I spend for all expenses in San Jose?&quot; &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Each query involves a computation by the user agent that may involve zero or  more cells. In order to determine, for example, the costs of meals on 25 August,  the user agent must know which table cells refer to &quot;Meals&quot; (all of them) and  which refer to &quot;Dates&quot; (specifically, 25 August), and find the intersection of  the two sets.&lt;br /&gt;
&lt;br /&gt;
To accommodate this type of query, the HTML 4 table model allows authors to  place cell headers and data into categories. For example, for the travel expense  table, an author could group the header cells &quot;San Jose&quot; and &quot;Seattle&quot; into the  category &quot;Location&quot;, the headers &quot;Meals&quot;, &quot;Hotels&quot;, and &quot;Transport&quot; in the  category &quot;Expenses&quot;, and the four days into the category &quot;Date&quot;. The previous  three questions would then have the following meanings:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&quot;What did I spend for all my meals?&quot; means &quot;What are all the data cells in  the &quot;Expenses=Meals&quot; category?
&lt;li&gt;&quot;What did I spend for meals on 25 August?&quot; means &quot;What are all the data  cells in the &quot;Expenses=Meals&quot; and &quot;Date=Aug-25-1997&quot; categories?
&lt;li&gt;&quot;What did I spend for all expenses in San Jose?&quot; means &quot;What are all the  data cells in the &quot;Expenses=Meals, Hotels, Transport&quot; and &quot;Location=San Jose&quot;  categories? &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Authors categorize a header or data cell by setting the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-axis&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;axis&lt;/samp&gt;&lt;/a&gt; attribute for the  cell. For instance, in the travel expense table, the cell containing the  information &quot;San Jose&quot; could be placed in the &quot;Location&quot; category as  follows:&lt;br /&gt;
&lt;pre class=&quot;example&quot;&gt;  &lt;th axis=&quot;location&quot; id=&quot;a6&quot;&gt;San Jose&lt;/th&gt;
&lt;/pre&gt;
&lt;br /&gt;
Any cell containing information related to &quot;San Jose&quot; should refer to this  header cell via either the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-headers&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;headers&lt;/samp&gt;&lt;/a&gt; or the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-scope&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;scope&lt;/samp&gt;&lt;/a&gt; attribute.  Thus, meal expenses for 25-Aug-1997 should be marked up to refer to &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-id&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;id&lt;/samp&gt;&lt;/a&gt;  attribute (whose value here is &quot;a6&quot;) of the &quot;San Jose&quot; header cell:&lt;br /&gt;
&lt;pre&gt;  
  &lt;td headers=&quot;a6&quot;&gt;37.74&lt;/td&gt;
&lt;/pre&gt;
&lt;br /&gt;
Each &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-headers&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;headers&lt;/samp&gt;&lt;/a&gt; attribute provides a list of &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/global.html#adef-id&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;id&lt;/samp&gt;&lt;/a&gt; references. Authors  may thus categorize a given cell in any number of ways (or, along any number of  &quot;headers&quot;, hence the name).&lt;br /&gt;
&lt;br /&gt;
Below we mark up the travel expense table with category information:&lt;br /&gt;
&lt;pre class=&quot;example&quot;&gt;&lt;table border=&quot;1&quot; summary=&quot;This table summarizes travel expenses
                   incurred during August trips to
                   San Jose and Seattle&quot;&gt;
&lt;caption&gt;
  Travel Expense Report
&lt;/caption&gt;
&lt;tr&gt;
  &lt;th&gt;&lt;/th&gt;
  &lt;th axis=&quot;expenses&quot; id=&quot;a2&quot;&gt;Meals&lt;/th&gt;
  &lt;th axis=&quot;expenses&quot; id=&quot;a3&quot;&gt;Hotels&lt;/th&gt;
  &lt;th axis=&quot;expenses&quot; id=&quot;a4&quot;&gt;Transport&lt;/th&gt;
  &lt;td&gt;subtotals&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th axis=&quot;location&quot; id=&quot;a6&quot;&gt;San Jose&lt;/th&gt;
  &lt;th&gt;&lt;/th&gt;
  &lt;th&gt;&lt;/th&gt;
  &lt;th&gt;&lt;/th&gt;
  &lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td axis=&quot;date&quot; id=&quot;a7&quot;&gt;25-Aug-97&lt;/td&gt;
  &lt;td headers=&quot;a6 a7 a2&quot;&gt;37.74&lt;/td&gt;
  &lt;td headers=&quot;a6 a7 a3&quot;&gt;112.00&lt;/td&gt;
  &lt;td headers=&quot;a6 a7 a4&quot;&gt;45.00&lt;/td&gt;
  &lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td axis=&quot;date&quot; id=&quot;a8&quot;&gt;26-Aug-97&lt;/td&gt;
  &lt;td headers=&quot;a6 a8 a2&quot;&gt;27.28&lt;/td&gt;
  &lt;td headers=&quot;a6 a8 a3&quot;&gt;112.00&lt;/td&gt;
  &lt;td headers=&quot;a6 a8 a4&quot;&gt;45.00&lt;/td&gt;
  &lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;subtotals&lt;/td&gt;
  &lt;td&gt;65.02&lt;/td&gt;
  &lt;td&gt;224.00&lt;/td&gt;
  &lt;td&gt;90.00&lt;/td&gt;
  &lt;td&gt;379.02&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th axis=&quot;location&quot; id=&quot;a10&quot;&gt;Seattle&lt;/th&gt;
  &lt;th&gt;&lt;/th&gt;
  &lt;th&gt;&lt;/th&gt;
  &lt;th&gt;&lt;/th&gt;
  &lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td axis=&quot;date&quot; id=&quot;a11&quot;&gt;27-Aug-97&lt;/td&gt;
  &lt;td headers=&quot;a10 a11 a2&quot;&gt;96.25&lt;/td&gt;
  &lt;td headers=&quot;a10 a11 a3&quot;&gt;109.00&lt;/td&gt;
  &lt;td headers=&quot;a10 a11 a4&quot;&gt;36.00&lt;/td&gt;
  &lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td axis=&quot;date&quot; id=&quot;a12&quot;&gt;28-Aug-97&lt;/td&gt;
  &lt;td headers=&quot;a10 a12 a2&quot;&gt;35.00&lt;/td&gt;
  &lt;td headers=&quot;a10 a12 a3&quot;&gt;109.00&lt;/td&gt;
  &lt;td headers=&quot;a10 a12 a4&quot;&gt;36.00&lt;/td&gt;
  &lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;subtotals&lt;/td&gt;
  &lt;td&gt;131.25&lt;/td&gt;
  &lt;td&gt;218.00&lt;/td&gt;
  &lt;td&gt;72.00&lt;/td&gt;
  &lt;td&gt;421.25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;Totals&lt;/th&gt;
  &lt;td&gt;196.27&lt;/td&gt;
  &lt;td&gt;442.00&lt;/td&gt;
  &lt;td&gt;162.00&lt;/td&gt;
  &lt;td&gt;800.27&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/pre&gt;
&lt;br /&gt;
Note that marking up the table this way also allows user agents to avoid  confusing the user with unwanted information. For instance, if a speech  synthesizer were to speak all of the figures in the &quot;Meals&quot; column of this table  in response to the query &quot;What were all my meal expenses?&quot;, a user would not be  able to distinguish a day&#39;s expenses from subtotals or totals. By carefully  categorizing cell data, authors allow user agents to make important semantic  distinctions when rendering.&lt;br /&gt;
&lt;br /&gt;
Of course, there is no limit to how authors may categorize information in a  table. In the travel expense table, for example, we could add the additional  categories &quot;subtotals&quot; and &quot;totals&quot;.&lt;br /&gt;
&lt;br /&gt;
This specification does not require user agents to handle information  provided by the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-axis&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;axis&lt;/samp&gt;&lt;/a&gt; attribute, nor does it make any recommendations  about how user agents may present &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-axis&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;axis&lt;/samp&gt;&lt;/a&gt; information to  users or how users may query the user agent about this information.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;index-inst&quot; title=&quot;table::speaking cell data&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx-table-18&quot;&gt;However, user agents, particularly speech  synthesizers,&lt;/a&gt;&lt;/span&gt; may want to factor out information common to several  cells that are the result of a query. For instance, if the user asks &quot;What did I  spend for meals in San Jose?&quot;, the user agent would first determine the cells in  question (25-Aug-1997: 37.74, 26-Aug-1997:27.28), then render this information.  A user agent speaking this information might read it:&lt;br /&gt;
&lt;pre class=&quot;example&quot;&gt;   Location: San Jose. Date: 25-Aug-1997. Expenses, Meals: 37.74
   Location: San Jose. Date: 26-Aug-1997. Expenses, Meals: 27.28
&lt;/pre&gt;
&lt;br /&gt;
or, more compactly:&lt;br /&gt;
&lt;pre class=&quot;example&quot;&gt;   San Jose, 25-Aug-1997, Meals: 37.74
   San Jose, 26-Aug-1997, Meals: 27.28
&lt;/pre&gt;
&lt;br /&gt;
An even more economical rendering would factor the common information and  reorder it:&lt;br /&gt;
&lt;pre class=&quot;example&quot;&gt;   San Jose, Meals, 25-Aug-1997: 37.74
                    26-Aug-1997: 27.28
&lt;/pre&gt;
&lt;br /&gt;
User agents that support this type of rendering should allow user agents a  means to customize rendering (e.g., through style sheets).&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.4.3&quot;&gt;11.4.3&lt;/a&gt; &lt;span class=&quot;index-inst&quot; title=&quot;table::algorithm to find heading&quot;&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx-table-19&quot;&gt;Algorithm to find  heading information&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;br /&gt;
In the absence of header information from either the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-scope&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;scope&lt;/samp&gt;&lt;/a&gt; or &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-headers&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;headers&lt;/samp&gt;&lt;/a&gt; attribute, user agents may construct header  information according to the following algorithm. The goal of the algorithm is  to find an ordered list of headers. (In the following description of the  algorithm the &lt;a href=&quot;http://www.w3.org/TR/html401/struct/tables.html#table-directionality&quot;&gt;table directionality&lt;/a&gt; is  assumed to be left-to-right.)&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;First, search left from the cell&#39;s position to find row header cells. Then  search upwards to find column header cells. The search in a given direction  stops when the edge of the table is reached or when a data cell is found after a  header cell.
&lt;li&gt;Row headers are inserted into the list in the order they appear in the  table. For left-to-right tables, headers are inserted from left to right.
&lt;li&gt;Column headers are inserted after row headers, in the order they appear in  the table, from top to bottom.
&lt;li&gt;If a header cell has the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-headers&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;headers&lt;/samp&gt;&lt;/a&gt; attribute  set, then the headers referenced by this attribute are inserted into the list  and the search stops for the current direction.
&lt;li&gt;&lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#edef-TD&quot;&gt;&lt;samp class=&quot;einst&quot;&gt;TD&lt;/samp&gt;&lt;/a&gt;  cells that set the &lt;a class=&quot;noxref&quot; href=&quot;http://www.w3.org/TR/html401/struct/tables.html#adef-axis&quot;&gt;&lt;samp class=&quot;ainst&quot;&gt;axis&lt;/samp&gt;&lt;/a&gt; attribute are also treated as header cells. &lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;h-11.5&quot;&gt;11.5&lt;/a&gt; &lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;sample&quot;&gt;Sample table&lt;/a&gt;&lt;/h2&gt;
&lt;br /&gt;
This sample illustrates grouped rows and columns. The example is adapted from  &quot;Developing International Software&quot;, by Nadine Kano.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;example&quot;&gt;
In &quot;ascii art&quot;, the following table:&lt;br /&gt;
&lt;pre&gt;&lt;table border=&quot;2&quot; frame=&quot;hsides&quot; rules=&quot;groups&quot; summary=&quot;Code page support in different versions
                   of MS Windows.&quot;&gt;
&lt;caption&gt;CODE-PAGE SUPPORT IN MICROSOFT WINDOWS&lt;/caption&gt;
&lt;colgroup align=&quot;center&quot;&gt;
&lt;colgroup align=&quot;left&quot;&gt;
&lt;colgroup align=&quot;center&quot; span=&quot;2&quot;&gt;
&lt;colgroup align=&quot;center&quot; span=&quot;3&quot;&gt;
&lt;thead valign=&quot;top&quot;&gt;
&lt;tr&gt;
&lt;th&gt;Code-Page
ID
&lt;th&gt;Name
&lt;th&gt;ACP
&lt;th&gt;OEMCP
&lt;th&gt;Windows
NT 3.1
&lt;th&gt;Windows
NT 3.51
&lt;th&gt;Windows
95
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1200&lt;td&gt;Unicode (BMP of ISO/IEC-10646)&lt;td&gt;&lt;td&gt;&lt;td&gt;X&lt;td&gt;X&lt;td&gt;*
&lt;tr&gt;&lt;td&gt;1250&lt;td&gt;Windows 3.1 Eastern European&lt;td&gt;X&lt;td&gt;&lt;td&gt;X&lt;td&gt;X&lt;td&gt;X
&lt;tr&gt;&lt;td&gt;1251&lt;td&gt;Windows 3.1 Cyrillic&lt;td&gt;X&lt;td&gt;&lt;td&gt;X&lt;td&gt;X&lt;td&gt;X
&lt;tr&gt;&lt;td&gt;1252&lt;td&gt;Windows 3.1 US (ANSI)&lt;td&gt;X&lt;td&gt;&lt;td&gt;X&lt;td&gt;X&lt;td&gt;X
&lt;tr&gt;&lt;td&gt;1253&lt;td&gt;Windows 3.1 Greek&lt;td&gt;X&lt;td&gt;&lt;td&gt;X&lt;td&gt;X&lt;td&gt;X
&lt;tr&gt;&lt;td&gt;1254&lt;td&gt;Windows 3.1 Turkish&lt;td&gt;X&lt;td&gt;&lt;td&gt;X&lt;td&gt;X&lt;td&gt;X
&lt;tr&gt;&lt;td&gt;1255&lt;td&gt;Hebrew&lt;td&gt;X&lt;td&gt;&lt;td&gt;&lt;td&gt;&lt;td&gt;X
&lt;tr&gt;&lt;td&gt;1256&lt;td&gt;Arabic&lt;td&gt;X&lt;td&gt;&lt;td&gt;&lt;td&gt;&lt;td&gt;X
&lt;tr&gt;&lt;td&gt;1257&lt;td&gt;Baltic&lt;td&gt;X&lt;td&gt;&lt;td&gt;&lt;td&gt;&lt;td&gt;X
&lt;tr&gt;&lt;td&gt;1361&lt;td&gt;Korean (Johab)&lt;td&gt;X&lt;td&gt;&lt;td&gt;&lt;td&gt;**&lt;td&gt;X
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;437&lt;td&gt;MS-DOS United States&lt;td&gt;&lt;td&gt;X&lt;td&gt;X&lt;td&gt;X&lt;td&gt;X
&lt;tr&gt;&lt;td&gt;708&lt;td&gt;Arabic (ASMO 708)&lt;td&gt;&lt;td&gt;X&lt;td&gt;&lt;td&gt;&lt;td&gt;X
&lt;tr&gt;&lt;td&gt;709&lt;td&gt;Arabic (ASMO 449+, BCON V4)&lt;td&gt;&lt;td&gt;X&lt;td&gt;&lt;td&gt;&lt;td&gt;X
&lt;tr&gt;&lt;td&gt;710&lt;td&gt;Arabic (Transparent Arabic)&lt;td&gt;&lt;td&gt;X&lt;td&gt;&lt;td&gt;&lt;td&gt;X
&lt;tr&gt;&lt;td&gt;720&lt;td&gt;Arabic (Transparent ASMO)&lt;td&gt;&lt;td&gt;X&lt;td&gt;&lt;td&gt;&lt;td&gt;X
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/th&gt;&lt;/th&gt;&lt;/th&gt;&lt;/th&gt;&lt;/th&gt;&lt;/th&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;&lt;/colgroup&gt;&lt;/colgroup&gt;&lt;/colgroup&gt;&lt;/colgroup&gt;&lt;/table&gt;
&lt;/pre&gt;
would be rendered something like this:&lt;br /&gt;
&lt;pre&gt;                  CODE-PAGE SUPPORT IN MICROSOFT WINDOWS
===============================================================================
Code-Page | Name                         | ACP  OEMCP | Windows Windows Windows
    ID    |                              |            |  NT 3.1 NT 3.51    95
-------------------------------------------------------------------------------
   1200   | Unicode (BMP of ISO 10646)   |            |    X       X       *
   1250   | Windows 3.1 Eastern European |  X         |    X       X       X
   1251   | Windows 3.1 Cyrillic         |  X         |    X       X       X
   1252   | Windows 3.1 US (ANSI)        |  X         |    X       X       X
   1253   | Windows 3.1 Greek            |  X         |    X       X       X
   1254   | Windows 3.1 Turkish          |  X         |    X       X       X
   1255   | Hebrew                       |  X         |                    X
   1256   | Arabic                       |  X         |                    X
   1257   | Baltic                       |  X         |                    X
   1361   | Korean (Johab)               |  X         |            **      X
-------------------------------------------------------------------------------
    437   | MS-DOS United States         |        X   |    X       X       X
    708   | Arabic (ASMO 708)            |        X   |                    X
    709   | Arabic (ASMO 449+, BCON V4)  |        X   |                    X
    710   | Arabic (Transparent Arabic)  |        X   |                    X
    720   | Arabic (Transparent ASMO)    |        X   |                    X
===============================================================================
&lt;/pre&gt;
A graphical user agent might render this as:&lt;br /&gt;
&lt;img alt=&quot;A table with grouped rows and columns&quot; src=&quot;http://www.w3.org/TR/html401/images/table3.gif&quot; /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/8098784150101620121/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2012/11/html-tutorial-introduction-to-tables.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/8098784150101620121'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/8098784150101620121'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2012/11/html-tutorial-introduction-to-tables.html' title='HTML Tutorial - Introduction to tables'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-5012144832736505613</id><published>2012-11-25T20:29:00.000+03:00</published><updated>2012-11-25T20:29:50.655+03:00</updated><title type='text'>C# Uppercase First Letter</title><content type='html'>Strings sometimes have lowercase &lt;b&gt;first letters&lt;/b&gt;. Uppercasing the first letter is often necessary. The string has its first letter uppercased. It is then returned with the remaining part unchanged. This is the functionality of the ucfirst function from PHP and Perl. And strings with multiple words can be changed to title case.&lt;pre&gt;&lt;b&gt;Input and output&lt;/b&gt;

Input:  samuel
	julia
	john smith

Output: Samuel
	Julia
	John smith [only first letter]&lt;/pre&gt;
&lt;h2&gt;
Examples&lt;/h2&gt;
First, the goal of these methods is to return correctly uppercased strings in an efficient way. We provide an example of a C# method that uppercases the first letter. The method first here is the slower of the two. The benchmark is presented after the two programs.&lt;pre&gt;&lt;b&gt;Program that uppercases words [C#]&lt;/b&gt;

using System;

class Program
{
    static void Main()
    {
	Console.WriteLine(UppercaseFirst(&quot;samuel&quot;));
	Console.WriteLine(UppercaseFirst(&quot;julia&quot;));
	Console.WriteLine(UppercaseFirst(&quot;john smith&quot;));
    }

    static string &lt;u&gt;UppercaseFirst&lt;/u&gt;(string s)
    {
	&lt;i&gt;// Check for empty string.&lt;/i&gt;
	if (string.IsNullOrEmpty(s))
	{
	    return string.Empty;
	}
	&lt;i&gt;// Return char and concat substring.&lt;/i&gt;
	return char.ToUpper(s[0]) + s.Substring(1);
    }
}

&lt;b&gt;Output&lt;/b&gt;

Samuel
Julia
John smith&lt;/pre&gt;
&lt;b&gt;Next,&lt;/b&gt;we look at a method that uses the ToCharArray method instead. I investigated ToCharArray and its performance impact on this sort of character-based method. The following is the faster version, and it returns the same results.&lt;pre&gt;&lt;b&gt;Another program that uppercases [C#]&lt;/b&gt;

using System;

class Program
{
    static void Main()
    {
	Console.WriteLine(UppercaseFirst(&quot;samuel&quot;));
	Console.WriteLine(UppercaseFirst(&quot;julia&quot;));
	Console.WriteLine(UppercaseFirst(&quot;john smith&quot;));
    }

    static string &lt;u&gt;UppercaseFirst&lt;/u&gt;(string s)
    {
	if (string.IsNullOrEmpty(s))
	{
	    return string.Empty;
	}
	char[] a = s.ToCharArray();
	a[0] = char.ToUpper(a[0]);
	return new string(a);
    }
}

&lt;b&gt;Output&lt;/b&gt;

Samuel
Julia
John smith&lt;/pre&gt;
&lt;img alt=&quot;Performance optimization&quot; height=&quot;76&quot; src=&quot;http://www.dotnetperls.com/performance.png&quot; width=&quot;220&quot; /&gt;&lt;br /&gt;
&lt;b&gt;Here are my results&lt;/b&gt;from testing 1,000,000 iterations of these functions in a loop over the string &quot;michael&quot;. This test is in my ASP.NET application, so the environment is the same as it will be in my ASP.NET app as it is updated on the Internet.&lt;pre&gt;&lt;b&gt;Benchmark results&lt;/b&gt;

UppercaseFirst method:           &lt;span id=&quot;o&quot;&gt;0.1636 seconds&lt;/span&gt;
UppercaseFirst with ToCharArray: &lt;span id=&quot;o&quot;&gt;0.0920 seconds&lt;/span&gt; [faster]&lt;/pre&gt;
&lt;b&gt;The second approach&lt;/b&gt;is faster because it only allocates one new string in the return statement. The first approach allocates two strings: the Substring(1), and then a new string with string.Concat.&lt;br /&gt;
&lt;a href=&quot;http://www.dotnetperls.com/return&quot;&gt;Return&lt;/a&gt;&lt;a href=&quot;http://www.dotnetperls.com/substring&quot;&gt;Substring&lt;/a&gt;&lt;a href=&quot;http://www.dotnetperls.com/string-concat&quot;&gt;Concat&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;
Uppercase words&lt;/h2&gt;
&lt;img alt=&quot;Programming tip&quot; height=&quot;105&quot; src=&quot;http://www.dotnetperls.com/tip.png&quot; width=&quot;170&quot; /&gt;&lt;br /&gt;
This program defines a method named UppercaseWords that is equivalent to the ucwords function in scripting languages such as PHP. The UppercaseWords method internally converts the string to a character array buffer.&lt;b&gt;The char array data is mutable,&lt;/b&gt;which means you can change it without reallocating or filling up the managed heap. The method mutates the character buffer and then returns a new string from the string constructor based on the mutated buffer.&lt;pre&gt;&lt;b&gt;Program that uppercases first letters [C#]&lt;/b&gt;

using System;

class Program
{
    static string &lt;u&gt;UppercaseWords&lt;/u&gt;(string value)
    {
	char[] array = value.ToCharArray();
	&lt;i&gt;// Handle the first letter in the string.&lt;/i&gt;
	if (array.Length &amp;gt;= 1)
	{
	    if (char.IsLower(array[0]))
	    {
		array[0] = char.ToUpper(array[0]);
	    }
	}
	&lt;i&gt;// Scan through the letters, checking for spaces.
	// ... Uppercase the lowercase letters following spaces.&lt;/i&gt;
	for (int i = 1; i &amp;lt; array.Length; i++)
	{
	    if (array[i - 1] == &#39; &#39;)
	    {
		if (char.IsLower(array[i]))
		{
		    array[i] = char.ToUpper(array[i]);
		}
	    }
	}
	return new string(array);
    }

    static void Main()
    {
	&lt;i&gt;// Uppercase words in these strings.&lt;/i&gt;
	const string value1 = &quot;something in the way&quot;;
	const string value2 = &quot;dot net PERLS&quot;;
	const string value3 = &quot;String_two;three&quot;;
	const string value4 = &quot; sam&quot;;
	&lt;i&gt;// ... Compute the uppercase strings.&lt;/i&gt;
	Console.WriteLine(&lt;u&gt;UppercaseWords&lt;/u&gt;(value1));
	Console.WriteLine(&lt;u&gt;UppercaseWords&lt;/u&gt;(value2));
	Console.WriteLine(&lt;u&gt;UppercaseWords&lt;/u&gt;(value3));
	Console.WriteLine(&lt;u&gt;UppercaseWords&lt;/u&gt;(value4));
    }
}

&lt;b&gt;Output&lt;/b&gt;

Something In The Way
Dot Net PERLS
String_two;three
 Sam&lt;/pre&gt;
&lt;img alt=&quot;Note&quot; height=&quot;175&quot; src=&quot;http://www.dotnetperls.com/note.png&quot; width=&quot;131&quot; /&gt;&lt;br /&gt;
&lt;b&gt;The program defines&lt;/b&gt;the UppercaseWords static method, which is equivalent to the ucwords function in scripting languages. Internally, the method body of the UppercaseWords method first tests the first character of the string.&lt;div id=&quot;y&quot;&gt;
&lt;b id=&quot;e&quot;&gt;Note:&lt;/b&gt;It special-cases the first character because the loop in the next part does not correctly allow for the very first character. The if-statement is validated in the test cases when the first two strings have their first letters uppercased.&lt;/div&gt;
&lt;a href=&quot;http://www.dotnetperls.com/if&quot; id=&quot;y&quot;&gt;If&lt;/a&gt;&lt;img alt=&quot;For loop&quot; height=&quot;126&quot; src=&quot;http://www.dotnetperls.com/for.png&quot; width=&quot;215&quot; /&gt;&lt;br /&gt;
&lt;b&gt;For-loop.&lt;/b&gt;The next part of the UppercaseWords method does a for-loop through all the characters in the string starting at the second character with index of one. In each iteration it tests the previous character for a space. If it detects a space, it modifies the character array buffer to have an uppercase character.&lt;br /&gt;
&lt;a href=&quot;http://www.dotnetperls.com/for&quot;&gt;For&lt;/a&gt;&lt;img alt=&quot;Split strings&quot; height=&quot;88&quot; src=&quot;http://www.dotnetperls.com/split-2.png&quot; width=&quot;230&quot; /&gt;&lt;br /&gt;
&lt;b&gt;Efficiency notes.&lt;/b&gt;The UppercaseWords method could be implemented by first splitting on the sub-words in the string based on a regular expression or the Split method. But this would result in many more allocations—one for the array reference data and one for each word.&lt;br /&gt;
&lt;a href=&quot;http://www.dotnetperls.com/split&quot;&gt;Split&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;y&quot;&gt;
&lt;b id=&quot;r&quot;&gt;However:&lt;/b&gt;You could use the Regex.Split method for a better algorithm of breaking up the words.&lt;/div&gt;
&lt;a href=&quot;http://www.dotnetperls.com/regex-split&quot; id=&quot;y&quot;&gt;Regex.Split&lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;y&quot;&gt;
&lt;b id=&quot;e&quot;&gt;Note:&lt;/b&gt;The method does not contain sophisticated error correction and does not handle some words—such as and, the, and a—differently.&lt;h2&gt;
ToTitleCase&lt;/h2&gt;
&lt;img height=&quot;105&quot; src=&quot;http://www.dotnetperls.com/tip.png&quot; width=&quot;170&quot; /&gt;&lt;br /&gt;
You might not be in the mood for deploying a custom method for uppercasing the first letter in each word in a string. You can use the ToTitleCase method on the TextInfo type—it does the same thing. Using ToTitleCase will make handling certain special cases harder.&lt;br /&gt;
&lt;a href=&quot;http://www.dotnetperls.com/totitlecase&quot;&gt;ToTitleCase&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;
Summary&lt;/h2&gt;
&lt;a href=&quot;http://www.dotnetperls.com/string&quot; id=&quot;a&quot;&gt;&lt;img alt=&quot;The C# programming language&quot; height=&quot;149&quot; src=&quot;http://www.dotnetperls.com/c.png&quot; width=&quot;240&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
We looked at methods that uppercase the first character in strings using the C# language. They are useful for database results that may not be formatted correctly. Custom logic for certain names can be added.&lt;div id=&quot;y&quot;&gt;
&lt;b id=&quot;g&quot;&gt;Normally:&lt;/b&gt;The performance requirements are not strict here.&lt;div id=&quot;y&quot;&gt;
&lt;b id=&quot;r&quot;&gt;But:&lt;/b&gt;Occasionally the benchmarks here may be useful. We can capitalize also strings that have multiple words.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/5012144832736505613/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2012/11/c-uppercase-first-letter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/5012144832736505613'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/5012144832736505613'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2012/11/c-uppercase-first-letter.html' title='C# Uppercase First Letter'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-6268932277316988727</id><published>2012-11-25T20:25:00.002+03:00</published><updated>2012-11-25T20:30:01.729+03:00</updated><title type='text'>How to Capitalize the First Letter of All Words in a string in C# </title><content type='html'>Often we need to capitalize the first letters of some word or some text (for example when we want to display users name or city name etc).&lt;br /&gt;Since &lt;b&gt;string &lt;/b&gt;class does not have a method to do this we could think that there is no built-in solution in C# for this problem...&lt;br /&gt;&lt;br /&gt;But a little digging trough MSDN would help us find &lt;b&gt;ToTitleCase  &lt;/b&gt;method of &lt;b&gt;TextInfo &lt;/b&gt;class in System.Globalization namespace that does exactly what we need: capitalizes the first letter of each word in the string.&lt;br /&gt;&lt;br /&gt;here is how to use it:&lt;br /&gt;&lt;br /&gt;
&lt;div style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: 0% 50% white; color: black; font-family: Courier New; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;margin: 0px;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt; System.Globalization;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt; &lt;br /&gt;
&lt;div style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: 0% 50% white; color: black; font-family: Courier New; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;margin: 0px;&quot;&gt;
  ...&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt; &lt;br /&gt;
&lt;div style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: 0% 50% white; color: black; font-family: Courier New; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;margin: 0px;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; capitalized = &lt;span style=&quot;color: #2b91af;&quot;&gt;CultureInfo&lt;/span&gt;.CurrentCulture.TextInfo.ToTitleCase(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;asp.net simply rocks!!!&quot;&lt;/span&gt;);&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;After the execution, capitalized string would have this value: &lt;b&gt;&quot;Asp.Net Simply Rocks!!!&quot;&lt;/b&gt; which is exactly what we needed, right?&lt;br /&gt;&lt;br /&gt;Off course, how will string be capitalized depends on the current culture that is set on your ASP.NET page, but we can easily override this and use the culture we want like this:&lt;br /&gt;&lt;br /&gt;
&lt;div style=&quot;-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: 0% 50% white; color: black; font-family: Courier New; font-size: 10pt;&quot;&gt;
&lt;div style=&quot;margin: 0px;&quot;&gt;
&lt;span style=&quot;color: #2b91af;&quot;&gt;TextInfo&lt;/span&gt; UsaTextInfo = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;CultureInfo&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;en-US&quot;&lt;/span&gt;, &lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;).TextInfo;&lt;/div&gt;
&lt;div style=&quot;margin: 0px;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; capitalized = UsaTextInfo.ToTitleCase(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;asp.net simply rocks!!!&quot;&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;Have fun!&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;=======================================================&lt;br /&gt;
For more Books / Ads / Lost-Found / Articles / Accommodation. We can help with your busy lifestyle. Take a look around and review our hundreds of free Ads or submit one of your own favorites.  http://www.inhousetoday.com</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/6268932277316988727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2012/11/how-to-capitalize-first-letter-of-all.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/6268932277316988727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/6268932277316988727'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2012/11/how-to-capitalize-first-letter-of-all.html' title='How to Capitalize the First Letter of All Words in a string in C# '/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-3401127433743148967</id><published>2012-11-24T20:35:00.000+03:00</published><updated>2012-11-24T20:35:15.384+03:00</updated><title type='text'>ContactUs page with Capctcha in ASP.NET using C#</title><content type='html'>&lt;div align=&quot;justify&quot;&gt;
&lt;span style=&quot;font-family: Verdana; font-size: x-small;&quot;&gt;Posted by &lt;span&gt;&lt;a class=&quot;LinkBlack&quot; href=&quot;http://www.c-sharpcorner.com/authors/biswapinky/biswa-pujarini-mohapatra.aspx&quot; id=&quot;ctl00_AuthorLink&quot;&gt;Biswa Pujarini Mohapatra&lt;/a&gt; &lt;/span&gt; &lt;label&gt;in&lt;/label&gt; &lt;span class=&quot;LinkRed&quot;&gt;&lt;a class=&quot;LinkRed&quot; href=&quot;http://www.c-sharpcorner.com/Articles/&quot; id=&quot;ctl00_AnchorArticles&quot;&gt;Articles&lt;/a&gt; &lt;/span&gt;| &lt;span class=&quot;LinkNormalBlue&quot;&gt; &lt;a class=&quot;LinkNormalBlue&quot; href=&quot;http://www.c-sharpcorner.com/1/9/visual-C-Sharp.aspx&quot; id=&quot;ctl00_AnchorCategory&quot;&gt;Visual C#&lt;/a&gt; &lt;/span&gt;  &lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;&lt;div class=&quot;detail&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;div class=&quot;LinkNormalGrayLight&quot; style=&quot;margin-bottom: 5px;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;span style=&quot;color: black;&quot;&gt;Tags:&lt;/span&gt; &lt;span id=&quot;ctl00_spanTags&quot;&gt;&lt;a class=&quot;LinkNormalGrayLight&quot; href=&quot;http://www.c-sharpcorner.com/tags/Capctha-using-asp.net&quot;&gt;Capctha using asp.net&lt;/a&gt;, &lt;a class=&quot;LinkNormalGrayLight&quot; href=&quot;http://www.c-sharpcorner.com/tags/Send-Email-using-asp.net&quot;&gt;Send Email using asp.net&lt;/a&gt;, &lt;a class=&quot;LinkNormalGrayLight&quot; href=&quot;http://www.c-sharpcorner.com/tags/ASP.NET&quot;&gt; ASP.NET &lt;/a&gt;, &lt;a class=&quot;LinkNormalGrayLight&quot; href=&quot;http://www.c-sharpcorner.com/tags/Csharp&quot;&gt; C#&lt;/a&gt;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div align=&quot;justify&quot;&gt;
&lt;span style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Using a contact form on your website is  very useful as it helps your web site visitors to communicate with you in an  easy and simple way. But, there are spammers and hackers who are looking for  exploitable web forms. It is essential to secure your form against all &#39;holes&#39;  that those hackers are searching for .&lt;br /&gt; &lt;br /&gt;If you are not validating your form fields (on the serve side) before sending  the emails, then hackers can alter your email headers to send the bulk  unsolicited emails.&lt;br /&gt; &lt;br /&gt; In this article will give tutorial how to create contact Us page with below key  features&lt;br /&gt; &lt;/span&gt;&lt;b&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Key features:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;blockquote&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana; font-size: x-small;&quot;&gt;Contact Us form&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana; font-size: x-small;&quot;&gt;Validations&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana; font-size: x-small;&quot;&gt;Send Email&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana; font-size: x-small;&quot;&gt;Use of Captcha to avoid Spam&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/blockquote&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;Contact Us Form&lt;br /&gt; &lt;br /&gt; &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: blue; font-family: Verdana;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Verdana;&quot;&gt;div&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;padding&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;:  5px 0px 10px 150px&quot;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;id&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;ContentTitle&quot;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;h1&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;                Contact Us&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;h1&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;div&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;id&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;ContentBody&quot;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;table&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;cellpadding&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;2&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;tr&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;class&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;fieldname&quot;&amp;gt;&lt;br /&gt; &lt;/span&gt;                        Email:&lt;br /&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;TextBox&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;txtEmail&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;Width&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;100%&quot;&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;RequiredFieldValidator&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;Display&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;dynamic&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;RequiredFieldValidator1&quot;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;SetFocusOnError&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;true&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ControlToValidate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;txtEmail&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ErrorMessage&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Your Email  is required&quot;&amp;gt;&lt;/span&gt;*&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;RequiredFieldValidator&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;tr&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;class&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;fieldname&quot;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Label&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;lblName&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;AssociatedControlID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;txtName&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;Text&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Full name:&quot;&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;TextBox&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;txtName&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;Width&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;100%&quot;&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;RequiredFieldValidator&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;Display&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;dynamic&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;valRequireName&quot;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;SetFocusOnError&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;true&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ControlToValidate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;txtName&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ErrorMessage&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Your name  is required&quot;&amp;gt;&lt;/span&gt;*&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;RequiredFieldValidator&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0pt;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt; /&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;tr&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;tr&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;class&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;fieldname&quot;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Label&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;lblBody&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;AssociatedControlID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;txtBody&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;Text&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Message:&quot;&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;TextBox&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;txtBody&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;Width&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;100%&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;TextMode&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;MultiLine&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;Rows&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;8&quot;&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;RequiredFieldValidator&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;Display&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;dynamic&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;valRequireBody&quot;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;SetFocusOnError&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;true&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ControlToValidate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;txtBody&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ErrorMessage&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;The  Message is required&quot;&amp;gt;&lt;/span&gt;*&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;RequiredFieldValidator&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;tr&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;tr&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;colspan&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;3&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;fieldname&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;align&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;center&quot;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;img&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;CaptchaPage.aspx&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;alt&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Catcha&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;br&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;p&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;strong&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;Enter  the code shown above:&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;strong&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;br&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;TextBox&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;CodeNumberTextBox&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;TextBox&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;p&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;p&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;em&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;notice&quot;&amp;gt;&lt;/span&gt;(Note:  If you cannot read the numbers in the above&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;br&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;                                image, reload the page to generate a new  one.)&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;em&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;p&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;p&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Label&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;MessageLabel&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ForeColor&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;#CC0000&quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Label&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;p&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;tr&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;tr&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;colspan&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;3&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;align&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;right&quot;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Label&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;lblFeedbackOK&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;Text&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Your message has  been successfully sent.&quot;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;SkinID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;FeedbackOK&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;Visible&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;false&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ForeColor&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;#006600&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;Font-Bold&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;True&quot;&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Label&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;lblFeedbackKO&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;Text&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Sorry, there was a  problem sending your message.&quot;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;SkinID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;FeedbackKO&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;Visible&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;false&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ForeColor&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;#CC0000&quot;&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Button&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;txtSubmit&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;Text&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Send&quot;&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;onclick&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;txtSubmit_Click&quot;&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;ValidationSummary&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;valSummary&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ShowSummary&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;false&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;ShowMessageBox&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;true&quot;&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;tr&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;table&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;div&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;br /&gt; &lt;b&gt;Validating Captcha Image and Send Email&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;Below example will show you how to validate captcha Image before sending an  Email to avoid spam mails&lt;br /&gt; &lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;            MailMessage Message =&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; MailMessage();&lt;br /&gt;            Message.From = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;  MailAddress(txtEmail.Text, txtName.Text + Page.User.Identity.Name);&lt;br /&gt;            Message.To.Add(&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; MailAddress(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;contact@yourdomain.com&quot;&lt;/span&gt;));&lt;br /&gt;            Message.Body = txtBody.Text;&lt;br /&gt;            Message.Subject = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Contact Us&quot;&lt;/span&gt;;&lt;br /&gt;            Message.IsBodyHtml = &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;try&lt;br /&gt; &lt;/span&gt;            {&lt;br /&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.CodeNumberTextBox.Text  == &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.Session[&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;CaptchaImageText&quot;&lt;/span&gt;].ToString())&lt;br /&gt;                {&lt;br /&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.MessageLabel.Text =&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;&quot;&lt;/span&gt;;&lt;br /&gt;                    SmtpClient mailClient = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;  SmtpClient();&lt;br /&gt;                    mailClient.Send(Message);&lt;br /&gt;                    lblFeedbackOK.Visible = &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;;&lt;br /&gt; &lt;br /&gt;}&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;else&lt;br /&gt; &lt;/span&gt;                {&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;// Display an error message.&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.MessageLabel.Text  = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;ERROR: Incorrect, try again.&quot;&lt;/span&gt;;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;// Clear the input and create a  new random code.&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.CodeNumberTextBox.Text  = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;&quot;&lt;/span&gt;;&lt;br /&gt;                    lblFeedbackOK.Visible = &lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.Session[&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;CaptchaImageText&quot;&lt;/span&gt;]  = GenerateRandomCode();&lt;br /&gt;                }&lt;br /&gt; &lt;br /&gt;            }&lt;br /&gt;&lt;span style=&quot;color: blue;&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #2b91af;&quot;&gt;Exception&lt;/span&gt;  ex)&lt;br /&gt;            {&lt;br /&gt;                lblFeedbackKO.Visible = &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;;&lt;br /&gt;            }&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;br /&gt;first off you must import using System&lt;span class=&quot;search-highlight&quot;&gt;.Net&lt;/span&gt;.Mail;  namespace. Then define new SMTP email and collect all the information user  entered in your web&lt;span class=&quot;search-highlight&quot;&gt;page&lt;/span&gt;. Finally send all  the information to recipient as an email.&lt;br /&gt; &lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;system.net&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;mailSettings&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;smtp&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;from&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;yourdomain.com&quot;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;network&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;host&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;mail.yourdomain.com&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;port&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;25&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;userName&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;xxx&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;password&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;xxx&quot;/&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;smtp&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;mailSettings&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;system.net&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/3401127433743148967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2012/11/contactus-page-with-capctcha-in-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/3401127433743148967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/3401127433743148967'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2012/11/contactus-page-with-capctcha-in-aspnet.html' title='ContactUs page with Capctcha in ASP.NET using C#'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-1171043768603379703</id><published>2012-11-03T14:30:00.002+03:00</published><updated>2012-11-03T14:30:31.124+03:00</updated><title type='text'>URL Rewriting in ASP.NET using global.asax and web.config </title><content type='html'>URL rewriting is very important for search engines like google, yahoo, etc. as we know website getting most of the traffic from search engines.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here I am explaining 2 way to rewrite URL in asp.net.&lt;br /&gt;
&lt;br /&gt;
URL rewrining using web.config and URL rewriting using global.asax&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
URL rewrining using web.config:&lt;br /&gt;
&lt;br /&gt;
URL rewriting in web.config is only use for small number of pages. Here you have to rewrite every page manually in web.config. I am writing sample code for 4 urls.&lt;br /&gt;
&lt;br /&gt;
xml version=&quot;1.0&quot;?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;configuration&gt;&lt;/configuration&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;urlmappings enabled=&quot;true&quot;&gt;&lt;/urlmappings&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;add url=&quot;~/About-company.aspx&quot;&gt;&lt;br /&gt;
mappedUrl=&quot;~/index.aspx?id=1&quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;add url=&quot;~/About-products.aspx&quot;&gt;&lt;br /&gt;
mappedUrl=&quot;~/index.aspx?id=2&quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;add url=&quot;~/Contact-us.aspx&quot;&gt;&lt;br /&gt;
mappedUrl=&quot;~/index.aspx?id=3&quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;add url=&quot;~/our-team.aspx&quot;&gt;&lt;br /&gt;
mappedUrl=&quot;~/index.aspx?id=4&quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
urlMappings&amp;gt;&lt;br /&gt;
&lt;br /&gt;
. . .&lt;br /&gt;
&lt;br /&gt;
configuration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
URL rewriting using global.aspx:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This very simple way and very use full. In this way we can rewrite N number of pages and there is no need extra server configuration. Only you have to use Application_BeginRequest event. Inside this event use Context.RewritePath method to set which URL will execute internally in code behind. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void Application_BeginRequest(object sender, EventArgs e)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
// Get the current path&lt;br /&gt;
&lt;br /&gt;
string CurrentURL_Path = Request.Path.ToLower();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if (CurrentURL_Path.StartsWith(&quot;/news/&quot;))&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
CurrentURL_Path = CurrentURL_Path.Trim(&quot;/&quot;);&lt;br /&gt;
&lt;br /&gt;
string NewsID = CurrentPath.Substring(CurrentPath.IndexOf(&quot;/&quot;));&lt;br /&gt;
&lt;br /&gt;
HttpContext MyContext = HttpContext.Current;&lt;br /&gt;
&lt;br /&gt;
MyContext.RewritePath(&quot;/news-show.aspx?News=&quot; + NewsID);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In next article i will write about URL rewriting using HttpModule.&lt;/add&gt;&lt;/add&gt;&lt;/add&gt;&lt;/add&gt;</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/1171043768603379703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2012/11/url-rewriting-in-aspnet-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/1171043768603379703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/1171043768603379703'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2012/11/url-rewriting-in-aspnet-using.html' title='URL Rewriting in ASP.NET using global.asax and web.config '/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-2654230191885317731</id><published>2012-06-29T11:07:00.000+03:00</published><updated>2012-06-29T11:07:58.144+03:00</updated><title type='text'>Uploading Files in ASP.NET 2.0</title><content type='html'>&amp;nbsp;&lt;div id=&quot;ratingCounter&quot; style=&quot;display: block;&quot;&gt;
&lt;span class=&quot;ratingText&quot; id=&quot;rcA&quot;&gt;            252 out of 370 rated this helpful &lt;span id=&quot;rateThisPrefix&quot;&gt;- &lt;/span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa479405#feedback&quot; id=&quot;rateThisTopic&quot; title=&quot;Rate this topic&quot;&gt;Rate this topic&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;a href=&quot;&quot; id=&quot;uploadasp2&quot;&gt;&lt;/a&gt;&lt;div id=&quot;nstext&quot;&gt;
 Bill Evjen&lt;br /&gt;Reuters&lt;br /&gt;
December 2005&lt;br /&gt;
Applies to:&lt;br /&gt;
   Microsoft ASP.NET 2.0&lt;br /&gt;   Microsoft Visual Web Developer 2005 Express Edition&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Summary:&lt;/strong&gt; Learn how to use the new &lt;strong&gt;FileUpload&lt;/strong&gt; server control in Microsoft ASP.NET 2.0. (18 printed pages)&lt;br /&gt;
&lt;h4 class=&quot;dtH1&quot;&gt;
Contents&lt;/h4&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa479405#uploadasp2_topic1&quot;&gt;Introduction&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa479405#uploadasp2_topic2&quot;&gt;An Example of the FileUpload Server Control&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa479405#uploadasp2_topic3&quot;&gt;Conclusion&lt;/a&gt;&lt;br /&gt;
&lt;h2 class=&quot;dtH1&quot;&gt;
&lt;a href=&quot;&quot; id=&quot;uploadasp2_topic1&quot;&gt;&lt;/a&gt;Introduction&lt;/h2&gt;
Ever since Microsoft ASP.NET was introduced with version 1.0, there has been the built-in means of building Web applications that had the ability to upload files to the hosting server. This was done through the use of the &lt;strong&gt;File Field&lt;/strong&gt; HTML server control. I previously wrote an MSDN article on how to effectively use this control in your ASP.NET applications. This article is a reintroduction to the file upload process, but instead of using the File Field control, I will show you how to effectively use the new &lt;strong&gt;FileUpload&lt;/strong&gt; server control that is offered through ASP.NET 2.0.&lt;br /&gt;
It is important to note that while this article introduces you to the new &lt;strong&gt;FileUpload&lt;/strong&gt; server control, it is still quite possible to use the &lt;strong&gt;File Field&lt;/strong&gt; control in your applications today.&lt;br /&gt;
&lt;h2 class=&quot;dtH1&quot;&gt;
&lt;a href=&quot;&quot; id=&quot;uploadasp2_topic2&quot;&gt;&lt;/a&gt;An Example of the FileUpload Server Control&lt;/h2&gt;
When using the &lt;strong&gt;File Field&lt;/strong&gt; control in ASP.NET 1.&lt;em&gt;x&lt;/em&gt; you had to take a few extra steps to get everything in line and working. For example, you were required to add &lt;strong&gt;enctype=&quot;multipart/form-data&quot;&lt;/strong&gt; to the page&#39;s &lt;strong&gt;&lt;form&gt;
&lt;/form&gt;
&lt;/strong&gt; element on your own. The new &lt;strong&gt;FileUpload&lt;/strong&gt; server control provided in ASP.NET 2.0 makes the process of uploading files to the hosting server as simple as possible.&lt;br /&gt;
In the end, you are trying to allow access to program the HTML &lt;strong&gt;&lt;input type=&quot;file&quot; /&gt;&lt;/strong&gt; tag. This tag is used to work with file data within an HTML form. In the past when using classic ASP (ASP 3.0 or earlier), many programmers worked with third-party components to upload files from the client to the server. Now, with .NET and this new control, uploading is taken care of for you. Listing 1 shows you how to use the &lt;strong&gt;FileUpload&lt;/strong&gt; control to upload files to the server.&lt;br /&gt;
&lt;blockquote class=&quot;dtBlock&quot;&gt;
&lt;div&gt;
&lt;strong&gt;Note&lt;/strong&gt;   The sample code is provided in both Microsoft Visual Basic and C#.&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Listing 1. Uploading files to the server using the FileUpload control&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Visual Basic&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_0b666fb4-2bb9-4bba-b0a3-38333a5231be&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_0b666fb4-2bb9-4bba-b0a3-38333a5231be&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;!--Page Language=&quot;VB&quot;--&gt;

&lt;script runat=&quot;server&quot;&gt;
    Protected Sub Button1_Click(ByVal sender As Object, _
      ByVal e As System.EventArgs)
        If FileUpload1.HasFile Then
            Try
                FileUpload1.SaveAs(&quot;C:\Uploads\&quot; &amp;amp; _
                   FileUpload1.FileName)
                Label1.Text = &quot;File name: &quot; &amp;amp; _
                   FileUpload1.PostedFile.FileName &amp;amp; &quot;&lt;br&gt;&quot; &amp;amp; _
                   &quot;File Size: &quot; &amp;amp; _
                   FileUpload1.PostedFile.ContentLength &amp;amp; &quot; kb&lt;br&gt;&quot; &amp;amp; _
                   &quot;Content type: &quot; &amp;amp; _
                   FileUpload1.PostedFile.ContentType
            Catch ex As Exception
                Label1.Text = &quot;ERROR: &quot; &amp;amp; ex.Message.ToString()
            End Try
        Else
            Label1.Text = &quot;You have not specified a file.&quot;
        End If
    End Sub
&lt;/script&gt;



    &lt;title&gt;Upload Files&lt;/title&gt;


    &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt;

    &lt;div&gt;

        &lt;asp:fileupload id=&quot;FileUpload1&quot; runat=&quot;server&quot;&gt;

        

        &lt;asp:button id=&quot;Button1&quot; onclick=&quot;Button1_Click&quot; runat=&quot;server&quot; text=&quot;Upload File&quot;&gt;&amp;nbsp;

        

        &lt;asp:label id=&quot;Label1&quot; runat=&quot;server&quot;&gt;&lt;/asp:label&gt;&lt;/asp:button&gt;&lt;/asp:fileupload&gt;&lt;/div&gt;
&lt;/form&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;C#&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_c652201a-dbc4-4fa8-a1b0-69b456930268&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_c652201a-dbc4-4fa8-a1b0-69b456930268&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;!--Page Language=&quot;C#&quot;--&gt;

&lt;script runat=&quot;server&quot;&gt;
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
            try
            {
                FileUpload1.SaveAs(&quot;C:\\Uploads\\&quot; + 
                     FileUpload1.FileName);
                Label1.Text = &quot;File name: &quot; +
                     FileUpload1.PostedFile.FileName + &quot;&lt;br&gt;&quot; +
                     FileUpload1.PostedFile.ContentLength + &quot; kb&lt;br&gt;&quot; +
                     &quot;Content type: &quot; +
                     FileUpload1.PostedFile.ContentType;
            }
            catch (Exception ex)
            {
                Label1.Text = &quot;ERROR: &quot; + ex.Message.ToString();
            }
        else
        {
            Label1.Text = &quot;You have not specified a file.&quot;;
        }
    }
&lt;/script&gt;



    &lt;title&gt;Upload Files&lt;/title&gt;


    &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt;

    &lt;div&gt;

        &lt;asp:fileupload id=&quot;FileUpload1&quot; runat=&quot;server&quot;&gt;

        

        &lt;asp:button id=&quot;Button1&quot; onclick=&quot;Button1_Click&quot; runat=&quot;server&quot; text=&quot;Upload File&quot;&gt;&amp;nbsp;

        

        &lt;asp:label id=&quot;Label1&quot; runat=&quot;server&quot;&gt;&lt;/asp:label&gt;&lt;/asp:button&gt;&lt;/asp:fileupload&gt;&lt;/div&gt;
&lt;/form&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
Running this page, you will notice a few things if you look at the source code generated for the page. This source code is presented in Listing 2.&lt;br /&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Listing 2. The source code generated from the FileUpload control&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_d0ac127f-3842-4dc4-8280-0b45dd8790e0&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_d0ac127f-3842-4dc4-8280-0b45dd8790e0&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;title&gt;
   Upload Files
&lt;/title&gt;

    &lt;form action=&quot;MyFileUpload.aspx&quot; enctype=&quot;multipart/form-data&quot; id=&quot;form1&quot; method=&quot;post&quot; name=&quot;form1&quot;&gt;

&lt;div&gt;

&lt;input id=&quot;__VIEWSTATE&quot; name=&quot;__VIEWSTATE&quot; type=&quot;hidden&quot; value=&quot;/wEPDwUJNDcxNTg5NDg3D2QWAgIEDxYCHgdlbmN0eXBlBRNtdWx0aXBhcnQvZm9yb
       S1kYXRhZGQUQEUFMY1+/fp1mnrkbqmVNQIzFA==&quot; /&gt;
&lt;/div&gt;
&lt;div&gt;

        &lt;input id=&quot;FileUpload1&quot; name=&quot;FileUpload1&quot; type=&quot;file&quot; /&gt;

        

        &lt;input id=&quot;Button1&quot; name=&quot;Button1&quot; type=&quot;submit&quot; value=&quot;Upload File&quot; /&gt;&amp;nbsp;

        

        &lt;span id=&quot;Label1&quot;&gt;&lt;/span&gt;
    &lt;/div&gt;
&lt;div&gt;


   &lt;input id=&quot;__EVENTVALIDATION&quot; name=&quot;__EVENTVALIDATION&quot; type=&quot;hidden&quot; value=&quot;/wEWAgLB+7jIAwKM54rGBv2Iz6LxVY7jWec0gZMxnuaK2ufq&quot; /&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
The first thing to notice is that because the &lt;strong&gt;FileUpload&lt;/strong&gt; control is on the page, ASP.NET 2.0 modified the page&#39;s &lt;strong&gt;&lt;form&gt;
&lt;/form&gt;
&lt;/strong&gt; element on your behalf by adding the appropriate &lt;strong&gt;enctype&lt;/strong&gt; attribute. You will also notice that the &lt;strong&gt;FileUpload&lt;/strong&gt; control was converted to an HTML &lt;strong&gt;&lt;input type=&quot;file&quot; /&gt;&lt;/strong&gt; element.&lt;br /&gt;
When the page from Listing 1 is run, you can select a file and upload it to the server by clicking the Upload File button on the page. There are some important items we should go over for this example so you understand all the needed pieces to make this work. For the example in Listing 1 to work, you have to make the destination folder on the server writeable for the account used by ASP.NET so the file can be saved to the specified folder.&lt;br /&gt;
If you think your ASP.NET account is not enabled to write to the folder you want, simply open up Microsoft Windows Explorer and navigate to the folder to which you want to add this permission. Right-click on the folder (in this case, the Uploads folder), and then select &lt;strong&gt;Properties&lt;/strong&gt;. In the &lt;strong&gt;Properties&lt;/strong&gt; dialog box, click on the &lt;strong&gt;Security&lt;/strong&gt; tab and make sure the ASP.NET Machine Account is included in the list and has the proper permissions to write to disk (see Figure 1).&lt;br /&gt;
&lt;div class=&quot;fig&quot;&gt;
&lt;img alt=&quot;Aa479405.uploadasp201(en-us,MSDN.10).gif&quot; id=&quot;uploadasp201&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC133227.gif&quot; title=&quot;Aa479405.uploadasp201(en-us,MSDN.10).gif&quot; xmlns=&quot;&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 1. Looking at the Security tab of the Uploads folder&lt;/strong&gt;&lt;/div&gt;
If you don&#39;t see the ASP.NET Machine Account under the Security tab, you can add it by clicking the &lt;strong&gt;Add&lt;/strong&gt; button and entering ASPNET (without the period) in the text area, as illustrated in Figure 2. &lt;br /&gt;
&lt;div class=&quot;fig&quot;&gt;
&lt;img alt=&quot;Aa479405.uploadasp202(en-us,MSDN.10).gif&quot; id=&quot;uploadasp202&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC31186.gif&quot; title=&quot;Aa479405.uploadasp202(en-us,MSDN.10).gif&quot; xmlns=&quot;&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 2. Adding the ASP.NET Machine Account to the folder security definition&lt;/strong&gt;&lt;/div&gt;
Click &lt;strong&gt;OK&lt;/strong&gt; to add the ASP.NET Machine Account to the list. From here, make sure you give this account the proper permissions and then click &lt;strong&gt;OK&lt;/strong&gt;, and you are ready to go.&lt;br /&gt;
The Submit button on the page causes the &lt;strong&gt;Button1_Click&lt;/strong&gt; event to occur. This event uploads the file and then displays a message telling you if the upload was successful by posting information about the file uploaded. If it was unsuccessful, the page displays an error message describing why the upload failed.&lt;br /&gt;
By using the &lt;strong&gt;FileUpload&lt;/strong&gt; control that converts itself to an &lt;strong&gt;&lt;input type=&quot;file&quot; /&gt;&lt;/strong&gt; tag, the browser automatically places a Browse button next to the text field on the ASP.NET page. You don&#39;t have to program anything else for this to occur. When the end user clicks the Browse button, he can navigate through the local file system to find the file to be uploaded to the server. This is shown in Figure 3. Clicking Open will place that filename and the file&#39;s path within the text field.&lt;br /&gt;
&lt;div class=&quot;fig&quot;&gt;
&lt;img alt=&quot;Aa479405.uploadasp203(en-us,MSDN.10).gif&quot; id=&quot;uploadasp203&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC49167.gif&quot; title=&quot;Aa479405.uploadasp203(en-us,MSDN.10).gif&quot; xmlns=&quot;&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 3. Choosing a file&lt;/strong&gt;&lt;/div&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Working Around File Size Limitations&lt;/h3&gt;
You may not realize it, but there is a limit to the size of a file that can be uploaded using this technique. By default, the maximum size of a file to be uploaded to the server using the &lt;strong&gt;FileUpload&lt;/strong&gt; control is around 4MB. You cannot upload anything that is larger than this limit.&lt;br /&gt;
One of the great things about .NET, however, is that it usually provides a way around limitations. You can usually change the default settings that are in place. To change this size limit, you make some changes in either the web.config.comments (found in the ASP.NET 2.0 configuration folder at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG) or your application&#39;s web.config file.&lt;br /&gt;
In the web.config.comments file, find a node called &lt;strong&gt;&lt;httpruntime&gt;&lt;/httpruntime&gt;&lt;/strong&gt; that looks like the following:&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_2a6e085e-e0e4-4858-8c78-0cd399e9c34a&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_2a6e085e-e0e4-4858-8c78-0cd399e9c34a&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;httpruntime apartmentthreading=&quot;false&quot; apprequestqueuelimit=&quot;5000&quot; delaynotificationtimeout=&quot;5&quot; enable=&quot;true&quot; enableheaderchecking=&quot;true&quot; enablekerneloutputcache=&quot;true&quot; enableversionheader=&quot;true&quot; executiontimeout=&quot;110&quot; maxrequestlength=&quot;4096&quot; maxwaitchangenotification=&quot;0&quot; minfreethreads=&quot;8&quot; minlocalrequestfreethreads=&quot;4&quot; requestlengthdiskthreshold=&quot;80&quot; requirerootedsaveaspath=&quot;true&quot; sendcachecontrolheader=&quot;true&quot; shutdowntimeout=&quot;90&quot; usefullyqualifiedredirecturl=&quot;false&quot; waitchangenotification=&quot;0&quot;&gt;

&lt;/httpruntime&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
A lot is going on in this single node, but the setting that takes care of the size of the files to be uploaded is the &lt;strong&gt;maxRequestLength&lt;/strong&gt; attribute. By default, this is set to &lt;strong&gt;4096&lt;/strong&gt; kilobytes (KB). Simply change this value to increase the size of the files that you can upload to the server. If you want to allow 10 megabyte (MB) files to be uploaded to the server, set the &lt;strong&gt;maxRequestLength&lt;/strong&gt; value to &lt;strong&gt;11264&lt;/strong&gt;, meaning that the application allows files that are up to 11000 KB to be uploaded to the server.&lt;br /&gt;
Making this change in the web.config.comments file applies this setting to all the applications that are on the server. If you want to apply this to only the application you are working with, apply this node to the web.config file of your application, overriding any setting that is in the web.config.comments file. Make sure this node resides between the &lt;strong&gt;&lt;system.web&gt;&lt;/system.web&gt;&lt;/strong&gt; nodes in the configuration file.&lt;br /&gt;
Another setting involved in the size limitation of files to be uploaded is the value given to the &lt;strong&gt;executionTimeout&lt;/strong&gt; attribute in the &lt;strong&gt;&lt;httpruntime&gt;&lt;/httpruntime&gt;&lt;/strong&gt; node.&lt;br /&gt;
The value given the &lt;strong&gt;executionTimeout&lt;/strong&gt; attribute is the number of seconds the upload is allowed to occur before being shut down by ASP.NET. If you are going to allow large files to be uploaded to the server, you are also going to want to increase this value along with the &lt;strong&gt;maxRequestLength&lt;/strong&gt; value.&lt;br /&gt;
One negative with increasing the size of a file that can be uploaded is that there are hackers out there who attack servers by throwing a large number of requests at them. To guard against this, you can actually decrease the size of the files that are allowed to be uploaded; otherwise, you may find hundreds or even thousands of 10 MB requests hitting your server.&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Client-Side Validation of File Types Permissible to Upload&lt;/h3&gt;
There are several methods you can use to control the types of files that are uploaded to the server. Unfortunately, there is no bullet-proof method to protect you from someone uploading files that would be considered malicious. You can take a few steps, however, to make this process of allowing end users to upload files a little more manageable.&lt;br /&gt;
One nice method you can employ is to use the ASP.NET validation controls that are provided for free with ASP.NET. These controls enable you to do a regular-expression check upon the file that is being uploaded to see if the extension of the file is one you permit to be uploaded.&lt;br /&gt;
This is ideal for browsers that allow client-side use of the validation controls because it forces the checking to be done on the client; the file is not uploaded to the server if the signature isn&#39;t one you allow. Listing 3 shows you an example of using validation controls to accomplish this task.&lt;br /&gt;
&lt;blockquote class=&quot;dtBlock&quot;&gt;
&lt;div&gt;
&lt;strong&gt;Note&lt;/strong&gt;   The use of validation controls is not explained here. Take a look at &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa479013&quot;&gt;Validating ASP.NET Server Controls&lt;/a&gt; for a complete explanation of validation controls and how to use them in your ASP.NET pages.&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Listing 3. Using validation controls to restrict the types of files uploaded to the server&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_16248706-861b-405b-a6cd-93c952309ff7&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_16248706-861b-405b-a6cd-93c952309ff7&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;asp:fileupload id=&quot;FileUpload1&quot; runat=&quot;server&quot;&gt;



&lt;asp:button id=&quot;Button1&quot; onclick=&quot;Button1_Click&quot; runat=&quot;server&quot; text=&quot;Upload File&quot;&gt;&amp;nbsp;



&lt;asp:label id=&quot;Label1&quot; runat=&quot;server&quot;&gt;&lt;/asp:label&gt;
&lt;asp:regularexpressionvalidator controltovalidate=&quot;FileUpload1&quot; errormessage=&quot;Only mp3, m3u or mpeg files are allowed!&quot; id=&quot;RegularExpressionValidator1&quot; runat=&quot;server&quot; validationexpression=&quot;^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))
    +(.mp3|.MP3|.mpeg|.MPEG|.m3u|.M3U)$&quot;&gt;&lt;/asp:regularexpressionvalidator&gt;


&lt;asp:requiredfieldvalidator controltovalidate=&quot;FileUpload1&quot; errormessage=&quot;This is a required field!&quot; id=&quot;RequiredFieldValidator1&quot; runat=&quot;server&quot;&gt;&lt;/asp:requiredfieldvalidator&gt;

&lt;/asp:button&gt;&lt;/asp:fileupload&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
This simple ASP.NET page uses validation controls so that the end user can only upload .mp3, .mpeg, or .m3u files to the server. If the file type is not one these three choices, a &lt;strong&gt;Validation&lt;/strong&gt; control throws an exception onto the screen. This is shown in Figure 4.&lt;br /&gt;
&lt;div class=&quot;fig&quot;&gt;
&lt;img alt=&quot;Aa479405.uploadasp204(en-us,MSDN.10).gif&quot; id=&quot;uploadasp204&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC73690.gif&quot; title=&quot;Aa479405.uploadasp204(en-us,MSDN.10).gif&quot; xmlns=&quot;&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 4. Validating the file type using validation controls&lt;/strong&gt;&lt;/div&gt;
Using &lt;strong&gt;Validation&lt;/strong&gt; controls is not a foolproof way of controlling the files that are uploaded to the server. It wouldn&#39;t be too hard for someone to change the file extension of a file so it would be accepted and uploaded to the server, thereby bypassing this simple security model.&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Adding Server-Side File Type Validation&lt;/h3&gt;
You just saw an easy way to add some ASP.NET validation server controls to your ASP.NET page to perform a client side validation of the file extension (in just a textual manner). Now let&#39;s take a look at how to perform a similar operation on the server-side. This is presented in Listing 4.&lt;br /&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Listing 4. Checking the file type on the server&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Visual Basic&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_6df06790-70b3-4e3d-827a-6f1202091b9a&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_6df06790-70b3-4e3d-827a-6f1202091b9a&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;    Protected Sub Button1_Click(ByVal sender As Object, _
      ByVal e As System.EventArgs)
        If FileUpload1.HasFile Then
            Dim fileExt As String
            fileExt = System.IO.Path.GetExtension(FileUpload1.FileName)
            
            If (fileExt = &quot;.mp3&quot;) Then
                Try
                    FileUpload1.SaveAs(&quot;C:\Uploads\&quot; &amp;amp; _
                       FileUpload1.FileName)
                    Label1.Text = &quot;File name: &quot; &amp;amp; _
                      FileUpload1.PostedFile.FileName &amp;amp; &quot;
&quot; &amp;amp; _
                      &quot;File Size: &quot; &amp;amp; _
                      FileUpload1.PostedFile.ContentLength &amp;amp; &quot; kb
&quot; &amp;amp; _
                      &quot;Content type: &quot; &amp;amp; _
                      FileUpload1.PostedFile.ContentType
                Catch ex As Exception
                    Label1.Text = &quot;ERROR: &quot; &amp;amp; ex.Message.ToString()
                End Try
            Else
                Label1.Text = &quot;Only .mp3 files allowed!&quot;
            End If
        Else
            Label1.Text = &quot;You have not specified a file.&quot;
        End If
    End Sub

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;C#&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_bd34689a-4e1f-4cca-9bf6-52f1a09f5326&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_bd34689a-4e1f-4cca-9bf6-52f1a09f5326&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;    protected void Button1_Click(object sender, EventArgs e)
    {

        if (FileUpload1.HasFile)
        {
            string fileExt = 
               System.IO.Path.GetExtension(FileUpload1.FileName);

            if (fileExt == &quot;.mp3&quot;)
            {
                try
                {
                    FileUpload1.SaveAs(&quot;C:\\Uploads\\&quot; + 
                       FileUpload1.FileName);
                    Label1.Text = &quot;File name: &quot; +
                        FileUpload1.PostedFile.FileName + &quot;
&quot; +
                        FileUpload1.PostedFile.ContentLength + &quot; kb
&quot; +
                        &quot;Content type: &quot; +
                        FileUpload1.PostedFile.ContentType;
                }
                catch (Exception ex)
                {
                    Label1.Text = &quot;ERROR: &quot; + ex.Message.ToString();
                }
            }
            else
            {
                Label1.Text = &quot;Only .mp3 files allowed!&quot;;
            }
        }
        else
        {
            Label1.Text = &quot;You have not specified a file.&quot;;
        }
    }

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
Now, by using the &lt;strong&gt;GetExtension&lt;/strong&gt; method from the &lt;strong&gt;System.IO.Path&lt;/strong&gt; namespace, you can perform basically the same operation. It is important to note that this doesn&#39;t get around an end user&#39;s ability to simply change the file extension to something that works and upload that altered file to the hosting server.&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Uploading Multiple Files at the Same Time&lt;/h3&gt;
So far, you have seen some good examples of how to upload a file to the server without much hassle. Now let&#39;s take a look at how to upload multiple files to the server from a single page.&lt;br /&gt;
No built-in capabilities in the Microsoft .NET Framework enable you to upload multiple files from a single ASP.NET page. With a little work, however, you can easily accomplish this task just as you would have in the past using .NET 1.&lt;em&gt;x&lt;/em&gt;.&lt;br /&gt;
The trick is to import the &lt;strong&gt;System.IO&lt;/strong&gt; class into your ASP.NET page, and to then use the &lt;strong&gt;HttpFileCollection&lt;/strong&gt; class to capture all the files that are sent in with the &lt;strong&gt;Request&lt;/strong&gt; object. This approach enables you to upload as many files as you want from a single page.&lt;br /&gt;
If you wanted to, you could simply handle each and every &lt;strong&gt;FileUpload&lt;/strong&gt; control on the page individually, as presented in Listing 5.&lt;br /&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Listing 5. Handling each FileUpload control individually&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Visual Basic&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_35293604-13dd-442b-8af6-9bab77fb213d&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_35293604-13dd-442b-8af6-9bab77fb213d&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;If FileUpload1.HasFile Then
   &#39; Handle file
End If

If FileUpload2.HasFile Then
   &#39; Handle file
End If

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;C#&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_1eb1462d-4108-4a9e-ba2a-7aca18ec76fb&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_1eb1462d-4108-4a9e-ba2a-7aca18ec76fb&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;if (FileUpload1.HasFile) {
   // Handle file
}

if (FileUpload2.HasFile) {
   // Handle file
}

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
This approach works, but there may be instances where you are going to want to handle the files using the &lt;strong&gt;HttpFileCollection&lt;/strong&gt; class instead—especially if you are working with a dynamically generated list of server controls.&lt;br /&gt;
For an example of this, you can build an ASP.NET page that has three &lt;strong&gt;FileUpload&lt;/strong&gt; controls and one Submit button (using the Button control). After the user clicks the Submit button and the files are posted to the server, the code behind takes the files and saves them to a specific location on the server. After the files are saved, the file information that was posted is displayed in the ASP.NET page (see Listing 6).&lt;br /&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Listing 6. Uploading multiple files to the server&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Visual Basic&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_1ecfd3ad-17ff-4f14-950c-ad98c1e2efd7&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_1ecfd3ad-17ff-4f14-950c-ad98c1e2efd7&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;Protected Sub Button1_Click(ByVal sender As Object, _
   ByVal e As System.EventArgs)

   Dim filepath As String = &quot;C:\Uploads&quot;
   Dim uploadedFiles As HttpFileCollection = Request.Files
   Dim i As Integer = 0

   Do Until i = uploadedFiles.Count
     Dim userPostedFile As HttpPostedFile = uploadedFiles(i)

     Try
        If (userPostedFile.ContentLength &amp;gt; 0) Then
           Label1.Text += &quot;&lt;u&gt;File #&quot; &amp;amp; (i + 1) &amp;amp; &quot;&lt;/u&gt;
&quot;
           Label1.Text += &quot;File Content Type: &quot; &amp;amp; _
              userPostedFile.ContentType &amp;amp; &quot;
&quot;
           Label1.Text += &quot;File Size: &quot; &amp;amp; _
              userPostedFile.ContentLength &amp;amp; &quot;kb
&quot;
           Label1.Text += &quot;File Name: &quot; &amp;amp; _
              userPostedFile.FileName &amp;amp; &quot;
&quot;

           userPostedFile.SaveAs(filepath &amp;amp; &quot;\&quot; &amp;amp; _
              System.IO.Path.GetFileName(userPostedFile.FileName))

           Label1.Text += &quot;Location where saved: &quot; &amp;amp; _
              filepath &amp;amp; &quot;\&quot; &amp;amp; _
              System.IO.Path.GetFileName(userPostedFile.FileName) &amp;amp; _
              &quot;&quot;
        End If
     Catch ex As Exception
        Label1.Text += &quot;Error:
&quot; &amp;amp; ex.Message
     End Try
     i += 1
   Loop
End Sub

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;C#&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_2c11085e-835d-44f4-830f-c6be46b116b9&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_2c11085e-835d-44f4-830f-c6be46b116b9&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;protected void Button1_Click(object sender, EventArgs e)
{
   string filepath = &quot;C:\\Uploads&quot;;
   HttpFileCollection uploadedFiles = Request.Files;
    
   for (int i = 0; i &amp;lt; uploadedFiles.Count; i++)
   {    
      HttpPostedFile userPostedFile = uploadedFiles[i];
    
      try
      {    
         if (userPostedFile.ContentLength &amp;gt; 0 )
         {
            Label1.Text += &quot;&lt;u&gt;File #&quot; + (i+1) + 
               &quot;&lt;/u&gt;
&quot;;
            Label1.Text += &quot;File Content Type: &quot; + 
               userPostedFile.ContentType + &quot;
&quot;;
            Label1.Text += &quot;File Size: &quot; + 
               userPostedFile.ContentLength + &quot;kb
&quot;;
            Label1.Text += &quot;File Name: &quot; + 
               userPostedFile.FileName + &quot;
&quot;;
    
            userPostedFile.SaveAs(filepath + &quot;\\&quot; + 
               System.IO.Path.GetFileName(userPostedFile.FileName));
    
            Label1.Text += &quot;Location where saved: &quot; + 
               filepath + &quot;\\&quot; + 
               System.IO.Path.GetFileName(userPostedFile.FileName) + 
               &quot;&quot;;
         }    
      } 
      catch (Exception Ex)
      {    
         Label1.Text += &quot;Error: 
&quot; + Ex.Message;    
      }    
   }    
}

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
The end user can select up to four files and click the Upload Files button, which initializes the &lt;strong&gt;Button1_Click&lt;/strong&gt; event. Using the &lt;strong&gt;HttpFileCollection&lt;/strong&gt; class with the &lt;strong&gt;Request.Files&lt;/strong&gt; property lets you gain control over all the files that are uploaded from the page. When the files are in this state, you can do whatever you want with them. In this case, the files&#39; properties are examined and written to the screen. In the end, the files are saved to the Uploads folder in the root directory of the server. The result of this action is illustrated in Figure 5.&lt;br /&gt;
&lt;div class=&quot;fig&quot;&gt;
&lt;img alt=&quot;Aa479405.uploadasp205(en-us,MSDN.10).gif&quot; id=&quot;uploadasp205&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC112747.gif&quot; title=&quot;Aa479405.uploadasp205(en-us,MSDN.10).gif&quot; xmlns=&quot;&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 5. Uploading four files at once to the server from a single ASP.NET page&lt;/strong&gt;&lt;/div&gt;
As you may have noticed, one interesting point about this example is that the states of the file input text boxes are not saved with the postback. You can see this in Figure 5. In ASP.NET, the state of the file-input text boxes cannot be saved because doing so might pose a security risk.&lt;br /&gt;
&lt;h2 class=&quot;dtH1&quot;&gt;
&lt;a href=&quot;&quot; id=&quot;uploadasp2_topic3&quot;&gt;&lt;/a&gt;Conclusion&lt;/h2&gt;
The &lt;strong&gt;FileUpload&lt;/strong&gt; server control provided by ASP.NET is a powerful control that was quite difficult to achieve in the days of Active Server Pages 3.0. This new capability allows your end-users to upload one or more files to your server. Remember, you can control the size of the files that are uploaded by working with settings in either the web.config.comments or web.config file.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;strong&gt;About the author&lt;/strong&gt;Bill Evjen is an active proponent of .NET technologies and community-based learning initiatives for .NET. He is a technical director for &lt;a href=&quot;http://reuters.com/&quot;&gt;Reuters&lt;/a&gt;, the international news and financial services company based in St. Louis, Missouri. Bill is the founder and executive director of the &lt;a href=&quot;http://www.ineta.org/&quot;&gt;International .NET Association (INETA)&lt;/a&gt;, which represents more than 100,000 members worldwide. Bill is also an author and speaker and has written such books as &lt;em&gt;ASP.NET Professional Secrets&lt;/em&gt;, &lt;em&gt;XML Web Services for ASP.NET&lt;/em&gt;, &lt;em&gt;Web Services Enhancements&lt;/em&gt;, and the &lt;em&gt;Visual Basic .NET Bible&lt;/em&gt; (all from &lt;a href=&quot;http://www.wiley.com/&quot;&gt;Wiley&lt;/a&gt;).&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/2654230191885317731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2012/06/uploading-files-in-aspnet-20.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/2654230191885317731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/2654230191885317731'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2012/06/uploading-files-in-aspnet-20.html' title='Uploading Files in ASP.NET 2.0'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-2734273511003550241</id><published>2012-06-29T10:53:00.002+03:00</published><updated>2012-06-29T10:53:41.559+03:00</updated><title type='text'>GridView Examples for ASP.NET 2.0: Drilling Down into Detailed Data</title><content type='html'>In the Filtering the Data Shown in a &lt;strong&gt;GridView&lt;/strong&gt; section we saw how to allow the user to display a list of products in a DropDownList and, for the selected product, list the product&#39;s order details in a &lt;strong&gt;GridView&lt;/strong&gt;. That demo worked well for viewing order details for a specific product, but imagine if you wanted to put more of an emphasis on displaying product information, with viewing the order details for the products being a secondary concern. In such a situation you might want to show a &lt;strong&gt;GridView&lt;/strong&gt; of the products with a way to &quot;select&quot; a particular &lt;strong&gt;GridView&lt;/strong&gt; row. Doing so would then display the order details for the selected product in another &lt;strong&gt;GridView&lt;/strong&gt;.&lt;br /&gt;
This common type of report is often called a drill-down report, since it shows data at one level—the list of products—with the ability to drill down into information specific to a particular product—the list of associated order details. Another common type of drill-down report is used when displaying data that has a lot of properties. For example, the Northwind database has a Customers table with numerous fields. When showing information about customers in a &lt;strong&gt;GridView&lt;/strong&gt;, it might be impractical to list all of the fields of the Customers table in a &lt;strong&gt;GridView&lt;/strong&gt;. Rather, it might make more sense to list only the most germane fields along with a &quot;Details&quot; button in each row that, when clicked, would display the particular customer&#39;s complete information.&lt;br /&gt;
Both of these types of drill-down reports are easily accomplished with the &lt;strong&gt;GridView&lt;/strong&gt; and require no programming. In the next two sections we&#39;ll see just how easy building drill-down reports can be.&lt;br /&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Drilling Down From One to Many&lt;/h3&gt;
One of the many one-to-many relationships in the Northwind database can be found between the Orders or Order Details tables. The Orders table contains a record for each order placed. An order consists of one to many line items, each line item being stored as a record in the Order Details table. To illustrate a one-to-many drill-down report, let&#39;s create an ASP.NET page that lists all available orders in one &lt;strong&gt;GridView&lt;/strong&gt;, where each row in this &lt;strong&gt;GridView&lt;/strong&gt; has a &quot;View Order Details&quot; button that, when clicked, displays the particular order&#39;s line items in another &lt;strong&gt;GridView&lt;/strong&gt;.&lt;br /&gt;
To accomplish this, start by adding a &lt;strong&gt;SqlDataSource&lt;/strong&gt; to the page that retrieves all of the records from the Orders table. Next, add a &lt;strong&gt;GridView&lt;/strong&gt; to the page and bind it to this &lt;strong&gt;SqlDataSource&lt;/strong&gt;. In order to select an item from the &lt;strong&gt;GridView&lt;/strong&gt;, check the Enable Selection link in the &lt;strong&gt;GridView&lt;/strong&gt;&#39;s Smart Tag. This will add a CommandField to the &lt;strong&gt;GridView&lt;/strong&gt; with a Select button.&lt;br /&gt;
&lt;blockquote class=&quot;dtBlock&quot;&gt;
&lt;div&gt;
&lt;strong&gt;Note&lt;/strong&gt;   The CommandField is another type of &lt;strong&gt;GridView&lt;/strong&gt; column type, like the BoundField and ImageField that we examined earlier. The CommandField is used to display common command buttons, such as buttons for selection, deletion, and updating. We&#39;ll see more examples of the CommandField in the demos involving deletion and editing of the &lt;strong&gt;GridView&lt;/strong&gt;&#39;s underlying data.&lt;/div&gt;
&lt;/blockquote&gt;
Next, we need a &lt;strong&gt;SqlDataSource&lt;/strong&gt; that returns the right subset of order details for the selected order. To accomplish this, add another &lt;strong&gt;SqlDataSource&lt;/strong&gt; to the page and configure it to select the appropriate columns from the Order Details table. Next, click the WHERE button and add a WHERE condition on the &lt;strong&gt;OrderID&lt;/strong&gt; field, creating a parameter tied to the Orders &lt;strong&gt;GridView&lt;/strong&gt;&#39;s &lt;strong&gt;SelectedValue&lt;/strong&gt; (see Figure 29).&lt;br /&gt;
&lt;div class=&quot;fig&quot;&gt;
&lt;img alt=&quot;ms972814.gridview_fg29(en-us,MSDN.10).gif&quot; id=&quot;gridview_fg29&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC146153.gif&quot; title=&quot;ms972814.gridview_fg29(en-us,MSDN.10).gif&quot; xmlns=&quot;&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 29&lt;/strong&gt;&lt;/div&gt;
Finally, add another &lt;strong&gt;GridView&lt;/strong&gt; to the page, binding it to the order details &lt;strong&gt;SqlDataSource&lt;/strong&gt;. Once you have completed these two steps your ASP.NET page&#39;s declarative syntax should look similar to the following:&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_58563896-aec8-4a69-9556-b700023470cf&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_58563896-aec8-4a69-9556-b700023470cf&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;
    &lt;title&gt;Untitled Page&lt;/title&gt;


    &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt;

    &lt;div style=&quot;float: left; padding-right: 10px; width: 50%;&quot;&gt;

        &lt;h2&gt;
Select an Order from the Left...&lt;/h2&gt;
&lt;asp:sqldatasource connectionstring=&quot;&amp;lt;%$ ConnectionStrings:NWConnectionString %&amp;gt;&quot; id=&quot;ordersDataSource&quot; runat=&quot;server&quot; selectcommand=&quot;SELECT dbo.Orders.OrderID, 
             dbo.Customers.CompanyName, dbo.Orders.OrderDate FROM 
             dbo.Orders INNER JOIN dbo.Customers ON dbo.Orders.CustomerID 
             = dbo.Customers.CustomerID&quot;&gt;
            &lt;/asp:sqldatasource&gt;
            &lt;asp:gridview allowpaging=&quot;True&quot; autogeneratecolumns=&quot;False&quot; backcolor=&quot;#DEBA84&quot; bordercolor=&quot;#DEBA84&quot; borderstyle=&quot;None&quot; borderwidth=&quot;1px&quot; cellpadding=&quot;3&quot; cellspacing=&quot;2&quot; datakeynames=&quot;OrderID&quot; datasourceid=&quot;ordersDataSource&quot; id=&quot;orderGridView&quot; onpageindexchanged=&quot;orderGridView_PageIndexChanged&quot; runat=&quot;server&quot;&gt;
                &lt;footerstyle backcolor=&quot;#F7DFB5&quot; forecolor=&quot;#8C4510&quot;&gt;&lt;/footerstyle&gt;
                &lt;pagerstyle forecolor=&quot;#8C4510&quot; horizontalalign=&quot;Center&quot;&gt;&lt;/pagerstyle&gt;
                &lt;headerstyle backcolor=&quot;#A55129&quot; font-bold=&quot;True&quot; forecolor=&quot;White&quot;&gt;&lt;/headerstyle&gt;
                &lt;columns&gt;
                    &lt;asp:commandfield selecttext=&quot;View Order Details&quot; showselectbutton=&quot;True&quot;&gt;&lt;/asp:commandfield&gt;
                    &lt;asp:boundfield datafield=&quot;CompanyName&quot; headertext=&quot;Company&quot; sortexpression=&quot;CompanyName&quot;&gt;&lt;/asp:boundfield&gt;
                    &lt;asp:boundfield datafield=&quot;OrderDate&quot; dataformatstring=&quot;{0:d}&quot; headertext=&quot;Order Date&quot; sortexpression=&quot;OrderDate&quot;&gt;
                        &lt;itemstyle horizontalalign=&quot;Right&quot;&gt;&lt;/itemstyle&gt;
                    &lt;/asp:boundfield&gt;
                &lt;/columns&gt;
                &lt;selectedrowstyle backcolor=&quot;#738A9C&quot; font-bold=&quot;True&quot; forecolor=&quot;White&quot;&gt;&lt;/selectedrowstyle&gt;
                &lt;rowstyle backcolor=&quot;#FFF7E7&quot; forecolor=&quot;#8C4510&quot;&gt;&lt;/rowstyle&gt;
            &lt;/asp:gridview&gt;
    &lt;/div&gt;
&lt;div&gt;

        &lt;h2&gt;
... and View the Order Details on the Right&lt;/h2&gt;
&lt;asp:sqldatasource connectionstring=&quot;&amp;lt;%$ ConnectionStrings:NWConnectionString %&amp;gt;&quot; id=&quot;orderDetailsDataSource&quot; runat=&quot;server&quot; selectcommand=&quot;SELECT dbo.[Order Details].OrderID, 
dbo.Products.ProductName, dbo.[Order Details].UnitPrice, 
dbo.[Order Details].Quantity, dbo.[Order Details].Discount 
FROM dbo.[Order Details] INNER JOIN dbo.Products 
ON dbo.[Order Details].ProductID = dbo.Products.ProductID 
WHERE dbo.[Order Details].OrderID = @OrderID&quot;&gt;
            &lt;selectparameters&gt;
                &lt;asp:controlparameter controlid=&quot;orderGridView&quot; name=&quot;OrderID&quot; propertyname=&quot;SelectedValue&quot; type=&quot;Int32&quot;&gt;
            &lt;/asp:controlparameter&gt;
        &lt;/selectparameters&gt;&lt;/asp:sqldatasource&gt;
        
        &lt;asp:gridview autogeneratecolumns=&quot;False&quot; backcolor=&quot;#DEBA84&quot; bordercolor=&quot;#DEBA84&quot; borderstyle=&quot;None&quot; borderwidth=&quot;1px&quot; cellpadding=&quot;3&quot; cellspacing=&quot;2&quot; datasourceid=&quot;orderDetailsDataSource&quot; id=&quot;detailsGridView&quot; runat=&quot;server&quot;&gt;
            &lt;footerstyle backcolor=&quot;#F7DFB5&quot; forecolor=&quot;#8C4510&quot;&gt;&lt;/footerstyle&gt;
            &lt;pagerstyle forecolor=&quot;#8C4510&quot; horizontalalign=&quot;Center&quot;&gt;&lt;/pagerstyle&gt;
            &lt;headerstyle backcolor=&quot;#A55129&quot; font-bold=&quot;True&quot; forecolor=&quot;White&quot;&gt;&lt;/headerstyle&gt;
            &lt;columns&gt;
                &lt;asp:boundfield datafield=&quot;ProductName&quot; headertext=&quot;Product&quot; sortexpression=&quot;ProductName&quot;&gt;&lt;/asp:boundfield&gt;
                &lt;asp:boundfield datafield=&quot;UnitPrice&quot; dataformatstring=&quot;{0:c}&quot; headertext=&quot;Unit Price&quot; sortexpression=&quot;UnitPrice&quot;&gt;
                    &lt;itemstyle horizontalalign=&quot;Right&quot;&gt;&lt;/itemstyle&gt;
                &lt;/asp:boundfield&gt;
                &lt;asp:boundfield datafield=&quot;Quantity&quot; headertext=&quot;Quantity&quot; sortexpression=&quot;Quantity&quot;&gt;
                    &lt;itemstyle horizontalalign=&quot;Right&quot;&gt;&lt;/itemstyle&gt;
                &lt;/asp:boundfield&gt;
                &lt;asp:boundfield datafield=&quot;Discount&quot; dataformatstring=&quot;{0:P}&quot; headertext=&quot;Discount&quot; sortexpression=&quot;Discount&quot;&gt;
                    &lt;itemstyle horizontalalign=&quot;Right&quot;&gt;&lt;/itemstyle&gt;
                &lt;/asp:boundfield&gt;
            &lt;/columns&gt;
            &lt;selectedrowstyle backcolor=&quot;#738A9C&quot; font-bold=&quot;True&quot; forecolor=&quot;White&quot;&gt;&lt;/selectedrowstyle&gt;
            &lt;rowstyle backcolor=&quot;#FFF7E7&quot; forecolor=&quot;#8C4510&quot;&gt;&lt;/rowstyle&gt;
        &lt;/asp:gridview&gt;
    &lt;/div&gt;
&lt;/form&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
When examining the markup be sure to note the following:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;When adding a Select button to a &lt;strong&gt;GridView&lt;/strong&gt;, a CommandField is added. By default, the text for the Select button will be &quot;Select,&quot; but this can be changed through the &lt;strong&gt;SelectText&lt;/strong&gt; property. You can even use an image for the Select button, if you&#39;d rather, by providing the path to the image in the &lt;strong&gt;SelectImageUrl&lt;/strong&gt; property.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;orderGridView&lt;/strong&gt; &lt;strong&gt;GridView&lt;/strong&gt;&#39;s &lt;strong&gt;DataKeyNames&lt;/strong&gt; property is set to &lt;strong&gt;OrderID&lt;/strong&gt;. When a particular record in the &lt;strong&gt;GridView&lt;/strong&gt; is selected, the &lt;strong&gt;GridView&lt;/strong&gt;&#39;s &lt;strong&gt;SelectedValue&lt;/strong&gt; property will be set to that row&#39;s &lt;strong&gt;OrderID&lt;/strong&gt; value.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;orderDetailsDataSource&lt;/strong&gt; &lt;strong&gt;SqlDataSource&lt;/strong&gt; contains a parameter in its WHERE clause (&lt;strong&gt;@OrderID&lt;/strong&gt;) whose value is specified in the &lt;strong&gt;&lt;selectparameters&gt;&lt;/selectparameters&gt;&lt;/strong&gt; section. The &lt;strong&gt;&lt;asp:controlparameter&gt;&lt;/asp:controlparameter&gt;&lt;/strong&gt; indicates that the parameter is of type &lt;strong&gt;Int32&lt;/strong&gt; and its value should be set to the &lt;strong&gt;orderGridView&lt;/strong&gt; &lt;strong&gt;GridView&#39;&lt;/strong&gt;s &lt;strong&gt;SelectedValue&lt;/strong&gt; property.&lt;/li&gt;
&lt;/ul&gt;
Figures 30 and 31 show the drill-down report in action. Note that on the first page load, only the &lt;strong&gt;GridView&lt;/strong&gt; of orders is displayed (see Figure 30). When an order&#39;s &quot;View Order Details&quot; link is clicked, a postback occurs and the order details &lt;strong&gt;GridView&lt;/strong&gt; is bound to the &lt;strong&gt;SqlDataSource&lt;/strong&gt; that returns all Order Details records associated with the selected order (see Figure 31).&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms972814.gridview_fig30l(l=en-us).gif&quot; target=&quot;_top&quot;&gt;&lt;img alt=&quot;Click here for larger image.&quot; id=&quot;gridview_fig30S&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC79224.gif&quot; title=&quot;Click here for larger image.&quot; xmlns=&quot;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 30 (Click on the graphic for a larger image)&lt;/strong&gt;&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms972814.gridview_fig31l(l=en-us).gif&quot; target=&quot;_top&quot;&gt;&lt;img alt=&quot;Click here for larger image.&quot; id=&quot;gridview_fig31S&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC141350.gif&quot; title=&quot;Click here for larger image.&quot; xmlns=&quot;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 31 (Click on the graphic for a larger image)&lt;/strong&gt;&lt;/div&gt;
One minor issue with the demo is that the orders &lt;strong&gt;GridView&lt;/strong&gt;&#39;s &lt;strong&gt;SelectedIndex&lt;/strong&gt; does not change when the &lt;strong&gt;GridView&lt;/strong&gt; is paged. What this implies is that if you are on page 1 and click on the second order&#39;s &quot;View Order Details,&quot; you will see that order&#39;s details to the right, as expected. However, if you then click to visit page 2, the second order on page 2 will be selected and its details will be shown to the right. I wanted to have the &lt;strong&gt;SelectedIndex&lt;/strong&gt; reset when stepping through the pages. To accomplish this simply create an event handler for the &lt;strong&gt;GridView&lt;/strong&gt;&#39;s &lt;strong&gt;PageIndexChanged&lt;/strong&gt; event. The &lt;strong&gt;PageIndexChanged&lt;/strong&gt; event fires whenever the user requests a new page of data. In this event handler I reset the &lt;strong&gt;GridView&lt;/strong&gt;&#39;s &lt;strong&gt;SelectedIndex&lt;/strong&gt; to &lt;strong&gt;-1&lt;/strong&gt;, as shown in the following code snippet:&lt;br /&gt;
&lt;strong&gt;The PageIndexChanged Event Handler (Visual Basic)&lt;/strong&gt;&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_b886ad39-1f7b-496b-b64b-b2e2982c7aaf&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_b886ad39-1f7b-496b-b64b-b2e2982c7aaf&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;Sub orderGridView_PageIndexChanged(ByVal sender As Object, _
   ByVal e As System.EventArgs)
    orderGridView.SelectedIndex = -1
End Sub
The PageIndexChanged Event Handler (C#)
void orderGridView_PageIndexChanged(object sender, EventArgs e)
{
    orderGridView.SelectedIndex = -1;
}

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Drilling Down From Summary to Detail&lt;/h3&gt;
The other flavor of drill-down reports is expanding from a concise view to a detailed view. For example, the Customers table in the Northwind database contains a plethora of fields and displaying all fields in a &lt;strong&gt;GridView&lt;/strong&gt; would result in a wide, unwieldy &lt;strong&gt;GridView&lt;/strong&gt; that was difficult to read. Rather than displaying all customer-related fields, it might make more sense to just display the pertinent fields—&lt;strong&gt;CompanyName&lt;/strong&gt; and &lt;strong&gt;ContactName&lt;/strong&gt;—along with a &quot;View Customer Details&quot; link in each row. If the end user wants to see all of the fields of a particular customer, they can click that customer&#39;s details link.&lt;br /&gt;
Creating such a summary to a detail drill-down report is fairly simple in ASP.NET 2.0 thanks to the &lt;strong&gt;DetailsView&lt;/strong&gt; Web control, which is designed for displaying information one record at a time (as opposed to displaying numerous records at once, like the &lt;strong&gt;GridView&lt;/strong&gt;). As we&#39;ll see shortly, displaying a particular customer&#39;s full details using a &lt;strong&gt;DetailsView&lt;/strong&gt; is as simple as adding and configuring a &lt;strong&gt;GridView&lt;/strong&gt;.&lt;br /&gt;
To get started we need to get just the &lt;strong&gt;CustomerID&lt;/strong&gt;, &lt;strong&gt;CompanyName&lt;/strong&gt;, and &lt;strong&gt;ContactName&lt;/strong&gt; fields from the Customers table and display them in a &lt;strong&gt;GridView&lt;/strong&gt;. As with our previous drill-down report example, this is accomplished by adding and configuring a &lt;strong&gt;SqlDataSource&lt;/strong&gt; and then binding a &lt;strong&gt;GridView&lt;/strong&gt; to it. Next, add another &lt;strong&gt;SqlDataSource&lt;/strong&gt; that retrieves all of the Customers table&#39;s fields. &lt;br /&gt;
At this point you could add a WHERE clause and bind the parameter to the customer&#39;s &lt;strong&gt;GridView&lt;/strong&gt;, just like we did in the previous drill-down example, but for this exercise let&#39;s try an alternative approach for accessing the correct customer for the customer &lt;strong&gt;DetailsView&lt;/strong&gt;. After configuring the second &lt;strong&gt;SqlDataSource&lt;/strong&gt; &lt;em&gt;without&lt;/em&gt; adding a WHERE clause, from the Design view go to the &lt;strong&gt;SqlDataSource&lt;/strong&gt;&#39;s Properties and add the following into the &lt;strong&gt;SqlDataSource&lt;/strong&gt;&#39;s &lt;strong&gt;FilterExpression &lt;/strong&gt;property: &lt;strong&gt;CustomerID=&#39;{0}&#39;&lt;/strong&gt;. Next, open the Parameter Collection Editor dialog box by clicking on the &lt;strong&gt;FilterParameters&lt;/strong&gt; property. This dialog box should look familiar, as it closely mimics the dialog box shown in Figure 29 when we configured the WHERE clause parameter for the earlier drill-down report example. Set up a parameter based on the customer&#39;s &lt;strong&gt;GridView&lt;/strong&gt;.&lt;br /&gt;
The last step is to add a &lt;strong&gt;DetailsView&lt;/strong&gt; to the page. Add a &lt;strong&gt;DetailsView&lt;/strong&gt; by simply dragging and dropping the control from the Toolbox and then, from its Smart Tag, associate it with the data source control we just configured.&lt;br /&gt;
Once you have configured this page your page&#39;s declarative syntax should look similar to the following markup shown. As with our previous examples, no source code was needed to create this page. When examining this markup be sure to take note of the following things:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;customerGridView&lt;/strong&gt; &lt;strong&gt;GridView&lt;/strong&gt;&#39;s &lt;strong&gt;DataKeyNames&lt;/strong&gt; property is set to &lt;strong&gt;CustomerID&lt;/strong&gt;. As we discussed with the previous drill-down report example, this indicates that when a &lt;strong&gt;GridView&lt;/strong&gt; row is selected, the &lt;strong&gt;GridView&lt;/strong&gt;&#39;s &lt;strong&gt;SelectedValue&lt;/strong&gt; property will be set to the value of that row&#39;s &lt;strong&gt;CustomerID&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;customerDetailsDataSource&lt;/strong&gt; &lt;strong&gt;SqlDataSource&lt;/strong&gt;&#39;s &lt;strong&gt;SelectCommand&lt;/strong&gt; does not include a WHERE clause. Instead, it contains a &lt;strong&gt;FilterExpression&lt;/strong&gt;—&lt;strong&gt;CustomerID=&#39;{0}&#39;&lt;/strong&gt;—along with a &lt;strong&gt;&lt;filterparameters&gt; &lt;/filterparameters&gt;&lt;/strong&gt;section that indicates the filter parameter (&lt;strong&gt;{0}&lt;/strong&gt;) has the value of the &lt;strong&gt;customerGridView&lt;/strong&gt; &lt;strong&gt;GridView&lt;/strong&gt;&#39;s &lt;strong&gt;SelectedValue&lt;/strong&gt; property.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_9538b8c2-9df6-47b4-b7ee-178527583ceb&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_9538b8c2-9df6-47b4-b7ee-178527583ceb&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;!--Page Language=&quot;C#&quot;--&gt;
&lt;!--DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.1//EN&quot; 
  &quot;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&quot;--&gt;
&lt;script runat=&quot;server&quot;&gt;
&lt;/script&gt;


    &lt;title&gt;Untitled Page&lt;/title&gt;


    &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt;

    &lt;div style=&quot;float: left; padding-right: 10px; width: 50%;&quot;&gt;

        &lt;h2&gt;
Select a Customer from the Left...&lt;/h2&gt;
&lt;asp:sqldatasource connectionstring=&quot;&amp;lt;%$ ConnectionStrings:NWConnectionString %&amp;gt;&quot; id=&quot;customerDataSource&quot; runat=&quot;server&quot; selectcommand=&quot;SELECT [CustomerID], [CompanyName], 
           [ContactName] FROM [Customers] ORDER BY [CompanyName]&quot;&gt;
        &lt;/asp:sqldatasource&gt;
        &lt;asp:gridview autogeneratecolumns=&quot;False&quot; backcolor=&quot;White&quot; bordercolor=&quot;#CC9966&quot; borderstyle=&quot;None&quot; borderwidth=&quot;1px&quot; cellpadding=&quot;4&quot; datakeynames=&quot;CustomerID&quot; datasourceid=&quot;customerDataSource&quot; id=&quot;customerGridView&quot; runat=&quot;server&quot;&gt;
            &lt;footerstyle backcolor=&quot;#FFFFCC&quot; forecolor=&quot;#330099&quot;&gt;&lt;/footerstyle&gt;
            &lt;pagerstyle backcolor=&quot;#FFFFCC&quot; forecolor=&quot;#330099&quot; horizontalalign=&quot;Center&quot;&gt;&lt;/pagerstyle&gt;
            &lt;headerstyle backcolor=&quot;#990000&quot; font-bold=&quot;True&quot; forecolor=&quot;#FFFFCC&quot;&gt;&lt;/headerstyle&gt;
            &lt;columns&gt;
                &lt;asp:commandfield selecttext=&quot;View Customer Details&quot; showselectbutton=&quot;True&quot;&gt;&lt;/asp:commandfield&gt;
                &lt;asp:boundfield datafield=&quot;CompanyName&quot; headertext=&quot;CompanyName&quot; sortexpression=&quot;CompanyName&quot;&gt;&lt;/asp:boundfield&gt;
                &lt;asp:boundfield datafield=&quot;ContactName&quot; headertext=&quot;ContactName&quot; sortexpression=&quot;ContactName&quot;&gt;&lt;/asp:boundfield&gt;
            &lt;/columns&gt;
            &lt;selectedrowstyle backcolor=&quot;#FFCC66&quot; font-bold=&quot;True&quot; forecolor=&quot;#663399&quot;&gt;&lt;/selectedrowstyle&gt;
            &lt;rowstyle backcolor=&quot;White&quot; forecolor=&quot;#330099&quot;&gt;&lt;/rowstyle&gt;
        &lt;/asp:gridview&gt;
    &lt;/div&gt;
&lt;div&gt;

        &lt;h2&gt;
... and See Their Detailed Information on the Right&lt;/h2&gt;
&lt;asp:sqldatasource connectionstring=&quot;&amp;lt;%$ ConnectionStrings:NWConnectionString %&amp;gt;&quot; filterexpression=&quot;CustomerID=&#39;{0}&#39;&quot; id=&quot;customerDetailsDataSource&quot; runat=&quot;server&quot; selectcommand=&quot;SELECT [CompanyName], [ContactName], 
              [ContactTitle], [Address], [City], [Region], [PostalCode], 
              [Country], [Phone], [Fax], [CustomerID] FROM [Customers]&quot;&gt;
            &lt;filterparameters&gt;
                &lt;asp:controlparameter controlid=&quot;customerGridView&quot; defaultvalue=&quot;-1&quot; name=&quot;CustomerID&quot; propertyname=&quot;SelectedValue&quot; type=&quot;String&quot;&gt;&lt;/asp:controlparameter&gt;
            &lt;/filterparameters&gt;
        &lt;/asp:sqldatasource&gt;
        &lt;asp:detailsview autogeneraterows=&quot;False&quot; backcolor=&quot;White&quot; bordercolor=&quot;#CC9966&quot; borderstyle=&quot;None&quot; borderwidth=&quot;1px&quot; cellpadding=&quot;4&quot; datasourceid=&quot;customerDetailsDataSource&quot; id=&quot;customerDetailsView&quot; runat=&quot;server&quot;&gt;
            &lt;footerstyle backcolor=&quot;#FFFFCC&quot; forecolor=&quot;#330099&quot;&gt;&lt;/footerstyle&gt;
            &lt;rowstyle backcolor=&quot;White&quot; forecolor=&quot;#330099&quot;&gt;&lt;/rowstyle&gt;
            &lt;pagerstyle backcolor=&quot;#FFFFCC&quot; forecolor=&quot;#330099&quot; horizontalalign=&quot;Center&quot;&gt;&lt;/pagerstyle&gt;
            &lt;fields&gt;
                &lt;asp:boundfield datafield=&quot;CompanyName&quot; headertext=&quot;CompanyName&quot; sortexpression=&quot;CompanyName&quot;&gt;&lt;/asp:boundfield&gt;
                &lt;asp:boundfield datafield=&quot;ContactName&quot; headertext=&quot;ContactName&quot; sortexpression=&quot;ContactName&quot;&gt;&lt;/asp:boundfield&gt;
                &lt;asp:boundfield datafield=&quot;ContactTitle&quot; headertext=&quot;ContactTitle&quot; sortexpression=&quot;ContactTitle&quot;&gt;&lt;/asp:boundfield&gt;
                &lt;asp:boundfield datafield=&quot;Address&quot; headertext=&quot;Address&quot; sortexpression=&quot;Address&quot;&gt;&lt;/asp:boundfield&gt;
                &lt;asp:boundfield datafield=&quot;City&quot; headertext=&quot;City&quot; sortexpression=&quot;City&quot;&gt;&lt;/asp:boundfield&gt;
                &lt;asp:boundfield datafield=&quot;Region&quot; headertext=&quot;Region&quot; sortexpression=&quot;Region&quot;&gt;&lt;/asp:boundfield&gt;
                &lt;asp:boundfield datafield=&quot;PostalCode&quot; headertext=&quot;PostalCode&quot; sortexpression=&quot;PostalCode&quot;&gt;&lt;/asp:boundfield&gt;
                &lt;asp:boundfield datafield=&quot;Country&quot; headertext=&quot;Country&quot; sortexpression=&quot;Country&quot;&gt;&lt;/asp:boundfield&gt;
                &lt;asp:boundfield datafield=&quot;Phone&quot; headertext=&quot;Phone&quot; sortexpression=&quot;Phone&quot;&gt;&lt;/asp:boundfield&gt;
                &lt;asp:boundfield datafield=&quot;Fax&quot; headertext=&quot;Fax&quot; sortexpression=&quot;Fax&quot;&gt;&lt;/asp:boundfield&gt;
            &lt;/fields&gt;
            &lt;fieldheaderstyle backcolor=&quot;#990000&quot; font-bold=&quot;True&quot; forecolor=&quot;#FFFFCC&quot;&gt;&lt;/fieldheaderstyle&gt;
            &lt;headerstyle backcolor=&quot;#990000&quot; font-bold=&quot;True&quot; forecolor=&quot;#FFFFCC&quot;&gt;&lt;/headerstyle&gt;
            &lt;editrowstyle backcolor=&quot;#FFCC66&quot; font-bold=&quot;True&quot; forecolor=&quot;#663399&quot;&gt;&lt;/editrowstyle&gt;
        &lt;/asp:detailsview&gt;
        &lt;/div&gt;
&lt;/form&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
Figures 32 and 33 show the drill-down report in action.&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms972814.gridview_fig32l(l=en-us).gif&quot; target=&quot;_top&quot;&gt;&lt;img alt=&quot;Click here for larger image.&quot; id=&quot;gridview_fig32S&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC59030.gif&quot; title=&quot;Click here for larger image.&quot; xmlns=&quot;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 32 (Click on the graphic for a larger image)&lt;/strong&gt;&lt;/div&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms972814.gridview_fig33l(l=en-us).gif&quot; target=&quot;_top&quot;&gt;&lt;img alt=&quot;Click here for larger image.&quot; id=&quot;gridview_fig33S&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC17041.gif&quot; title=&quot;Click here for larger image.&quot; xmlns=&quot;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 33 (Click on the graphic for a larger image)&lt;/strong&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/2734273511003550241/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2012/06/gridview-examples-for-aspnet-20_29.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/2734273511003550241'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/2734273511003550241'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2012/06/gridview-examples-for-aspnet-20_29.html' title='GridView Examples for ASP.NET 2.0: Drilling Down into Detailed Data'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-7115349652582239945</id><published>2012-06-29T10:46:00.000+03:00</published><updated>2012-06-29T10:46:14.383+03:00</updated><title type='text'>GridView Examples for ASP.NET 2.0: Displaying Images in a GridView Column</title><content type='html'>In the ASP.NET 1.x class I teach, the course-long project for the students is to create an online photo album, one that allows visitors to upload images and provide metadata about the images, such as a description, a title, and so on. The data model my students typically use consists of a Pictures table with the following fields:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;PictureID&lt;/strong&gt;—a synthetic primary key, typically an integer field setup as an &lt;strong&gt;IDENTITY&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Title&lt;/strong&gt;—a short title for the picture.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DateAdded&lt;/strong&gt;—the date/time the picture was uploaded.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PictureUrl&lt;/strong&gt;—the path to the uploaded image file.&lt;/li&gt;
&lt;/ul&gt;
When users want to add a new image to the photo album site, they must visit a particular page that contains a file upload control along with form input fields querying them for the other bits of information. When they submit the form, the picture on their computer is uploaded to the Web server&#39;s file system and a new row is added to the Pictures table. The &lt;strong&gt;PictureUrl &lt;/strong&gt;field is set to the virtual path of the uploaded image file.&lt;br /&gt;
There&#39;s an additional page that lists all pictures in the photo album using a &lt;strong&gt;DataGrid&lt;/strong&gt;. To display an image in a column in a &lt;strong&gt;DataGrid&lt;/strong&gt; in ASP.NET 1.x you have to use a &lt;strong&gt;TemplateColumn&lt;/strong&gt; with an Image Web control inside the &lt;strong&gt;TemplateColumn&lt;/strong&gt;. With ASP.NET 2.0 the &lt;strong&gt;GridView&lt;/strong&gt; includes an ImageField that can be used to display an image in a column of the &lt;strong&gt;GridView&lt;/strong&gt;.&lt;br /&gt;
Imagine that we had the data model discussed previously and wanted to display all of the pictures in a &lt;strong&gt;GridView&lt;/strong&gt;, displaying the &lt;strong&gt;PictureID&lt;/strong&gt;, &lt;strong&gt;Title&lt;/strong&gt;, and &lt;strong&gt;DateAdded&lt;/strong&gt; fields each in a column and the actual image itself in an additional column. &lt;br /&gt;
To accomplish this we&#39;d first grab the data using a data source control and then add a &lt;strong&gt;GridView&lt;/strong&gt; bound to that data source control. This &lt;strong&gt;GridView&lt;/strong&gt; would have four BoundField columns, meaning that instead of seeing the actual image we&#39;d see the actual image path when viewing the &lt;strong&gt;GridView&lt;/strong&gt; in a browser. To display the actual image, we need to edit the &lt;strong&gt;GridView&lt;/strong&gt;&#39;s columns, removing the &lt;strong&gt;PictureUrl&lt;/strong&gt; BoundField and replacing it with an ImageField. To edit a &lt;strong&gt;GridView&lt;/strong&gt;&#39;s columns simply click on the Edit Columns link from the &lt;strong&gt;GridView&lt;/strong&gt;&#39;s Smart Tag. This will bring up a dialog box like the one shown in Figure 25. Delete the &lt;strong&gt;PictureUrl &lt;/strong&gt;BoundField and add in an ImageField. Finally, set the ImageField&#39;s &lt;strong&gt;DataImageUrlField&lt;/strong&gt; to the name of the &lt;strong&gt;DataSource&lt;/strong&gt; field that contains the image path—&lt;strong&gt;PictureUrl&lt;/strong&gt;.&lt;br /&gt;
&lt;div class=&quot;fig&quot;&gt;
&lt;img alt=&quot;Aa479350.gridview_fg25(en-us,MSDN.10).gif&quot; id=&quot;gridview_fg25&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC158251.gif&quot; title=&quot;Aa479350.gridview_fg25(en-us,MSDN.10).gif&quot; xmlns=&quot;&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 25&lt;/strong&gt;&lt;/div&gt;
This will result in a &lt;strong&gt;GridView&lt;/strong&gt; with the following declarative syntax:&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_249ef30f-a738-4bb4-9494-5ac446cf6287&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_249ef30f-a738-4bb4-9494-5ac446cf6287&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;asp:gridview autogeneratecolumns=&quot;False&quot; backcolor=&quot;White&quot; bordercolor=&quot;#CCCCCC&quot; borderstyle=&quot;None&quot; borderwidth=&quot;1px&quot; cellpadding=&quot;3&quot; datasource=&quot;&amp;lt;%# GetData() %&amp;gt;&quot; font-names=&quot;Arial&quot; id=&quot;GridView1&quot; runat=&quot;server&quot;&gt;
    &lt;footerstyle backcolor=&quot;White&quot; forecolor=&quot;#000066&quot;&gt;&lt;/footerstyle&gt;
    &lt;pagerstyle backcolor=&quot;White&quot; forecolor=&quot;#000066&quot; horizontalalign=&quot;Left&quot;&gt;&lt;/pagerstyle&gt;
    &lt;headerstyle backcolor=&quot;#006699&quot; font-bold=&quot;True&quot; forecolor=&quot;White&quot;&gt;&lt;/headerstyle&gt;
    &lt;columns&gt;
        &lt;asp:boundfield datafield=&quot;PictureID&quot; headertext=&quot;Picutre ID&quot;&gt;
            &lt;itemstyle horizontalalign=&quot;Center&quot; verticalalign=&quot;Middle&quot;&gt;&lt;/itemstyle&gt;
        &lt;/asp:boundfield&gt;
        &lt;asp:boundfield datafield=&quot;Title&quot; headertext=&quot;Title&quot;&gt;&lt;/asp:boundfield&gt;
        &lt;asp:boundfield datafield=&quot;DateAdded&quot; dataformatstring=&quot;{0:d}&quot; headertext=&quot;Date Added&quot;&gt;
            &lt;itemstyle horizontalalign=&quot;Center&quot;&gt;&lt;/itemstyle&gt;
        &lt;/asp:boundfield&gt;
        &lt;asp:imagefield dataimageurlfield=&quot;PictureURL&quot;&gt;&lt;/asp:imagefield&gt;
    &lt;/columns&gt;
    &lt;selectedrowstyle backcolor=&quot;#669999&quot; font-bold=&quot;True&quot; forecolor=&quot;White&quot;&gt;&lt;/selectedrowstyle&gt;
    &lt;rowstyle forecolor=&quot;#000066&quot;&gt;&lt;/rowstyle&gt;
&lt;/asp:gridview&gt;

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
Since the Northwind database does not have a table with an image path, we&#39;ll have to programmatically create our own data model to see this demo in action. The following code in our ASP.NET page creates a DataTable with the appropriate schema and populates the DataTable with four records.&lt;br /&gt;
&lt;strong&gt;Creating a DataTable Programmatically (Visual Basic)&lt;/strong&gt;&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_b22adeb5-9da3-45d2-ba47-cea74ea2d113&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_b22adeb5-9da3-45d2-ba47-cea74ea2d113&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;Function GetData() As DataTable
    &#39; This method creates a DataTable with four rows.  Each row has the
    &#39; following schema:
    &#39;   PictureID      int
    &#39;   PictureURL     string
    &#39;   Title          string
    &#39;   DateAdded      datetime
    Dim dt As New DataTable()
    &#39; define the table&#39;s schema
    dt.Columns.Add(New DataColumn(&quot;PictureID&quot;, GetType(Integer)))
    dt.Columns.Add(New DataColumn(&quot;PictureURL&quot;, GetType(String)))
    dt.Columns.Add(New DataColumn(&quot;Title&quot;, GetType(String)))
    dt.Columns.Add(New DataColumn(&quot;DateAdded&quot;, GetType(DateTime)))
    &#39; Create the four records
    Dim dr As DataRow = dt.NewRow()
    dr(&quot;PictureID&quot;) = 1
    dr(&quot;PictureURL&quot;) = ResolveUrl(&quot;~/DisplayingImages/Images/Blue hills.jpg&quot;)
    dr(&quot;Title&quot;) = &quot;Blue Hills&quot;
    dr(&quot;DateAdded&quot;) = New DateTime(2005, 1, 15)
    dt.Rows.Add(dr)
    dr = dt.NewRow()
    dr(&quot;PictureID&quot;) = 2
    dr(&quot;PictureURL&quot;) = ResolveUrl(&quot;~/DisplayingImages/Images/Sunset.jpg&quot;)
    dr(&quot;Title&quot;) = &quot;Sunset&quot;
    dr(&quot;DateAdded&quot;) = New DateTime(2005, 1, 21)
    dt.Rows.Add(dr)
    dr = dt.NewRow()
    dr(&quot;PictureID&quot;) = 3
    dr(&quot;PictureURL&quot;) = _
      ResolveUrl(&quot;~/DisplayingImages/Images/Water lilies.jpg&quot;)
    dr(&quot;Title&quot;) = &quot;Water Lilies&quot;
    dr(&quot;DateAdded&quot;) = New DateTime(2005, 2, 1)
    dt.Rows.Add(dr)
    dr = dt.NewRow()
    dr(&quot;PictureID&quot;) = 4
    dr(&quot;PictureURL&quot;) = ResolveUrl(&quot;~/DisplayingImages/Images/Winter.jpg&quot;)
    dr(&quot;Title&quot;) = &quot;Winter&quot;
    dr(&quot;DateAdded&quot;) = New DateTime(2005, 2, 18)
    dt.Rows.Add(dr)
    Return dt
End Function

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;strong&gt;Creating a DataTable Programmatically (C#)&lt;/strong&gt;&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_cfec1a6a-e3e9-4796-9705-927c6ecce70f&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_cfec1a6a-e3e9-4796-9705-927c6ecce70f&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;DataTable GetData()
{
    // This method creates a DataTable with four rows.  Each row has the
    // following schema:
    //   PictureID      int
    //   PictureURL     string
    //   Title          string
    //   DateAdded      datetime
    DataTable dt = new DataTable();
    // define the table&#39;s schema
    dt.Columns.Add(new DataColumn(&quot;PictureID&quot;, typeof(int)));
    dt.Columns.Add(new DataColumn(&quot;PictureURL&quot;, typeof(string)));
    dt.Columns.Add(new DataColumn(&quot;Title&quot;, typeof(string)));
    dt.Columns.Add(new DataColumn(&quot;DateAdded&quot;, typeof(DateTime)));
    // Create the four records
    DataRow dr = dt.NewRow();
    dr[&quot;PictureID&quot;] = 1;
    dr[&quot;PictureURL&quot;] = ResolveUrl(&quot;~/DisplayingImages/Images/Blue hills.jpg&quot;);
    dr[&quot;Title&quot;] = &quot;Blue Hills&quot;;
    dr[&quot;DateAdded&quot;] = new DateTime(2005, 1, 15);
    dt.Rows.Add(dr);
    dr = dt.NewRow();
    dr[&quot;PictureID&quot;] = 2;
    dr[&quot;PictureURL&quot;] = ResolveUrl(&quot;~/DisplayingImages/Images/Sunset.jpg&quot;);
    dr[&quot;Title&quot;] = &quot;Sunset&quot;;
    dr[&quot;DateAdded&quot;] = new DateTime(2005, 1, 21);
    dt.Rows.Add(dr);
    dr = dt.NewRow();
    dr[&quot;PictureID&quot;] = 3;
    dr[&quot;PictureURL&quot;] = 
      ResolveUrl(&quot;~/DisplayingImages/Images/Water lilies.jpg&quot;);
    dr[&quot;Title&quot;] = &quot;Water Lilies&quot;;
    dr[&quot;DateAdded&quot;] = new DateTime(2005, 2, 1);
    dt.Rows.Add(dr);
    dr = dt.NewRow();
    dr[&quot;PictureID&quot;] = 4;
    dr[&quot;PictureURL&quot;] = ResolveUrl(&quot;~/DisplayingImages/Images/Winter.jpg&quot;);
    dr[&quot;Title&quot;] = &quot;Winter&quot;;
    dr[&quot;DateAdded&quot;] = new DateTime(2005, 2, 18);
    dt.Rows.Add(dr);
    return dt;
}

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
To bind this data to the &lt;strong&gt;GridView&lt;/strong&gt; we can set the &lt;strong&gt;GridView&lt;/strong&gt;&#39;s &lt;strong&gt;DataSource&lt;/strong&gt; property to the &lt;strong&gt;GetData()&lt;/strong&gt; method like so:&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_9222a435-c21c-4b8f-993d-dca5d34a01f6&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_9222a435-c21c-4b8f-993d-dca5d34a01f6&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;asp:gridview ...=&quot;&quot; datasource=&quot;&amp;lt;%# GetData() %&amp;gt;&quot; runat=&quot;server&quot;&gt;
  ...
&lt;/asp:gridview&gt;

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
Finally, we need to call &lt;strong&gt;Page.DataBind()&lt;/strong&gt; in the &lt;strong&gt;Page_Load&lt;/strong&gt; event handler to bind the &lt;strong&gt;GridView&lt;/strong&gt;&#39;s &lt;strong&gt;DataSource&lt;/strong&gt;.&lt;br /&gt;
&lt;strong&gt;Page_Load Event Handler (Visual Basic)&lt;/strong&gt;&lt;br /&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_a352afd5-97a0-405e-b633-1b143e6513bd&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot; style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCode&quot; dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_a352afd5-97a0-405e-b633-1b143e6513bd&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    Page.DataBind()
End Sub
Page_Load Event Handler (C#)
void Page_Load(object sender, EventArgs e)
{
    Page.DataBind();
}

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
The end result is a &lt;strong&gt;GridView&lt;/strong&gt; that shows the image referenced by the &lt;strong&gt;PictureUrl&lt;/strong&gt; path (see Figure 26).  &lt;br /&gt;
&lt;div class=&quot;fig&quot;&gt;
&lt;img alt=&quot;Aa479350.gridview_fg26(en-us,MSDN.10).gif&quot; id=&quot;gridview_fg26&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC29549.gif&quot; title=&quot;Aa479350.gridview_fg26(en-us,MSDN.10).gif&quot; xmlns=&quot;&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 26&lt;/strong&gt;&lt;/div&gt;
Don&#39;t be daunted by the length of this example&#39;s code—the length is due entirely to the fact that we had to synthetically create a data model with a table that has an image path field. Had the Northwind database had such a table, this example—like the previous ones—wouldn&#39;t have required a lick of code.</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/7115349652582239945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2012/06/gridview-examples-for-aspnet-20.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/7115349652582239945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/7115349652582239945'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2012/06/gridview-examples-for-aspnet-20.html' title='GridView Examples for ASP.NET 2.0: Displaying Images in a GridView Column'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-158318123398290160</id><published>2012-06-29T10:44:00.000+03:00</published><updated>2012-06-29T10:44:29.556+03:00</updated><title type='text'>Upload and download a file from GridView in Asp.net using with C# and Vb || Gridview with file Download link button in Asp.net using with C# and Vb</title><content type='html'>&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;apple-style-span&quot;&gt;&lt;span style=&quot;color: #0f243e;&quot;&gt;The following article is showing about&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&lt;span style=&quot;color: #0f243e;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;apple-style-span&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;file uploading and 
downloading with Gridview in Asp.net.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;apple-style-span&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;First Design the source code with fileupload control and 
Gridview  from Toolbox in Visual studio 2010.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 14.25pt; margin-bottom: 0in;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Default.aspx:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;

&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;xmlns&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;span style=&quot;color: maroon;&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: maroon;&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;form&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;form1&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;FileUpload&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;fileUpload1&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Button&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;btnUpload&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Text&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Upload&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;onclick&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;btnUpload_Click&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: maroon;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;GridView&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;gvDetails&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;CssClass&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Gridview&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;AutoGenerateColumns&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;false&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;DataKeyNames&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;FilePath&quot;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;HeaderStyle&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;BackColor&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;#df5015&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Columns&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;BoundField&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;DataField&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Id&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;HeaderText&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Id&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;BoundField&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;DataField&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;FileName&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;HeaderText&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;FileName&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;TemplateField&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;HeaderText&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;FilePath&quot;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;ItemTemplate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;LinkButton&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;lnkDownload&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Text&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Download&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;OnClick&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;lnkDownload_Click&quot;&amp;gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;LinkButton&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: maroon;&quot;&gt;ItemTemplate&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;TemplateField&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Columns&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;GridView&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: maroon;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: maroon;&quot;&gt;form&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: maroon;&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;color: maroon;&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Write the following code in Upload button click event and 
download link button click event in code behind side:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;

&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;Default.aspx.cs:&lt;/span&gt;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; System.Collections.Generic;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; System.Linq;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; System.Web;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; System.Web.UI;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; System.Web.UI.WebControls;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; System.Data;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; System.Data.SqlClient;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; System.IO;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;partial&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;_Default&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; : 
System.Web.UI.&lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Page&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;SqlConnection&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; con 
= &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;SqlConnection&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Data 
Source=naresh;Initial Catalog=student;User ID=sa;Password=123&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; Page_Load(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; sender, &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;EventArgs&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; (!IsPostBack)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;            BindGridviewData();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; BindGridviewData()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        con.Open();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;SqlCommand&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; cmd 
= &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;SqlCommand&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;select * from 
FilesTable&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;, con);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;SqlDataAdapter&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; da 
= &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;SqlDataAdapter&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;(cmd);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;DataSet&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; ds 
= &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;DataSet&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        da.Fill(ds);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        con.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        gvDetails.DataSource = 
ds;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        gvDetails.DataBind();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; btnUpload_Click(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; sender, &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;EventArgs&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; filename 
= &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;Path&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;.GetFileName(fileUpload1.PostedFile.FileName);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        fileUpload1.SaveAs(Server.MapPath(&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Files/&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; + 
filename));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        con.Open();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;SqlCommand&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; cmd 
= &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;SqlCommand&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;insert into 
FilesTable(FileName,FilePath) values(@Name,@Path)&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;, con);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        cmd.Parameters.AddWithValue(&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;@Name&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;, 
filename);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        cmd.Parameters.AddWithValue(&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;@Path&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Files/&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; + 
filename);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        cmd.ExecuteNonQuery();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        con.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        BindGridviewData();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; lnkDownload_Click(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; sender, &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;EventArgs&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;LinkButton&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; lnkbtn = 
sender &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;LinkButton&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;GridViewRow&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; gvrow = 
lnkbtn.NamingContainer &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2b91af;&quot;&gt;GridViewRow&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; filePath = 
gvDetails.DataKeys[gvrow.RowIndex].Value.ToString();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        Response.ContentType = &lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;image/jpg&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        Response.AddHeader(&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Content-Disposition&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;attachment;filename=\&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt; + filePath +&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;\&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        Response.TransmitFile(Server.MapPath(filePath));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;        Response.End();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;    }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;
&lt;span style=&quot;color: #4e4e4e;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #4e4e4e;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4e4e4e;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4e4e4e;&quot;&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;The 
following is the same code in Vb.net&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4e4e4e;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: red; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;Default.aspx.vb 
:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;Imports&lt;/span&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt; 
System.Collections.Generic&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;Imports&lt;/span&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt; 
System.Linq&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;Imports&lt;/span&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt; 
System.Web&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;Imports&lt;/span&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt; 
System.Web.UI&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;Imports&lt;/span&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt; 
System.Web.UI.WebControls&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;Imports&lt;/span&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt; 
System.Data&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;Imports&lt;/span&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt; 
System.Data.SqlClient&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;Imports&lt;/span&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt; 
System.IO&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;Partial&lt;/span&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Class&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;_Default&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Inherits&lt;/span&gt; 
System.Web.UI.&lt;span style=&quot;color: #2b91af;&quot;&gt;Page&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Private&lt;/span&gt; 
con &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt; 
&lt;span style=&quot;color: #2b91af;&quot;&gt;SqlConnection&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Data Source=naresh;Initial Catalog=student;User 
ID=sa;Password=123&quot;&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Protected&lt;/span&gt; 
&lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt; Page_Load(sender &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Object&lt;/span&gt;, e &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;EventArgs&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;If&lt;/span&gt; 
&lt;span style=&quot;color: blue;&quot;&gt;Not&lt;/span&gt; IsPostBack &lt;span style=&quot;color: blue;&quot;&gt;Then&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;            
&lt;/span&gt;BindGridviewData()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; 
&lt;span style=&quot;color: blue;&quot;&gt;If&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Private&lt;/span&gt; 
&lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt; BindGridviewData()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;con.Open()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; 
cmd &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt; 
&lt;span style=&quot;color: #2b91af;&quot;&gt;SqlCommand&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;select * from FilesTable&quot;&lt;/span&gt;, 
con)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; da 
&lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;SqlDataAdapter&lt;/span&gt;(cmd)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; ds 
&lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;DataSet&lt;/span&gt;()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;da.Fill(ds)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;con.Close()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;gvDetails.DataSource = 
ds&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        
&lt;/span&gt;gvDetails.DataBind()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Protected&lt;/span&gt; 
&lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt; btnUpload_Click(sender &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Object&lt;/span&gt;, e &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;EventArgs&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; 
filename &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #2b91af;&quot;&gt;Path&lt;/span&gt;.GetFileName(fileUpload1.PostedFile.FileName)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;fileUpload1.SaveAs(Server.MapPath(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Files/&quot;&lt;/span&gt; &amp;amp; filename))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;con.Open()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; 
cmd &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt; 
&lt;span style=&quot;color: #2b91af;&quot;&gt;SqlCommand&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;insert into FilesTable(FileName,FilePath) 
values(@Name,@Path)&quot;&lt;/span&gt;, con)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;cmd.Parameters.AddWithValue(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;@Name&quot;&lt;/span&gt;, filename)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;cmd.Parameters.AddWithValue(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;@Path&quot;&lt;/span&gt;, &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Files/&quot;&lt;/span&gt; &amp;amp; filename)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        
&lt;/span&gt;cmd.ExecuteNonQuery()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;con.Close()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        
&lt;/span&gt;BindGridviewData()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Protected&lt;/span&gt; 
&lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt; lnkDownload_Click(sender &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Object&lt;/span&gt;, e &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;EventArgs&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; 
lnkbtn &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;LinkButton&lt;/span&gt; = &lt;span style=&quot;color: blue;&quot;&gt;TryCast&lt;/span&gt;(sender, &lt;span style=&quot;color: #2b91af;&quot;&gt;LinkButton&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; 
gvrow &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;GridViewRow&lt;/span&gt; = &lt;span style=&quot;color: blue;&quot;&gt;TryCast&lt;/span&gt;(lnkbtn.NamingContainer, &lt;span style=&quot;color: #2b91af;&quot;&gt;GridViewRow&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; 
filePath &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;String&lt;/span&gt; = 
gvDetails.DataKeys(gvrow.RowIndex).Value.ToString()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;Response.ContentType = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;image/jpg&quot;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;Response.AddHeader(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Content-Disposition&quot;&lt;/span&gt;, &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;attachment;filename=&quot;&quot;&quot;&lt;/span&gt; &amp;amp; filePath &amp;amp; 
&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;&quot;&quot;&quot;&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        
&lt;/span&gt;Response.TransmitFile(Server.MapPath(filePath))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        
&lt;/span&gt;Response.[End]()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;End&lt;/span&gt;&lt;span style=&quot;mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;Class&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Build your application and run it then you will get output 
like the following:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;img border=&quot;0&quot; closure_uid_p5kng9=&quot;2&quot; height=&quot;266&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxoX9Dt1R1jfdDPXpbK4ASXqxC-ZiBYhNPTkMy2E-6d3SJ4_8-Ud3-TWv0lrf73AA1rPyL5v8kP1WwkWlgAAHEErXjTrkJvdd-1soOBXIYmV7kuBaEQHh9uOsc9cTiEuwmlovB8c20iA/s400/updp.jpg&quot; width=&quot;400&quot; /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/158318123398290160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2012/06/upload-and-download-file-from-gridview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/158318123398290160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/158318123398290160'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2012/06/upload-and-download-file-from-gridview.html' title='Upload and download a file from GridView in Asp.net using with C# and Vb || Gridview with file Download link button in Asp.net using with C# and Vb'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxoX9Dt1R1jfdDPXpbK4ASXqxC-ZiBYhNPTkMy2E-6d3SJ4_8-Ud3-TWv0lrf73AA1rPyL5v8kP1WwkWlgAAHEErXjTrkJvdd-1soOBXIYmV7kuBaEQHh9uOsc9cTiEuwmlovB8c20iA/s72-c/updp.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-8921503620647618061</id><published>2012-06-27T14:59:00.000+03:00</published><updated>2012-06-27T15:08:55.534+03:00</updated><title type='text'>Creating Dynamic Data Entry User Interfaces</title><content type='html'>&lt;h2 class=&quot;dtH1&quot;&gt;
&lt;a href=&quot;&quot; id=&quot;dynamicui_topic2&quot;&gt;&lt;/a&gt;A Primer on Dynamic Controls in ASP.NET&lt;/h2&gt;
As you know, ASP.NET Web pages are comprised of two parts: &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;An HTML portion that contains static HTML markup and Web controls, added through a declarative syntax.&lt;/li&gt;
&lt;li&gt;A code portion that can be implemented as a separate class file (as with Visual Studio .NET), or in a &lt;code class=&quot;ce&quot;&gt;&lt;script runat=&quot;server&quot;&gt;
&lt;/code&gt; block in the HTML file. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The Web controls of an ASP.NET Web page are added at design-time through a declarative syntax that spells out the Web control to be added and its initial property values, like so:&lt;/p&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot; href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_bd75f202-09e0-4071-b93e-558be543c69c&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_bd75f202-09e0-4071-b93e-558be543c69c&quot; class=&quot;codeSnippetContainerCode&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;asp:WebControlName 
runat=&quot;server&quot; 
prop1=&quot;Value1&quot; 
prop2=&quot;Value2&quot; 
...
propN=&quot;ValueN&quot;&gt;
&lt;/asp:WebControlName&gt;

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
What&#39;s important to understand is that when the ASP.NET page is visited for the first time, or for the first time after its HTML portion has been modified, the ASP.NET engine automatically converts this mix of static HTML content and Web control syntax into a class. The role of this auto-generated class is to create the &lt;em&gt;control hierarchy&lt;/em&gt;. The control hierarchy is the set of controls that compose the page—the static HTML markup is translated into &lt;code class=&quot;ce&quot;&gt;LiteralControl&lt;/code&gt; instances, and the Web controls are translated into instances of the corresponding class type (for example, the &lt;code class=&quot;ce&quot;&gt;&lt;asp:TextBox&gt;&lt;/code&gt; is translated into an instance of the &lt;code class=&quot;ce&quot;&gt;TextBox&lt;/code&gt; class in the &lt;code class=&quot;ce&quot;&gt;System.Web.UI.WebControls&lt;/code&gt; namespace).&lt;/p&gt;
&lt;p&gt;
The control hierarchy is called such because it is an actual hierarchy of controls. Each ASP.NET server control can have a set of child controls and a parent control. When the auto-generated class constructs the control hierarchy, it places the &lt;strong&gt;Page&lt;/strong&gt; class instance that represents the ASP.NET page at the top of the hierarchy. The &lt;strong&gt;Page&lt;/strong&gt; class&#39;s children controls are those top-level server controls defined in the page&#39;s HTML, which is typically some static HTML markup along with the Web Form&#39;s server control. (An ASP.NET page&#39;s Web Form—that &lt;code class=&quot;ce&quot;&gt;&lt;form runat=&quot;server&quot;&gt;
&lt;/code&gt; tag—is implemented as an instance of the &lt;code class=&quot;ce&quot;&gt;HtmlForm&lt;/code&gt; class, which can be found in the &lt;code class=&quot;ce&quot;&gt;System.Web.UI.HtmlControls&lt;/code&gt; namespace.)&lt;/p&gt;
&lt;p&gt;
The Web Form, like any other server control, can contain children controls. The children controls of a Web Form are those controls found within the Web Form itself. Even controls within the Web Form may have children themselves: a Panel control&#39;s contents constitute its children controls; when binding data to a DataGrid, its resulting contents makeup its set of children controls. Because the top-level &lt;code class=&quot;ce&quot;&gt;Page&lt;/code&gt; class may have children, which may have children, which may have children, and so on, this set of controls constitutes the control hierarchy.&lt;/p&gt;
&lt;p&gt;
To help hammer home this concept, which is vital to understand when working with dynamic controls, imagine that you had an ASP.NET page with the following content in its HTML portion:&lt;/p&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot; href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_f40ca63d-2750-4f7c-bbb4-5dd94c4ee236&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_f40ca63d-2750-4f7c-bbb4-5dd94c4ee236&quot; class=&quot;codeSnippetContainerCode&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;html&gt;
&lt;body&gt;
  &lt;h1&gt;
Welcome to my Homepage!&lt;/h1&gt;
&lt;form runat=&quot;server&quot;&gt;

    What is your name?
    &lt;asp:TextBox runat=&quot;server&quot; ID=&quot;txtName&quot;&gt;&lt;/asp:TextBox&gt;
    &lt;br /&gt;What is your gender?
    &lt;asp:DropDownList runat=&quot;server&quot; ID=&quot;ddlGender&quot;&gt;
      &lt;asp:ListItem Select=&quot;True&quot; Value=&quot;M&quot;&gt;Male&lt;/asp:ListItem&gt;
      &lt;asp:ListItem Value=&quot;F&quot;&gt;Female&lt;/asp:ListItem&gt;
      &lt;asp:ListItem Value=&quot;U&quot;&gt;Undecided&lt;/asp:ListItem&gt;
    &lt;/asp:DropDownList&gt;
    &lt;br /&gt;
    &lt;asp:Button runat=&quot;server&quot; Text=&quot;Submit!&quot;&gt;&lt;/asp:Button&gt;
  &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
When this page is first visited, a class will be auto-generated containing code to programmatically build up the control hierarchy. The control hierarchy for this example can be seen in Figure 1.&lt;/p&gt;
&lt;p&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/Aa479330.dynui_fig01l(l=en-us).gif&quot;&gt;&lt;img id=&quot;dynui_fig01S&quot; title=&quot;Aa479330.dynui_fig01S(en-us,MSDN.10).gif&quot; alt=&quot;Aa479330.dynui_fig01S(en-us,MSDN.10).gif&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC124347.gif&quot; xmlns=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 1. Control hierarchy&lt;/strong&gt;&lt;/p&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Programmatically Working with the Control Hierarchy&lt;/h3&gt;
&lt;p&gt;
As aforementioned, each ASP.NET server control can contain both a set of children controls and a parent control. The children controls are accessible through the server control&#39;s &lt;code class=&quot;ce&quot;&gt;Controls&lt;/code&gt; property, which is of type &lt;code class=&quot;ce&quot;&gt;ControlCollection&lt;/code&gt;. The &lt;code class=&quot;ce&quot;&gt;ControlCollection&lt;/code&gt; class provides functionality to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Determine how many children controls there are, using the read-only &lt;code class=&quot;ce&quot;&gt;Count&lt;/code&gt; property.&lt;/li&gt;
&lt;li&gt;Add a new item to the controls collection using the &lt;code class=&quot;ce&quot;&gt;Add()&lt;/code&gt; or &lt;code class=&quot;ce&quot;&gt;AddAt()&lt;/code&gt; methods.&lt;/li&gt;
&lt;li&gt;Remove all child controls with the &lt;code class=&quot;ce&quot;&gt;Clear()&lt;/code&gt; method, or remove a specific control with either the &lt;code class=&quot;ce&quot;&gt;Remove()&lt;/code&gt; or &lt;code class=&quot;ce&quot;&gt;RemoveAt()&lt;/code&gt; methods.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
To add a control to the control hierarchy as a child of control &lt;em&gt;X&lt;/em&gt;, simply create the control&#39;s corresponding class instance and add it to the &lt;code class=&quot;ce&quot;&gt;Controls&lt;/code&gt; collection of control &lt;em&gt;X&lt;/em&gt;. For example, to add a Label control to the &lt;code class=&quot;ce&quot;&gt;Controls&lt;/code&gt; collection of the &lt;code class=&quot;ce&quot;&gt;Page&lt;/code&gt; class, you could use the following code:&lt;/p&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot; href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_66090942-50fc-4649-a564-340fede4db12&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_66090942-50fc-4649-a564-340fede4db12&quot; class=&quot;codeSnippetContainerCode&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&#39;Create a new Label instance
Dim lbl as New Label

&#39;Add the control to the Page&#39;s Controls collection
Page.Controls.Add(lbl)

&#39;Set the Label&#39;s Text property to the current date/time
lbl.Text = DateTime.Now

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Adding a control to the end of the &lt;code class=&quot;ce&quot;&gt;Page&lt;/code&gt;&#39;s &lt;code class=&quot;ce&quot;&gt;Controls&lt;/code&gt; collection will cause the control to appear at the bottom of the Web page. If you need more control over the placement of the dynamically added control, you can add a PlaceHolder Web control to the page, specifying the location in the hierarchy to add one or more dynamic controls. To add the dynamic controls in that location, simply add them to the PlaceHolder&#39;s &lt;code class=&quot;ce&quot;&gt;Controls&lt;/code&gt; collection. For example, if you wanted to place the Label within a certain spot in the Web Form, you could add a PlaceHolder control like so:&lt;/p&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot; href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_d82b373a-7b20-4419-bae9-94fe153dfa48&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_d82b373a-7b20-4419-bae9-94fe153dfa48&quot; class=&quot;codeSnippetContainerCode&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;html&gt;
&lt;body&gt;
   ...
   &lt;form runat=&quot;server&quot;&gt;

     ...
     &lt;asp:PlaceHolder runat=&quot;server&quot; id=&quot;dateTimeLabel&quot;&gt;&lt;/asp:PlaceHolder&gt;
     ...
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
To add the dynamic Label from our past example, rather than using &lt;code class=&quot;ce&quot;&gt;Page.Controls.Add(lbl)&lt;/code&gt;, you&#39;d use &lt;code class=&quot;ce&quot;&gt;dateTimeLabel.Controls.Add(lbl)&lt;/code&gt;, thereby adding the Label to the PlaceHolder&#39;s &lt;code class=&quot;ce&quot;&gt;Controls&lt;/code&gt; collection as opposed to the &lt;code class=&quot;ce&quot;&gt;Page&lt;/code&gt;&#39;s &lt;code class=&quot;ce&quot;&gt;Controls&lt;/code&gt; collection. Figure 2 provides a graphical illustration of the control hierarchy both before and after the dynamic Label has been added to the PlaceHolder&#39;s &lt;code class=&quot;ce&quot;&gt;Controls&lt;/code&gt; collection.&lt;/p&gt;
&lt;p class=&quot;fig&quot;&gt;
&lt;img id=&quot;dynui_fig02&quot; title=&quot;Aa479330.dynui_fig02(en-us,MSDN.10).gif&quot; alt=&quot;Aa479330.dynui_fig02(en-us,MSDN.10).gif&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC93845.gif&quot; xmlns=&quot;&quot;&gt;&lt;/p&gt;
&lt;p class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 2. Graphical illustration of the control hierarchy both before and after the dynamic Label has been added&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
Typically it is best to add dynamic controls to the &lt;em&gt;end&lt;/em&gt; of the &lt;code class=&quot;ce&quot;&gt;Controls&lt;/code&gt; collection using the &lt;code class=&quot;ce&quot;&gt;Add()&lt;/code&gt; method, rather than adding it to a specific location in the collection using &lt;code class=&quot;ce&quot;&gt;AddAt()&lt;/code&gt;. The reason is because of the manner in which view state is saved as each control records its view state along with the view state of its children controls. When saving its children controls&#39; view states, each control records the child control&#39;s view state along with the ordinal index of the control in the &lt;code class=&quot;ce&quot;&gt;Controls&lt;/code&gt; collection. &lt;/p&gt;
&lt;p&gt;
Upon postback, when the view state is reloaded, the process reverses itself, with each control loading its child controls&#39; view states. The control reloading its view state enumerates through the view state information, applying the view state for the control in the specified position in the &lt;code class=&quot;ce&quot;&gt;Controls&lt;/code&gt; collection. Problems can arise if, prior to the view state being loaded, you insert a control into the &lt;code class=&quot;ce&quot;&gt;Controls&lt;/code&gt; collection in a position other than the tail end because the view state information for each child control is tied to a specific index in the &lt;code class=&quot;ce&quot;&gt;Controls&lt;/code&gt; collection.&lt;/p&gt;
&lt;p&gt;
To see how adding a dynamic control to a position other than at the end can cause a problem with reloading the view state, consult Figure 3. Figure 3 shows a server control &lt;em&gt;p&lt;/em&gt; with three children controls: &lt;em&gt;c0&lt;/em&gt;, &lt;em&gt;c1&lt;/em&gt;, and &lt;em&gt;c2&lt;/em&gt;, with control &lt;em&gt;c1&lt;/em&gt; having some view state persisted across postback. If, on postback, a dynamic control, &lt;em&gt;c&lt;/em&gt;, is added to the front of &lt;em&gt;p&lt;/em&gt;&#39;s &lt;code class=&quot;ce&quot;&gt;Controls&lt;/code&gt; collection, when reloading the view state &lt;em&gt;p&lt;/em&gt; will attempt to reload &lt;em&gt;c1&lt;/em&gt;&#39;s view state in index 1, which is now occupied by &lt;em&gt;c0&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/Aa479330.dynui_fig03l(l=en-us).gif&quot;&gt;&lt;img id=&quot;dynui_fig03S&quot; title=&quot;Aa479330.dynui_fig03S(en-us,MSDN.10).gif&quot; alt=&quot;Aa479330.dynui_fig03S(en-us,MSDN.10).gif&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC82366.gif&quot; xmlns=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 3. Server control &lt;em&gt;p&lt;/em&gt; with three children controls&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
The same view state related issues can arise when removing controls. All of this, of course, depends on when in the page lifecycle you&#39;re adding or removing controls. For a more thorough discussion of view state, the page life cycle, and issues surrounding adding and removing dynamic controls and view state, be sure to read my earlier article &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms972976.aspx&quot;&gt;Understanding ASP.NET View State&lt;/a&gt;.&lt;/p&gt;
&lt;h4 class=&quot;dtH1&quot;&gt;
Accessing Dynamically Added Controls&lt;/h4&gt;
&lt;p&gt;
When adding static Web controls to an ASP.NET page, Visual Studio .NET automatically adds references to the Web controls in the code-behind class. These references to the Web controls allow for strongly-typed access to the controls, their properties, and their methods. When working with dynamically-added controls there are a couple of techniques that can be employed to access a control&#39;s properties, methods, and events.&lt;/p&gt;
&lt;p&gt;
One approach is to find the dynamic control through an exhaustive examination of the control hierarchy. The following code, for example, illustrates how to recursively iterate the control hierarchy rooted at a specified control. Such code could be useful, for example, if a number of DropDownList controls had been dynamically-added to a specified PlaceHolder. In such a case you could enumerate the PlaceHolder&#39;s control descendents by calling &lt;code class=&quot;ce&quot;&gt;RecurseThroughControlHierarchy(PlaceHolderControl)&lt;/code&gt;, adding code to the &quot;Do whatever it is you need to do with the current control, &lt;code class=&quot;ce&quot;&gt;c&lt;/code&gt;&quot; section that would check to see if &lt;code class=&quot;ce&quot;&gt;c&lt;/code&gt; was of type DropDownList and, if so, would take some action.&lt;/p&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot; href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_91438fe9-0011-4240-9013-5fd20cc0cde1&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_91438fe9-0011-4240-9013-5fd20cc0cde1&quot; class=&quot;codeSnippetContainerCode&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;Private Sub RecurseThroughControlHierarchy(ByVal c as Control)
  &#39;Do whatever it is you need to do with the current control, c

  &#39;Recurse through c&#39;s children controls
  For Each child as Control in c.Controls
    RecurseThroughControlHierarchy(child)
  Next
End Sub

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
The above approach works well if you have a number of similar server controls that you need to work with en masse. Oftentimes, though, you might have a gaggle of dissimilar controls that you need to be able to access individually at different times, performing different actions on each control. To programmatically work with a specific dynamically-added control, you can use the &lt;code class=&quot;ce&quot;&gt;FindControl(ID)&lt;/code&gt; method to search for a control by its &lt;code class=&quot;ce&quot;&gt;ID&lt;/code&gt;. The &lt;code class=&quot;ce&quot;&gt;FindControl()&lt;/code&gt; method is defined in the &lt;code class=&quot;ce&quot;&gt;System.Web.UI.Control&lt;/code&gt; class, so &lt;em&gt;all&lt;/em&gt; server controls, from TextBoxes to PlaceHolders to Web Forms, have this method available.&lt;/p&gt;
&lt;p&gt;
Calling a control&#39;s &lt;code class=&quot;ce&quot;&gt;FindControl()&lt;/code&gt; method does not necessarily search all of the control&#39;s descendent controls. &lt;code class=&quot;ce&quot;&gt;FindControl()&lt;/code&gt; only searches the current &lt;em&gt;naming container&lt;/em&gt;. Controls that implement &lt;code class=&quot;ce&quot;&gt;INamingContainer&lt;/code&gt; behave as a naming container, meaning that they create their own &lt;code class=&quot;ce&quot;&gt;ID&lt;/code&gt; namespace in the control hierarchy. For example, the DataGrid control is a naming container. Given a DataGrid with ID &lt;code class=&quot;ce&quot;&gt;myDataGrid&lt;/code&gt;, its children controls&#39; &lt;code class=&quot;ce&quot;&gt;ID&lt;/code&gt;s are prefixed with their parent&#39;s &lt;code class=&quot;ce&quot;&gt;ID&lt;/code&gt;, as in &lt;code class=&quot;ce&quot;&gt;myDataGrid:childID&lt;/code&gt;. What is important to realize is that &lt;code class=&quot;ce&quot;&gt;FindControl()&lt;/code&gt; is only enumerating the set of children controls or controls in the naming container, and not all descendents of the parent in the control hierarchy. (Furthermore, to search beyond the first level of controls in a naming container, you&#39;ll need to use the properly scoped &lt;code class=&quot;ce&quot;&gt;ID&lt;/code&gt;.) The point is, when using &lt;code class=&quot;ce&quot;&gt;FindControl()&lt;/code&gt; to hunt for a dynamically-added control, call &lt;code class=&quot;ce&quot;&gt;FindControl()&lt;/code&gt; from the parent control of the dynamic control (typically a PlaceHolder control).&lt;/p&gt;
&lt;p&gt;
When using the &lt;code class=&quot;ce&quot;&gt;FindControl()&lt;/code&gt; approach, code similar to the following is used to assign a unique ID to the dynamically-added control and to, later, reference said control.&lt;/p&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot; href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_80c166a6-db76-440b-aa33-01fb1c531330&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_80c166a6-db76-440b-aa33-01fb1c531330&quot; class=&quot;codeSnippetContainerCode&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&#39;When adding the control, set the ID property
Dim tb As New TextBox
PlaceHolderID.Controls.Add(tb)
tb.ID = &quot;dynTextBox&quot;

&#39;At some later point in the page lifecycle, 
&#39;reference the dynamic TextBox
Dim dTB As TextBox
dTB = CType(PlaceHolderID.FindControl(&quot;dynTextBox&quot;), TextBox)

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Since the &lt;code class=&quot;ce&quot;&gt;FindControl()&lt;/code&gt; method locates a control using its &lt;code class=&quot;ce&quot;&gt;ID&lt;/code&gt;, when using this technique to access dynamically-added controls it is vital that each dynamically-added control have its &lt;code class=&quot;ce&quot;&gt;ID&lt;/code&gt; property assigned a unique and identifiable value. There are various methodologies that can be employed, depending on the situation. As we&#39;ll see later in this article, when examining a dynamic data entry user interface engine, each dynamic question is represented by a row in a database, which contains a unique primary key field. This primary key field value is what is used in the ASP.NET page as an &lt;code class=&quot;ce&quot;&gt;ID&lt;/code&gt; for each dynamically-added control. If you do not need to differentiate among the dynamically-added controls, another technique is to give them sequentially increasing numbers as IDs, like &lt;code class=&quot;ce&quot;&gt;myDynCtrl1&lt;/code&gt; for the first dynamically added control, &lt;code class=&quot;ce&quot;&gt;myDynCtrl2&lt;/code&gt; for the second, and so on.&lt;/p&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
The Page Lifecycle and Dynamic Controls&lt;/h3&gt;
&lt;p&gt;
Whenever an ASP.NET Web page is visited, be it on an initial page visit or on postback, the control hierarchy is rebuilt from scratch each and every time by the class auto-generated by the ASP.NET engine. Not only is the control hierarchy reconstructed, but the controls&#39; events are rewired to their specified event handlers. Therefore, when adding dynamic controls to an ASP.NET page, it is vital that you make sure to add these controls on &lt;em&gt;every&lt;/em&gt; page visit. Many developers starting off with adding dynamic controls will do so using the following pattern:&lt;/p&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot; href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_3c5954c3-700c-4bba-8894-ede870a8b41e&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_3c5954c3-700c-4bba-8894-ede870a8b41e&quot; class=&quot;codeSnippetContainerCode&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&#39;In the Page_Load event handler...
If Not Page.IsPostBack Then
  &#39;Add dynamic controls...
End If

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
The problem with this code is that it adds the dynamic controls only on the first page visit and not on subsequent postbacks. If you attempt to utilize such code, you&#39;ll find that whenever a postback occurs, your dynamic controls disappear from the page. Therefore, you must be certain to add all dynamic controls on all page visits by moving the code out of the &lt;code class=&quot;ce&quot;&gt;If Not Page.IsPostBack&lt;/code&gt; conditional statement.&lt;/p&gt;
&lt;p&gt;
One important question adding dynamic controls raises is when in the page lifecycle to add such controls. As I discussed in &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms972976.aspx&quot;&gt;Understanding ASP.NET View State&lt;/a&gt;, an ASP.NET page proceeds through a number of steps whenever a request arrives. Let&#39;s take a brief moment to recap the germane stages in a page&#39;s lifecycle. For a more in-depth look, be sure to turn to the view state article, focusing on the article&#39;s T&lt;strong&gt;he ASP.NET Page Lifecycle&lt;/strong&gt; section.&lt;/p&gt;
&lt;h4 class=&quot;dtH1&quot;&gt;
A Review of the ASP.NET Page Lifecycle&lt;/h4&gt;
&lt;p&gt;
The first stage in a page&#39;s lifecycle is &lt;em&gt;Instantiation&lt;/em&gt;, during which the auto-generated class builds up the control hierarchy from the static controls defined in the page&#39;s HTML portion. As the control hierarchy is constructed, the properties of each added control are assigned the values specified in the declarative syntax. Following Instantiation is the Initialization stage, at which point the static control hierarchy has been constructed, but the view state has yet to be reloaded (assuming the page request is a postback). If the page request is a postback, after Initialization comes the Load View State stage. Here the page percolates the view state data it found in the hidden &lt;code class=&quot;ce&quot;&gt;VIEWSTATE&lt;/code&gt; form field, and each control in the control hierarchy updates its state, if needed.&lt;/p&gt;
&lt;p&gt;
If the page request is a postback, the Load Postback Data stage follows the Load View State stage. In this stage, the form field values sent are inspected and corresponding controls&#39; properties are updated accordingly. For example, the text entered by the user into a TextBox Web control is sent back through the POST mechanism, signaling both the name of the TextBox control and the value entered by the user. The page takes these values, locates the appropriate TextBox in the control hierarchy, and assigns its &lt;code class=&quot;ce&quot;&gt;Text&lt;/code&gt; property to the value received.&lt;/p&gt;
&lt;p&gt;
The next stage is the Load stage, which is when the &lt;code class=&quot;ce&quot;&gt;Page_Load&lt;/code&gt; event handler fires. There are more stages following the Load stage, such as raising postback events, saving the view state, and rendering the Web page, but these are not relevant to the topic of dynamic controls, and therefore don&#39;t warrant a discussion. Figure 4 shows a graphical illustration of the events as a page proceeds through during its lifecycle.&lt;/p&gt;
&lt;p&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/Aa479330.dynui_fig04l(l=en-us).gif&quot;&gt;&lt;img id=&quot;dynui_fig04S&quot; title=&quot;Aa479330.dynui_fig04S(en-us,MSDN.10).gif&quot; alt=&quot;Aa479330.dynui_fig04S(en-us,MSDN.10).gif&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC114962.gif&quot; xmlns=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 4. Page lifecycle&lt;/strong&gt;&lt;/p&gt;
&lt;h4 class=&quot;dtH1&quot;&gt;
Determining When in the Page Lifecycle to Add Dynamic Controls&lt;/h4&gt;
&lt;p&gt;
The question of when to add dynamic controls in the page lifecycle can be summarized as thus—dynamic controls need to be added previous to loading of the view state and reloading of postback data because we want any view state or postback values specific to the dynamic controls to be properly added. Given these constraints the natural place to add dynamic controls is the Initialization stage because it transpires before the Load View State and Load Postback Data stages.&lt;/p&gt;
&lt;p&gt;
In the Initialization stage, however, neither the view state nor the postback data has yet to be restored, so it&#39;s ill-advised to access or set properties of controls—either dynamic or static ones—that might be stored in view state or modified by a postback value, as these values will be overwritten by the view state and postback values during later stages in the lifecycle. The pattern I use when working with dynamic controls is as follows: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In the Initialization stage I add the dynamic controls to the control hierarchy and set the &lt;code class=&quot;ce&quot;&gt;ID&lt;/code&gt; property&lt;/li&gt;
&lt;li&gt;In the Load stage, I assign any needed initial values to the dynamic controls within an &lt;code class=&quot;ce&quot;&gt;If Not Page.IsPostback&lt;/code&gt; conditional statement. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I need to add the dynamic controls on each and every postback, but I set their property values only on the first page load since these values will be maintained in view state. The following code snippet illustrates this pattern:&lt;/p&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot; href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_c9c986a5-d8f5-45df-9436-6af21004c58f&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_c9c986a5-d8f5-45df-9436-6af21004c58f&quot; class=&quot;codeSnippetContainerCode&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&#39;In the Init event of the Page, add a dynamic TextBox
Dim tb as New TextBox
PlaceHolderID.Controls.Add(tb)
tb.ID = &quot;dynTextBox&quot;

&#39;In the Page_Load event handler, set the properties 
&#39;of the TextBox
If Not Page.IsPostBack Then
  Dim dTB As TextBox
  dTB = CType(PlaceHolderID.FindControl(&quot;dynTextBox&quot;), TextBox)
  dTB.Text = &quot;Some initial value&quot;
  dTB.BackColor = Color.Red  &#39;initial BackColor
End If

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
In addition to loading dynamic controls in the Initialization stage, you can also add them in the Load stage, without any ill side effects. When a control is added to another control&#39;s &lt;code class=&quot;ce&quot;&gt;Controls&lt;/code&gt; collection, the added control is immediately entrenched in the lifecycle with its new parent control. For example, if the parent control is in the initialization stage, the added control&#39;s Init event is raised, brining it in sync with its parent. If the parent is in the Load stage or later, the added child control immediately passes through the Initialization, Load View State, Load Postback Data, and Load stages.&lt;/p&gt;
&lt;p&gt;
There is one caveat to be aware of when adding controls in the Load stage. After a control completes its Load View State stage, it begins to track changes to its view state. What this means is any property changes &lt;em&gt;after&lt;/em&gt; the Load View State stage are automatically persisted to the control&#39;s view state. Before a control begins to track changes to its view state, property value changes are not persisted to view state. If you add a control in the Initialization stage and then set its properties in the Load stage, there is no problem because between the Initialization stage and Load stage the Load View State stage has transpired, and the control&#39;s track view state changes flag has been raised. That is, if the dynamic control is added in the Initialization stage, by the time the Load stage is running, assigning properties to the dynamic control will be persisted to view state.&lt;/p&gt;
&lt;blockquote class=&quot;dtBlock&quot;&gt;
&lt;div&gt;
&lt;strong&gt;Note   &lt;/strong&gt;The &quot;track view state changes flag&quot; cannot be modified by a page developer. The &lt;div class=&quot;tt&quot;&gt;
System.Web.UI.Control&lt;/div&gt;
, from which all ASP.NET server controls are derived from, provides only protected access to this flag. Specifically, there&#39;s a protected, read-only property named &lt;div class=&quot;tt&quot;&gt;
IsTrackingViewState&lt;/div&gt;
that indicates if view state is being tracked or not, as well as the protected &lt;div class=&quot;tt&quot;&gt;
TrackViewState()&lt;/div&gt;
method that indicates view state tracking should begin. This method is called automatically by all controls at the end of the Initialization stage.&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;
If, however, you don&#39;t add the dynamic control until the Load stage, it is vital that you do not set any of the dynamic control&#39;s properties until &lt;em&gt;after&lt;/em&gt; you&#39;ve added the control to the control hierarchy. To understand why, consider what would happen if the following code were executed in the Load stage:&lt;/p&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot; href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_198d99bd-8291-4be6-ab4c-1a591cff9691&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_198d99bd-8291-4be6-ab4c-1a591cff9691&quot; class=&quot;codeSnippetContainerCode&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;Dim tb as New TextBox

If Not Page.IsPostBack Then
  tb.BackColor = Color.Red  &#39;initial BackColor
End If

PlaceHolderID.Controls.Add(tb)

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
As you can see, on each page load a TextBox is created. On just the first page load, the TextBox&#39;s &lt;code class=&quot;ce&quot;&gt;BackColor&lt;/code&gt; property is set to Red, and then, on every page load, the control is added to the control hierarchy. While the TextBox&#39;s background color will indeed be Red on the first page load, the problem is that on postback the TextBox&#39;s background color will revert back to the default (no background color). This is because the TextBox&#39;s &lt;code class=&quot;ce&quot;&gt;BackColor&lt;/code&gt; property assignment is not being persisted to view state, so it&#39;s lost on postback. It&#39;s lost because the TextBox, like any other server control, doesn&#39;t begin tracking view state until after the Load View State stage. But the TextBox doesn&#39;t pass through this stage until after it&#39;s been added to the control hierarchy, so the &lt;code class=&quot;ce&quot;&gt;BackColor&lt;/code&gt; assignment is not persisted to view state. To correct this, be sure to first advance the control through its Load View State stage by adding it to the control hierarchy, and then assigning its properties, like so:&lt;/p&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot; href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_cb3706e9-60cf-485d-91ec-f9a105c3b4d4&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_cb3706e9-60cf-485d-91ec-f9a105c3b4d4&quot; class=&quot;codeSnippetContainerCode&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;Dim tb as TextBox
PlaceHolderID.Controls.Add(tb)

If Not Page.IsPostBack Then
  tb.BackColor = Color.Red  &#39;initial BackColor
End If

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
This detail is not pertinent if you are adding your dynamic controls in the Initialization stage. For a more in-depth discussion on this, refer to &lt;a href=&quot;http://scottonwriting.net/sowblog/&quot;&gt;my blog&lt;/a&gt; entry &lt;a href=&quot;http://scottonwriting.net/sowblog/posts/2129.aspx&quot;&gt;Control Building and View State Lesson for the Day&lt;/a&gt;.&lt;/p&gt;
&lt;h4 class=&quot;dtH1&quot;&gt;
Events and Dynamic Controls&lt;/h4&gt;
&lt;p&gt;
Just like static server controls, dynamically-added controls can have their events tied to event handlers. Just as you have to add a control to the control hierarchy on each and every page visit, you need to wire up the dynamic control&#39;s event to the specified event handler on each and every page visit. Part of the challenge in doing so is that you need to have an appropriate event handler defined in the class. If your controls are truly dynamic, then how could you have any idea as to what event handlers will be needed in the code-behind class? In my experience, I&#39;ve found that the best solution to working with events and dynamic controls is to use User Controls rather than singleton Web controls. With a User Control, I can embed specific event handlers and programming logic within the User Control&#39;s code portion. We&#39;ll see how to dynamically add User Controls in the next section.&lt;/p&gt;
&lt;p&gt;
If you must tie a dynamically-added Web control&#39;s event with an event handler, be certain to do so on every page visit. The following code, which is included in this article&#39;s download, demonstrates how to associate a dynamically-added Button Web control&#39;s &lt;code class=&quot;ce&quot;&gt;Click&lt;/code&gt; event with an existing event handler. (&lt;code class=&quot;ce&quot;&gt;ph&lt;/code&gt; is the name of a PlaceHolder control on the page. For an example of wiring an event to an event handler with C#, along with a more detailed look at event handling in the .NET Framework, see Peter Bromberg&#39;s article &lt;a href=&quot;http://www.eggheadcafe.com/articles/20040313.asp&quot;&gt;Delegates to the Event&lt;/a&gt;.)&lt;/p&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot; href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_5f6dcc92-e410-43be-8211-657f94b2c855&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_5f6dcc92-e410-43be-8211-657f94b2c855&quot; class=&quot;codeSnippetContainerCode&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   Dim b As New Button
   ph.Controls.Add(b)

   If Not Page.IsPostBack Then
      b.Text = &quot;Click Me&quot;
   End If

   AddHandler b.Click, New EventHandler(AddressOf Me.ButtonClickEventHandler)
End Sub

Private Sub ButtonClickEventHandler(ByVal sender As Object, ByVal e As EventArgs)
   Response.Write(&quot;The button has been clicked!&quot;)
End Sub

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2 class=&quot;dtH1&quot;&gt;
&lt;a id=&quot;dynamicui_topic3&quot;&gt;&lt;/a&gt;Building a Dynamic Data Entry User Interface Engine&lt;/h2&gt;
&lt;p&gt;
Over the past couple of years, I&#39;ve worked on a number of projects that have required &lt;em&gt;dynamic data entry user interfaces&lt;/em&gt;, user interfaces that depend on one of more user-influenced factors. A fundamental requirement for all of these projects was that these dynamic interfaces needed to be able to be easily created, updated, and deleted by users who are not computer-savvy. Over the course of these projects, I&#39;ve developed a dynamic data entry user interface engine that allows for developers to create the user interface building blocks that non-developers can then piece together to form user interfaces specific for particular users. &lt;/p&gt;
&lt;p&gt;
In the remainder of this article, we&#39;ll step through a simplified version of this engine. Specifically, the demo in this article shows how to have a unique data entry user interface for customers based on the customer&#39;s type. Regular customers, for example, are presented with a different user interface than online-only customers, or bulk purchasing customers.&lt;/p&gt;
&lt;p&gt;
The fundamental pieces of the dynamic data entry user interface engine are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;User Interface Building Blocks:&lt;/strong&gt; the user interface building blocks are User Controls, the creation of which are the responsibility of the developers on the team. These building blocks are designed to be specific only in the type of information they collect, but not in the specific data requested. For example, one of the UI building blocks included in this demo is a building block prompting the user for an integer value as input. The User Control contains a TextBox along with a CompareValidator to ensure that the user enters a valid Integer value. This building block can be assembled into a dynamic data entry user interface by associating it with a question like, &quot;How old are you?&quot; or, &quot;How many miles is it from your home to your place of work?&quot;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Questions:&lt;/strong&gt; a question is a customized building block, created by non-computer-savvy users through a Web-based interface. A question associates some text with a UI building block.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Differentiating Variables:&lt;/strong&gt; each dynamic data entry user interface is predicated on one or more variables. For example, for an online product registration site, the user interface might hinge on what product was purchased. For data entry of employee information, the UI might differ on the employee&#39;s department. For the engine presented in this article, the differentiating variable is hard-coded as the customer type.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dynamic Questions:&lt;/strong&gt; for a given differentiating variable, a set of questions are specified. The combined mapping of questions and differentiating variables forms the dynamic questions of the system.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dynamic Answers:&lt;/strong&gt; When a dynamic data entry form is completed for a given customer, the customer&#39;s information must be saved to the database. The set of answers for a given customer are the dynamic answers in the system.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The User Interface Building Blocks piece of the dynamic data entry user interface engine is implemented as User Controls in the ASP.NET application. The remaining pieces are implemented as database entities. Figure 5 shows the engine&#39;s entity-relationship diagram, depicting how the various pieces are represented in the database.&lt;/p&gt;
&lt;p class=&quot;fig&quot;&gt;
&lt;img id=&quot;dynui_fig05&quot; title=&quot;Aa479330.dynui_fig05(en-us,MSDN.10).gif&quot; alt=&quot;Aa479330.dynui_fig05(en-us,MSDN.10).gif&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC60546.gif&quot; xmlns=&quot;&quot;&gt;&lt;/p&gt;
&lt;p class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 5. Entity-relastionship diagram &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
When examining Figure 5, first notice the &lt;code class=&quot;ce&quot;&gt;dq_Questions&lt;/code&gt; table. This table&#39;s records represent questions in the system. For each question there&#39;s some text associated with the question (&lt;code class=&quot;ce&quot;&gt;QuestionText&lt;/code&gt;) and a User Control (&lt;code class=&quot;ce&quot;&gt;ControlSrc&lt;/code&gt;). The &lt;code class=&quot;ce&quot;&gt;ControlSrc&lt;/code&gt; field contains the filename of the User Control, like &lt;code class=&quot;ce&quot;&gt;DQIntegerInput.ascx&lt;/code&gt;. Next, in the bottom-left hand corner there&#39;s the &lt;code class=&quot;ce&quot;&gt;dq_Customers&lt;/code&gt; table. Each customer has a specific customer type, all of the types being spelled out in the &lt;code class=&quot;ce&quot;&gt;dq_CustomerTypes&lt;/code&gt; table.&lt;/p&gt;
&lt;p&gt;
Dynamic questions, which are the set of mappings between questions and customer types, are implemented through the &lt;code class=&quot;ce&quot;&gt;dq_DynamicQuestions&lt;/code&gt; table. There, a question and customer type are tied together, along with a sort order, which indicates the order in which the questions are presented for a particular customer type. Finally, the dynamic answers are stored in the &lt;code class=&quot;ce&quot;&gt;dq_DynamicAnswers&lt;/code&gt; table, which ties each dynamic question with a specific customer. Because we cannot be sure of the type of answer from a given question—it might be a string, a Boolean, an integer, and so on—the &lt;code class=&quot;ce&quot;&gt;dq_DynamicAnswers&lt;/code&gt; table has six columns, one for every data type the system allows. A given question can only have a single type, and for its answer, the corresponding field will have the answer&#39;s value, while the remaining columns will have &lt;code class=&quot;ce&quot;&gt;NULL&lt;/code&gt; values.&lt;/p&gt;
&lt;blockquote class=&quot;dtBlock&quot;&gt;
&lt;div&gt;
&lt;strong&gt;Note   &lt;/strong&gt;A couple of quick notes on the data model. I decided to use a synthetic primary key on the &lt;div class=&quot;tt&quot;&gt;
dq_DynamicQuestions&lt;/div&gt;
table (&lt;div class=&quot;tt&quot;&gt;
DynamicQuestionID&lt;/div&gt;
) rather than making &lt;div class=&quot;tt&quot;&gt;
CustomerTypeID&lt;/div&gt;
and &lt;div class=&quot;tt&quot;&gt;
QuestionID&lt;/div&gt;
a composite primary key to allow for duplicate questions for a given customer type. For example, a question might be, &quot;Additional comments,&quot; and use a User Interface Building Block that contains a multi-line TextBox. Because you might want to have an &quot;Additional comments&quot; question after a number of other questions, I decided to allow for repeat questions.&lt;/div&gt;
&lt;/blockquote&gt;
&lt;blockquote class=&quot;dtBlock&quot;&gt;
&lt;div&gt;
The &lt;div class=&quot;tt&quot;&gt;
dq_Questions&lt;/div&gt;
table is in its simplest form. In past projects I have bounced between leaving this table very simple and embedding specifics in the User Interface Building Blocks, versus adding additional fields to this table that interplay with the UI. For example, an application might need to be able to indicate that some questions are required, while others are optional. In such a system there are two ways to tackle the problem. The first is to place the responsibility in the UI Building Blocks. That is, rather than creating a single UI Building Block for, say, integer inputs, two would be created—one that utilizes a RequiredFieldValidator to ensure that a value was entered, and one that imposes no such condition. When forming the question, the administrator could choose which UI Building Block to use based on if the question was required or not. An alternative approach would be to add a &lt;div class=&quot;tt&quot;&gt;
Required&lt;/div&gt;
field to the &lt;div class=&quot;tt&quot;&gt;
dq_Questions&lt;/div&gt;
table, and use only one UI Building Block. With this second approach, each UI Building Block would need a &lt;div class=&quot;tt&quot;&gt;
Required&lt;/div&gt;
property and would be responsible for enabling or disabling the proper validation controls based on this property value.&lt;/div&gt;
&lt;/blockquote&gt;
&lt;blockquote class=&quot;dtBlock&quot;&gt;
&lt;div&gt;
Finally, the &lt;div class=&quot;tt&quot;&gt;
dq_DynamicAnswers&lt;/div&gt;
table, with its six answer-related fields, only allows for scalar answers from a UI Building Block. That is, a UI Building Block&#39;s answer can be a string, integer, double, date, currency, or Boolean. But what if we need the UI Building Block to have a more complex answer, like an Address, which might have several fields in itself? Such complex answers will need to be serialized by the UI Building Block into one of the acceptable types when returning the answer. When displaying the answer, such results will need to be deserialized accordingly. To aid in this you can rely on the inherent binary serialization capabilities of .NET&#39;s , but to do so you might want to add a &lt;div class=&quot;tt&quot;&gt;
BinaryAnswer&lt;/div&gt;
field to this table of type &lt;div class=&quot;tt&quot;&gt;
binary&lt;/div&gt;
.&lt;/div&gt;
&lt;/blockquote&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Design Rules for the User Interface Building Blocks&lt;/h3&gt;
&lt;p&gt;
In order to facilitate a truly dynamic data entry user interface with developer-designed User Controls, it is vital that the User Controls used as the UI Building Blocks provide a base level of functionality. This base level of functionality is spelled out in the &lt;code class=&quot;ce&quot;&gt;IUIBuildingBlock&lt;/code&gt; interface. This interface defines three properties that all UI Building Blocks must implement:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;DataType:&lt;/strong&gt; a read-only property that returns the data type of the answer provided by the UI Building Block. Must be one of the values from the &lt;code class=&quot;ce&quot;&gt;DQDataTypes&lt;/code&gt; enumeration.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;QuestionText:&lt;/strong&gt; the question&#39;s text to display in the UI Building Block.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Answer:&lt;/strong&gt; the answer for the UI Building Block.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
To illustrate how these properties are used, let&#39;s look at a simple UI Building Block. Imagine that we want to create a UI Building Block that prompts the user for an integer input. We can do so by creating a new User Control that contains the following content in its HTML portion:&lt;/p&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot; href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_e008ed95-1a6a-412a-b795-b6d7878246b4&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_e008ed95-1a6a-412a-b795-b6d7878246b4&quot; class=&quot;codeSnippetContainerCode&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&lt;asp:Label id=&quot;dqQuestion&quot; runat=&quot;server&quot; CssClass=&quot;DQQuestionText&quot;&gt;&lt;/asp:Label&gt;:
&lt;asp:TextBox id=&quot;dqAnswer&quot; runat=&quot;server&quot; CssClass=&quot;DQAnswer&quot; Columns=&quot;4&quot;&gt;&lt;/asp:TextBox&gt;&amp;nbsp;
&lt;asp:CompareValidator id=&quot;CompareValidator1&quot; runat=&quot;server&quot; CssClass=&quot;DQErrorMessage&quot; ErrorMessage=&quot;You must enter a number here.&quot;
   ControlToValidate=&quot;dqAnswer&quot; Type=&quot;Integer&quot; Operator=&quot;DataTypeCheck&quot;&gt;&lt;/asp:CompareValidator&gt;

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
This markup includes: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A Label Web control (&lt;code class=&quot;ce&quot;&gt;dqQuestion&lt;/code&gt;) that displays the UI Building Block&#39;s &lt;code class=&quot;ce&quot;&gt;QuestionText&lt;/code&gt; property; &lt;/li&gt;
&lt;li&gt;A TextBox (&lt;code class=&quot;ce&quot;&gt;dgAnswer&lt;/code&gt;) into which the user will enter their integer value&lt;/li&gt;
&lt;li&gt;A CompareValidator to ensure that the input entered is indeed an integer. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The source code portion of the User Control is fairly simple. It has the User Control&#39;s class implement the &lt;code class=&quot;ce&quot;&gt;IUIBuildingBlock&lt;/code&gt; interface, and provides the logic for the three required properties:&lt;/p&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot; href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_2e328739-471f-4b9c-a1e4-097a2e294837&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_2e328739-471f-4b9c-a1e4-097a2e294837&quot; class=&quot;codeSnippetContainerCode&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;Public Class DQIntegerQuestion
    Inherits System.Web.UI.UserControl
    Implements IUIBuildingBlock

    ...

    Public ReadOnly Property DataType() As DQDataTypes Implements IUIBuildingBlock.DataType
        Get
            Return DQDataTypes.Integer
        End Get
    End Property

    Public Property Answer() As Object Implements IUIBuildingBlock.Answer
        Get
            If dqAnswer.Text.Trim() = String.Empty Then
                Return DBNull.Value
            Else
                Return dqAnswer.Text
            End If
        End Get
        Set(ByVal Value As Object)
            dqAnswer.Text = Value
        End Set
    End Property

    Public Property QuestionText() As String Implements IUIBuildingBlock.QuestionText
        Get
            Return dqQuestion.Text
        End Get
        Set(ByVal Value As String)
            dqQuestion.Text = Value
        End Set
    End Property
End Class

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
The read-only &lt;code class=&quot;ce&quot;&gt;DataType&lt;/code&gt; property returns the data type that is returned by the User Control—Integer. The &lt;code class=&quot;ce&quot;&gt;QuestionText&lt;/code&gt; property simply reads from or writes to the &lt;code class=&quot;ce&quot;&gt;dqQuestion&lt;/code&gt; Label control&#39;s &lt;code class=&quot;ce&quot;&gt;Text&lt;/code&gt; property, while the &lt;code class=&quot;ce&quot;&gt;Answer&lt;/code&gt; property reads from or writes to the &lt;code class=&quot;ce&quot;&gt;dgAnswer&lt;/code&gt; TextBox&#39;s &lt;code class=&quot;ce&quot;&gt;Text&lt;/code&gt; property. That&#39;s all there is to the UI Building Block. For simple UI Building Blocks, like this one, there is minimal code and HTML markup, but don&#39;t let the simplicity of this example belie the true power of UI Building Blocks. Because User Controls can have multiple Web controls that contain event handlers and so forth, you can build rich UI Building Blocks. One of the UI Building Blocks included in this article&#39;s code download illustrates how to have two dependent DropDownLists in a UI Building Block.&lt;/p&gt;
&lt;blockquote class=&quot;dtBlock&quot;&gt;
&lt;div&gt;
&lt;strong&gt;Note   &lt;/strong&gt;When creating UI Building Blocks, be sure to put them all in the same directory. The specific directory doesn&#39;t matter, though. In the &lt;div class=&quot;tt&quot;&gt;
Web.config&lt;/div&gt;
file you&#39;ll find an &lt;div class=&quot;tt&quot;&gt;
&lt;appsettings&gt;&lt;/div&gt;
element with the key name &lt;div class=&quot;tt&quot;&gt;
buildingBlockPath&lt;/div&gt;
. This setting needs to provide the reference to the User Control directory. In the code download, the default path is &lt;div class=&quot;tt&quot;&gt;
~/UserControls/&lt;/div&gt;
, but feel free to change this if you&#39;d like.&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;
For more information on the benefits of using interfaces with dynamically-loaded User Controls, be sure to read Tim Stall&#39;s article &lt;a href=&quot;http://aspnet.4guysfromrolla.com/articles/110304-1.aspx&quot;&gt;Understanding Interfaces and their Usefulness&lt;/a&gt;.&lt;/p&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Creating Questions and Associating Them With Customer Types&lt;/h3&gt;
&lt;p&gt;
To make creating dynamic data entry user interfaces a task non-developers can easily perform, I have created a Web-based administration interface for creating questions and associating them with customer types. This interface is available in the code download for this article.&lt;/p&gt;
&lt;p&gt;
There are two germane pages in the administrative interface. The first, &lt;code class=&quot;ce&quot;&gt;CreateQuestion.aspx&lt;/code&gt;, allows an administrator to create a new question. Recall that a question is a specific question text and UI Building Block. The Web page is fairly simple, providing a means for the user to enter the question text and select a User Control from the UI Building Blocks directory (whose path is specified in the &lt;code class=&quot;ce&quot;&gt;Web.config&lt;/code&gt; file). Figure 6 shows a screenshot of this page.&lt;/p&gt;
&lt;p class=&quot;fig&quot;&gt;
&lt;img id=&quot;dynui_fig06&quot; title=&quot;Aa479330.dynui_fig06(en-us,MSDN.10).gif&quot; alt=&quot;Aa479330.dynui_fig06(en-us,MSDN.10).gif&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC22610.gif&quot; xmlns=&quot;&quot;&gt;&lt;/p&gt;
&lt;p class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 6. Web-based interface for non-developers&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
The next screen in the administrative interface allows for the administrator to specify what questions, and in what order, are tied to each customer type. The interface, shown in Figure 7, is pretty self-explanatory. The administrator selects a customer type from the top-most DropDownList and can then add questions from the second DropDownListBox. The DataGrid lists the current questions for the selected customer type, allowing the user to remove questions from the list or reorder them through the up and down arrows.&lt;/p&gt;
&lt;p&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/Aa479330.dynui_fig07l(l=en-us).gif&quot;&gt;&lt;img id=&quot;dynui_fig07S&quot; title=&quot;Aa479330.dynui_fig07S(en-us,MSDN.10).gif&quot; alt=&quot;Aa479330.dynui_fig07S(en-us,MSDN.10).gif&quot; src=&quot;http://i.msdn.microsoft.com/dynimg/IC149751.gif&quot; xmlns=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class=&quot;label&quot;&gt;
&lt;strong&gt;Figure 7. Web UI for choosing the order of questions&lt;/strong&gt;&lt;/p&gt;
&lt;h3 class=&quot;dtH1&quot;&gt;
Displaying Dynamic Questions and Saving the Results&lt;/h3&gt;
&lt;p&gt;
Once the questions have been created by the system administrator and mapped to a particular customer type, data for a customer can be entered. The page &lt;code class=&quot;ce&quot;&gt;EnterData.aspx&lt;/code&gt; takes in the customer&#39;s ID through the querystring and builds up the dynamic data entry user interface for the customer&#39;s customer type. This page has three methods of interest:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;BuildDynamicUI():&lt;/strong&gt; this method is called from the &lt;code class=&quot;ce&quot;&gt;Page_Init&lt;/code&gt; event handler (which executes during the Initialization stage in the page&#39;s lifecycle), and builds up the dynamic controls for the appropriate customer type. As discussed earlier, &lt;code class=&quot;ce&quot;&gt;BuildDynamicUI()&lt;/code&gt; simply adds the necessary controls to the control hierarchy.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Page_Load:&lt;/strong&gt; the &lt;code class=&quot;ce&quot;&gt;Page_Load&lt;/code&gt; event handler assigns the initial, default values to the dynamically-added Web controls. For example, if a user has already supplied some of the values for a particular customer, when the page is visited these values are populated into the appropriate dynamic controls. These properties are only set on the first page visit and not on subsequent postbacks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;btnSaveValues_Click:&lt;/strong&gt; this method is wired up to the &lt;strong&gt;Save&lt;/strong&gt; button&#39;s Click event. It enumerates the dynamically-added controls and updates the database.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Let&#39;s take a brief look at these three methods. The &lt;code class=&quot;ce&quot;&gt;BuildDynamicUI()&lt;/code&gt; method is called from the &lt;code class=&quot;ce&quot;&gt;Page_Init&lt;/code&gt; event handler. This event handler is automatically added by Visual Studio .NET in the &quot;Web Form Designer Generated Code&quot; region.)The method grabs the customer&#39;s ID from the querystring and then populates a &lt;code class=&quot;ce&quot;&gt;SqlDataReader&lt;/code&gt; with the dynamic questions for the specified customer type. This &lt;code class=&quot;ce&quot;&gt;SqlDataReader&lt;/code&gt; is then iterated through. For each record, the specified User Control is loaded and added to the &lt;code class=&quot;ce&quot;&gt;dynamicControls&lt;/code&gt; PlaceHolder. Each dynamic control is given an ID of the form &lt;code class=&quot;ce&quot;&gt;dqDynamicQuestionID&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot; href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_b45ada6c-5121-4e56-bb07-0e842e8e19fe&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_b45ada6c-5121-4e56-bb07-0e842e8e19fe&quot; class=&quot;codeSnippetContainerCode&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;Private Sub BuildDynamicUI()    &#39;Called from Page_Init
    CustomerID = Convert.ToInt32(Request.QueryString(&quot;ID&quot;))

    ...

    &#39;Get the list of dynamic controls for the specified customer
    reader = SqlHelper.ExecuteReader(connectionString, _
                 CommandType.StoredProcedure, _
                 &quot;dq_GetDynamicQuestionsForCustomerType&quot;, _
                 New SqlParameter(&quot;@CustomerTypeID&quot;, CustomerTypeID))

    &#39;For each question, add the necessary user control
    While reader.Read
        Dim dq As UserControl = _
             LoadControl(ResolveUrl(buildingBlockPath &amp;amp; _
                                     reader(&quot;ControlSrc&quot;)))
        CType(dq, IUIBuildingBlock).QuestionText = reader(&quot;QuestionText&quot;)
        dq.ID = String.Concat(&quot;dq&quot;, reader(&quot;DynamicQuestionID&quot;))

        dynamicControls.Controls.Add(dq)
        dynamicControls.Controls.Add(New LiteralControl(&quot;&lt;br /&gt;&lt;br /&gt;&quot;))
    End While

    reader.Close()
End Sub

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote class=&quot;dtBlock&quot;&gt;
&lt;div&gt;
&lt;strong&gt;Note   &lt;/strong&gt;In the sample code that is included with this article, I use the Microsoft Data Access Application Block (DAAB) version 2.0 to access the database. The DAAB&#39;s &lt;div class=&quot;tt&quot;&gt;
SqlHelper&lt;/div&gt;
class provides a wrapper for accessing data from a Microsoft SQL Server database with one line of code. For more information on the DAAB, be sure to visit the official &lt;a href=&quot;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/daab-rm.asp&quot;&gt;Data Access Application Block for .NET&lt;/a&gt; page, and read John Jakovich&#39;s article &lt;a href=&quot;http://aspnet.4guysfromrolla.com/articles/070203-1.aspx&quot;&gt;Examining the Data Access Application Block&lt;/a&gt;.&lt;/div&gt;
&lt;/blockquote&gt;
&lt;blockquote class=&quot;dtBlock&quot;&gt;
&lt;div&gt;
Also, as the code shows, to dynamically load a User Control you need to use the&lt;div class=&quot;tt&quot;&gt;
 &lt;code class=&quot;ce&quot;&gt;LoadControl(UserControlPath)&lt;/code&gt;&lt;/div&gt;
method rather than creating a new instance of the User Control class. For a more thorough discussion on why, including a in-depth look at User Controls, be sure to read &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms972975.aspx&quot;&gt;An Extensive Examination of User Controls&lt;/a&gt;.&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;
Next, in the &lt;code class=&quot;ce&quot;&gt;Page_Load&lt;/code&gt; event handler, the customer&#39;s current answers to the dynamic controls are retrieved from the database and iterated. The corresponding dynamic control is referenced and its &lt;code class=&quot;ce&quot;&gt;Answer&lt;/code&gt; property is set to the answer from the database. This is only done on the first page visit, and not on subsequent postbacks, because we don&#39;t want to overwrite the value the user entered for one of these form fields.&lt;/p&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot; href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_d1f9b2c2-0e14-40ec-bcad-c8dbf08250f9&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_d1f9b2c2-0e14-40ec-bcad-c8dbf08250f9&quot; class=&quot;codeSnippetContainerCode&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&#39;Get the answers for this customer
&#39;Get the list of dynamic controls for the specified customer
Dim reader As SqlDataReader = _
       SqlHelper.ExecuteReader(connectionString, _
               CommandType.StoredProcedure, _
               &quot;dq_GetDynamicAnswersForCustomer&quot;, _
               New SqlParameter(&quot;@CustomerID&quot;, CustomerID))

While reader.Read
    Dim dq As IUIBuildingBlock = dynamicControls.FindControl(String.Concat(&quot;dq&quot;, reader(&quot;DynamicQuestionID&quot;)))
    If Not dq Is Nothing Then
        Select Case dq.DataType
            Case DQDataTypes.String
                dq.Answer = reader(&quot;StringAnswer&quot;).ToString()
            Case DQDataTypes.Integer
                dq.Answer = Convert.ToInt32(reader(&quot;IntegerAnswer&quot;))
            Case DQDataTypes.Double
                dq.Answer = Convert.ToSingle(reader(&quot;DoubleAnswer&quot;))
            Case DQDataTypes.Date
                dq.Answer = Convert.ToDateTime(reader(&quot;DateAnswer&quot;))
            Case DQDataTypes.Currency
                dq.Answer = Convert.ToDecimal(reader(&quot;CurrencyAnswer&quot;))
            Case DQDataTypes.Boolean
                dq.Answer = Convert.ToBoolean(reader(&quot;BooleanAnswer&quot;))
        End Select
    End If
End While

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Finally, when the user clicks the &lt;strong&gt;Save&lt;/strong&gt; button, the &lt;code class=&quot;ce&quot;&gt;dynamicControls&lt;/code&gt; PlaceHolder&#39;s &lt;code class=&quot;ce&quot;&gt;Controls&lt;/code&gt; collection is enumerated, and for each dynamically-added control that has been answered, the answer is written back to the database.&lt;/p&gt;
&lt;div class=&quot;codeSnippetContainer&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;div class=&quot;codeSnippetContainerTabs&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;codeSnippetContainerCodeContainer&quot;&gt;
&lt;div class=&quot;codeSnippetToolBar&quot;&gt;
&lt;div class=&quot;codeSnippetToolBarText&quot;&gt;
&lt;a style=&quot;display: block;&quot; title=&quot;Copy to clipboard.&quot; href=&quot;javascript:CodeSnippet_CopyCode(&#39;CodeSnippetContainerCode_54d38274-ecaa-4bd4-b5bd-2398071f3cc0&#39;);&quot; name=&quot;CodeSnippetCopyLink&quot;&gt;Copy&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; id=&quot;CodeSnippetContainerCode_54d38274-ecaa-4bd4-b5bd-2398071f3cc0&quot; class=&quot;codeSnippetContainerCode&quot;&gt;
&lt;div style=&quot;color: black;&quot;&gt;
&lt;pre&gt;&#39;Create the needed parameters
Dim stringParam As New SqlParameter(&quot;@StringAnswer&quot;, SqlDbType.NText)
Dim integerParam As New SqlParameter(&quot;@IntegerAnswer&quot;, SqlDbType.Int)
Dim doubleParam As New SqlParameter(&quot;@DoubleAnswer&quot;, SqlDbType.Decimal)
Dim dateParam As New SqlParameter(&quot;@DateAnswer&quot;, SqlDbType.DateTime)
Dim currencyParam As New SqlParameter(&quot;@CurrencyAnswer&quot;, SqlDbType.Money)
Dim booleanParam As New SqlParameter(&quot;@BooleanAnswer&quot;, SqlDbType.Bit)

&#39;Enumerate each answer and save it back to the database
For Each c As Control In dynamicControls.Controls
    If TypeOf c Is IUIBuildingBlock Then
        &#39;Mark all of the parameters as NULL
        stringParam.Value = DBNull.Value : integerParam.Value = DBNull.Value
        doubleParam.Value = DBNull.Value : dateParam.Value = DBNull.Value
        currencyParam.Value = DBNull.Value : booleanParam.Value = DBNull.Value

        &#39;Determine which parameter needs to be set
        Dim uib as IUIBuildingBlock = CType(c, IUIBuildingBlock)
        Select Case uib.DataType
            Case DQDataTypes.String
                stringParam.Value = uib.Answer
            Case DQDataTypes.Integer
                integerParam.Value = uib.Answer
            Case DQDataTypes.Double
                doubleParam.Value = uib.Answer
            Case DQDataTypes.Date
                dateParam.Value = uib.Answer
            Case DQDataTypes.Currency
                currencyParam.Value = uib.Answer
            Case DQDataTypes.Boolean
                booleanParam.Value = uib.Answer
        End Select

        Dim dynamicQuestionID As Integer = Convert.ToInt32(c.ID.Substring(2))
        SqlHelper.ExecuteReader(connectionString, _
               CommandType.StoredProcedure, &quot;dq_AddDynamicAnswer&quot;, _
               New SqlParameter(&quot;@CustomerID&quot;, CustomerID), _
               New SqlParameter(&quot;@DynamicQuestionID&quot;, dynamicQuestionID), _
               stringParam, integerParam, doubleParam, _
               dateParam, currencyParam, booleanParam)
    End If
Next

&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4 class=&quot;dtH1&quot;&gt;
Closing Comments&lt;/h4&gt;
&lt;p&gt;
The dynamic data entry user interface engine is a good starting point for developing such a system for your Web application, but was not designed to afford seamless integration into existing systems. It was designed as a demonstration, not as a complete, working system. One part of the system that is not fully complete is the administrative interface that, while functional, is far from being a complete system. In particular, there is the question of how to handle removing a dynamic question from a particular customer type. For example, imagine that an administrator has configured the system so that online-only customers are asked a Boolean question, &quot;Was this the first product you&#39;ve purchased from our company?&quot;&lt;/p&gt;
&lt;p&gt;
Now, imagine that a number of customers had answered this question. What should happen, then, if the administrator decides to remove this question from the set of questions for online-only users? Should the corresponding answers be deleted from the &lt;code class=&quot;ce&quot;&gt;dq_DynamicAnswers&lt;/code&gt; table? Should they be saved in order to provide a historical view of past answers? You&#39;ll have to decide the answer to this question for your application. Right now, the administrative interface doesn&#39;t do anything when you remove a dynamic question for a custom type, which means if you have one or more customers who have answered that question, you&#39;ll get an exception and the question won&#39;t be removed because doing so would violate the referential integrity established in the database.&lt;/p&gt;
&lt;/body&gt;
&lt;/script&gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/8921503620647618061/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2012/06/creating-dynamic-data-entry-user.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/8921503620647618061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/8921503620647618061'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2012/06/creating-dynamic-data-entry-user.html' title='Creating Dynamic Data Entry User Interfaces'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-62615523823450575.post-3894497589522760648</id><published>2012-06-25T17:54:00.001+03:00</published><updated>2012-06-25T17:54:10.038+03:00</updated><title type='text'>Accessing and Updating Data in ASP.NET: Filtering Database Data with Parameters</title><content type='html'>Introduction&lt;br /&gt;
In &lt;a href=&quot;http://aspnet.4guysfromrolla.com/articles/022206-1.aspx&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;440&quot;&gt;Part 2&lt;/a&gt; of this article series we looked at how to access 
relational database data using the AccessDataSource and SqlDataSource controls. 
However, in Part 2 we only looked at how to retrieve &lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;439&quot;&gt;all&lt;/i&gt; of the records from a table, view, stored procedure, or 
ad-hoc SQL query. Often, we only want to retrieve a subset of data based on 
various criteria. When searching for a book on Amazon.com, for example, the 
search page retrieves only the data from the database that matches the search 
terms you entered; when viewing the details for a particular book, only the 
particular book&#39;s information is queried from the database. 
&lt;br /&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;438&quot;&gt;
Results are filtered in a SQL statement 
using the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;500&quot;&gt;WHERE&lt;/code&gt; clause, which 
contains a boolean expression. For each record in the table being queried, the 
&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;499&quot;&gt;WHERE&lt;/code&gt; expression is evaluated to 
determine whether or not to include that record in the resultset.&lt;sup itxtharvested=&quot;0&quot; itxtnodeid=&quot;498&quot;&gt;1&lt;/sup&gt; For example, a SQL query like: &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;497&quot;&gt;SELECT ProductID, ProductName FROM Products 
WHERE UnitPrice &amp;lt; 15.00&lt;/code&gt; will return the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;496&quot;&gt;ProductID&lt;/code&gt; and &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;495&quot;&gt;ProductName&lt;/code&gt; column values for all records in the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;494&quot;&gt;Products&lt;/code&gt; table for which the statement 
&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;493&quot;&gt;UnitPrice &amp;lt; 15.00&lt;/code&gt; evaluates 
to True. In English, it returns all products that cost strictly less than 
fifteen bucks. 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;437&quot;&gt;
The SqlDataSource and AccessDataSource 
controls can define the value by which the query is filtered by using &lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;502&quot;&gt;parameters&lt;/i&gt;, and these parameters can retrieve 
their values from a variety of sources, including: the querystring, session 
variables, other Web controls on the page, and so on. Like the connection string 
and &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;501&quot;&gt;SELECT&lt;/code&gt; query, the filter 
parameters values for a data source control can be set declaratively, meaning 
you do not need to write a line of code. These parameter values can also be set 
programmatically, though, for cases where you might need to base the filter 
value on programmatic logic (such as the currently logged-in user&#39;s username). 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;436&quot;&gt;
In this article we will examine how to 
declaratively filter the results of a SQL query using parameters in a 
SqlDataSource. We&#39;ll see examples of how to use hard-coded filter values, and 
well as examples with filter values taken from the querystring and other Web 
controls on the page. Read on to learn more! 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;
&lt;em itxtbad=&quot;1&quot; itxtnodeid=&quot;503&quot;&gt;&lt;sup&gt;1&lt;/sup&gt; - this is a gross oversimplification of how the 
database engine determines what rows, exactly, to return, but is an accurate 
description from a high-level perspective...&lt;/em&gt; &lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2 class=&quot;section&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;429&quot;&gt;
Filtering Basics&lt;/h2&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;
&lt;br itxtnodeid=&quot;428&quot; /&gt;When filtering results there are two components of interest: 
the columns being filtered on, and the value being filtered by. In the example 
in the Introduction, the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;427&quot;&gt;UnitPrice&lt;/code&gt; column is being filtered on, and &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;426&quot;&gt;15.00&lt;/code&gt; is the value being filtered by. 
Typically the value to filter by is not a hard-coded value, but depends on some 
sort of user input. To allow for a variable filter by value, SQL statements 
typically use &lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;425&quot;&gt;parameters&lt;/i&gt; that indicate 
placeholders where a value can later be inserted. Parameters typically have the 
format &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;424&quot;&gt;@&lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;523&quot;&gt;ParameterName&lt;/i&gt;&lt;/code&gt; or &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;423&quot;&gt;?&lt;/code&gt;, depending on the underlying database being used. For 
example, when using parameterized queries with Microsoft Access databases, use 
&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;422&quot;&gt;?&lt;/code&gt;; when using parameterized 
queries for Microsoft SQL Server, use &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;421&quot;&gt;@&lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;524&quot;&gt;ParameterName&lt;/i&gt;&lt;/code&gt;. 
Rewriting the earlier SQL query to use parameters would result in: 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;420&quot;&gt;

&lt;/div&gt;
&lt;table border=&quot;0&quot; itxtharvested=&quot;0&quot; itxtnodeid=&quot;525&quot;&gt;
&lt;tbody itxtharvested=&quot;0&quot; itxtnodeid=&quot;526&quot;&gt;
&lt;tr itxtharvested=&quot;0&quot; itxtnodeid=&quot;527&quot;&gt;
&lt;td bgcolor=&quot;#cccccc&quot; itxtharvested=&quot;0&quot; itxtnodeid=&quot;528&quot; width=&quot;100%&quot;&gt;&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;529&quot;&gt;-- For Microsoft SQL Server...&lt;br itxtnodeid=&quot;539&quot; /&gt;SELECT ProductID, ProductName&lt;br itxtnodeid=&quot;538&quot; /&gt;FROM 
Products&lt;br itxtnodeid=&quot;537&quot; /&gt;WHERE UnitPrice &amp;lt; &lt;b itxtbad=&quot;1&quot; itxtnodeid=&quot;536&quot;&gt;@PriceFilter&lt;/b&gt; &lt;br itxtnodeid=&quot;535&quot; /&gt;&lt;br itxtnodeid=&quot;534&quot; /&gt;-- 
For Microsoft Access...&lt;br itxtnodeid=&quot;533&quot; /&gt;SELECT ProductID, ProductName&lt;br itxtnodeid=&quot;532&quot; /&gt;FROM Products&lt;br itxtnodeid=&quot;531&quot; /&gt;WHERE UnitPrice &amp;lt; &lt;b itxtbad=&quot;1&quot; itxtnodeid=&quot;530&quot;&gt;?&lt;/b&gt;&lt;/code&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;

&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;419&quot;&gt;
(The &lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;541&quot;&gt;ParameterName&lt;/i&gt; can be any value; here I chose to use &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;540&quot;&gt;PriceFilter&lt;/code&gt;.) 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;418&quot;&gt;
With the parameter defined, its value can 
be set programmatically prior to executing the statement. If you&#39;re familiar 
with ADO.NET code, you know that when writing code to issue a query to a 
database you create a command object (such as &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;548&quot;&gt;SqlCommand&lt;/code&gt;) that specifies the SQL query or &lt;a href=&quot;http://www.4guysfromrolla.com/webtech/111499-1.shtml&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;547&quot;&gt;stored procedure&lt;/a&gt; to execute (via the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;546&quot;&gt;CommandText&lt;/code&gt; property) as well as the connection object 
to use (via the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;545&quot;&gt;Connection&lt;/code&gt; 
property). The command object also has a &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;544&quot;&gt;Parameters&lt;/code&gt; collection that allows you to 
programmatically specify the values for the parameters defined in the query (or 
used in the stored procedure). For more information on using parameterized 
queries with SQL Server see &lt;a href=&quot;http://aspnet101.com/aspnet101/tutorials.aspx?id=1&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;543&quot;&gt;this article&lt;/a&gt;; for examples for parameterized queries with 
Microsoft Access, refer to &lt;a href=&quot;http://www.4guysfromrolla.com/webtech/092601-1.shtml&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;542&quot;&gt;this one&lt;/a&gt;. 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;417&quot;&gt;
With the data source controls you don&#39;t 
need to programmatically set the parameter (unless you want/need to), as the 
parameter value can be set declaratively, as we&#39;ll see shortly. When you set the 
parameter value declaratively, however, do understand that the data source 
control, behind the curtains, is programmatically adding the declaratively 
specified value to its underlying command object&#39;s &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;549&quot;&gt;Parameters&lt;/code&gt; collection. In short, the data source 
control is executing the same ADO.NET code you likely would if you were 
accessing the data programmatically. 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;416&quot;&gt;
Let&#39;s now turn our attention to filtering 
data with the SqlDataSource. In the following demos (which are downloadable at 
the end of this article), we&#39;ll be using a slimmed-down version of the Northwind 
Access database (as discussed in &lt;a href=&quot;http://aspnet.4guysfromrolla.com/articles/022206-1.aspx&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;550&quot;&gt;Part 2&lt;/a&gt;). We&#39;ll see how to specify the filter parameters 
both through the SqlDataSource&#39;s wizard and directly through its properties. 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;415&quot;&gt;

&lt;/div&gt;
&lt;h2 class=&quot;section&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;414&quot;&gt;
Getting Started with Filtering 
with the SqlDataSource&lt;/h2&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;
&lt;br itxtnodeid=&quot;413&quot; /&gt;To start, create an ASP.NET page 
and go to the Design view. Next, drag on a SqlDataSource control from the 
Toolbox. As we saw in Part 2, you can configure the database to connect to and 
the SQL &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;412&quot;&gt;SELECT&lt;/code&gt; query to execute 
by clicking on the &quot;Configure Data Source&quot; link in the SqlDataSource control&#39;s 
smart tag. Recall that there are two screens for specifying the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;411&quot;&gt;SELECT&lt;/code&gt; query: 
&lt;/div&gt;
&lt;ul itxtharvested=&quot;0&quot; itxtnodeid=&quot;410&quot;&gt;
&lt;li itxtharvested=&quot;0&quot; itxtnodeid=&quot;552&quot;&gt;&lt;b itxtbad=&quot;1&quot; itxtnodeid=&quot;553&quot;&gt;Specify 
columns from a table or view&lt;/b&gt; - here you chose the table or view from a 
drop-down list and check those columns you want to return, or 
&lt;/li&gt;
&lt;li itxtharvested=&quot;0&quot; itxtnodeid=&quot;551&quot;&gt;&lt;b itxtbad=&quot;1&quot; itxtnodeid=&quot;554&quot;&gt;Specify a 
custom SQL statement or stored procedure&lt;/b&gt; - with this option you can either 
pick a stored procedure from a drop-down list of manually type in your SQL query 
(or use the Query Builder) &lt;/li&gt;
&lt;/ul&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;
If you use the &quot;Specify columns from a 
table or view&quot; option, after selecting the table or view to query and choosing 
the columns to return, click the WHERE button to add a filter parameter. This 
brings up the Add &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;409&quot;&gt;WHERE&lt;/code&gt; Clause 
dialog box (shown below), where you can specify the column to filter on, the 
operator to use (&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;408&quot;&gt;=&lt;/code&gt;, &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;407&quot;&gt;&amp;lt;&lt;/code&gt;, &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;406&quot;&gt;&amp;lt;=&lt;/code&gt;, &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;405&quot;&gt;&amp;gt;&lt;/code&gt;, and so on), and the source of the filter value (a 
hard-coded value, from the querystring, from another Web control on the page, 
and so on). We&#39;ll see how to specify different types of parameter values in a 
bit. 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;404&quot;&gt;

&lt;/div&gt;
&lt;center itxtharvested=&quot;0&quot; itxtnodeid=&quot;403&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;415&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;555&quot; src=&quot;http://aspnet.4guysfromrolla.com/images/DS/fds1.png&quot; width=&quot;552&quot; /&gt; &lt;/center&gt;&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;

&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;402&quot;&gt;

&lt;/div&gt;
&lt;table align=&quot;center&quot; class=&quot;noteBox&quot; itxtharvested=&quot;0&quot; itxtnodeid=&quot;556&quot;&gt;
&lt;tbody itxtharvested=&quot;0&quot; itxtnodeid=&quot;557&quot;&gt;
&lt;tr itxtharvested=&quot;0&quot; itxtnodeid=&quot;559&quot;&gt;
&lt;th itxtharvested=&quot;0&quot; itxtnodeid=&quot;560&quot;&gt;Limitations with the Add &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;561&quot;&gt;WHERE&lt;/code&gt; Clause Dialog Box&lt;/th&gt;&lt;/tr&gt;
&lt;tr itxtharvested=&quot;0&quot; itxtnodeid=&quot;558&quot;&gt;
&lt;td itxtharvested=&quot;0&quot; itxtnodeid=&quot;562&quot;&gt;Filtering using the &quot;Specify columns from 
a table or view&quot; option has one potentially show-stopping drawback - while you 
can add multiple filter parameters, these parameters are joined using the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;567&quot;&gt;AND&lt;/code&gt; operator. So if you need to filter 
values based on multiple clauses and need them joined together with &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;566&quot;&gt;OR&lt;/code&gt;s as well (such as &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;565&quot;&gt;SELECT * FROM Products WHERE UnitPrice &amp;lt; 
15.00 OR UnitPrice &amp;gt; 25.00&lt;/code&gt;), you need to manually add the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;564&quot;&gt;SELECT&lt;/code&gt; query and &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;563&quot;&gt;WHERE&lt;/code&gt; clause through the &quot;Specify a 
custom SQL statement or stored procedure&quot; option. &lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;

&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;401&quot;&gt;
If you use the &quot;Specify a custom SQL 
statement or stored procedure&quot; option you can either type in a SQL query by hand 
or pick a stored procedure from a drop-down list. To add filter parameters in 
the ad-hoc SQL query, simply add the parameters using the appropriate syntax. 
Since the Northwind database used in my demos is a Microsoft Access database I 
would use the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;571&quot;&gt;?&lt;/code&gt; character to 
indentify the parameters. For example, if I wanted to use an ad-hoc SQL 
statement I&#39;d type into the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;570&quot;&gt;SELECT&lt;/code&gt; textbox: &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;569&quot;&gt;SELECT ProductID, ProductName FROM Products WHERE UnitPrice 
&amp;lt; &lt;b itxtbad=&quot;1&quot; itxtnodeid=&quot;572&quot;&gt;?&lt;/b&gt;&lt;/code&gt;. If, however, you are using a 
SQL Server database, use the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;568&quot;&gt;@&lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;573&quot;&gt;ParameterName&lt;/i&gt;&lt;/code&gt; syntax instead. After 
specifying your parameters using the correct syntax, hit Next and you will see a 
screen that prompts you for the parameter values. 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;400&quot;&gt;

&lt;/div&gt;
&lt;center itxtharvested=&quot;0&quot; itxtnodeid=&quot;399&quot;&gt;
&lt;h2 class=&quot;section&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;580&quot;&gt;
Step 1: Specify the Parameterized 
Ad-Hoc SQL Statement&lt;/h2&gt;
&lt;br itxtnodeid=&quot;579&quot; /&gt;&lt;img border=&quot;1&quot; height=&quot;227&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;578&quot; src=&quot;http://aspnet.4guysfromrolla.com/images/DS/fds2.png&quot; width=&quot;478&quot; /&gt; 
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;577&quot;&gt;

&lt;/div&gt;
&lt;h2 class=&quot;section&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;576&quot;&gt;
Step 2: Click Next and Specify 
the Values for the Parameter(s)&lt;/h2&gt;
&lt;br itxtnodeid=&quot;575&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;450&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;574&quot; src=&quot;http://aspnet.4guysfromrolla.com/images/DS/fds3.png&quot; width=&quot;580&quot; /&gt; &lt;/center&gt;&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;

&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;398&quot;&gt;
If you are using a database that supports 
parameterized stored procedures (such as Microsoft SQL Server), you can select 
the stored procedure to use from the drop-down list and click next. In the next 
screen (the one shown above) you will see the parameters for the stored 
procedure and be able to define how their values are obtained. 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;397&quot;&gt;
Regardless of what approach you use, once 
you specify the parameter values and complete the SqlDataSource wizard, the 
SqlDataSource will have updated its properties. Specifically, the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;583&quot;&gt;SelectCommand&lt;/code&gt; will now be a 
parameterized query, and there will be a series of &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;582&quot;&gt;SelectParameter&lt;/code&gt; instances. Since the types of &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;581&quot;&gt;SelectParameter&lt;/code&gt; instances vary 
depending on how the parameter value is obtained, we&#39;ll examine the resulting 
SqlDataSource markup in detail in each example. 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;396&quot;&gt;
If you are wizard-averse, you can always 
specify the parameterized query and &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;585&quot;&gt;SelectParameters&lt;/code&gt; by hand (through entering the markup 
directly), or by clicking on the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;584&quot;&gt;SelectQuery&lt;/code&gt; property in the SqlDataSource&#39;s Properties 
pane in the Design view. Doing so will display the Command and Parameter Editor 
(see screen shot below). 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;395&quot;&gt;

&lt;/div&gt;
&lt;center itxtharvested=&quot;0&quot; itxtnodeid=&quot;394&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;440&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;586&quot; src=&quot;http://aspnet.4guysfromrolla.com/images/DS/fds5.png&quot; width=&quot;552&quot; /&gt; &lt;/center&gt;&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;

&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;393&quot;&gt;

&lt;/div&gt;
&lt;table align=&quot;center&quot; class=&quot;noteBox&quot; itxtharvested=&quot;0&quot; itxtnodeid=&quot;587&quot;&gt;
&lt;tbody itxtharvested=&quot;0&quot; itxtnodeid=&quot;588&quot;&gt;
&lt;tr itxtharvested=&quot;0&quot; itxtnodeid=&quot;590&quot;&gt;
&lt;th itxtharvested=&quot;0&quot; itxtnodeid=&quot;591&quot;&gt;Why Aren&#39;t We Using &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;593&quot;&gt;FilterExpression&lt;/code&gt; and &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;592&quot;&gt;FilterParameters&lt;/code&gt;?&lt;/th&gt;&lt;/tr&gt;
&lt;tr itxtharvested=&quot;0&quot; itxtnodeid=&quot;589&quot;&gt;
&lt;td itxtharvested=&quot;0&quot; itxtnodeid=&quot;594&quot;&gt;If you explore the SqlDataSource&#39;s 
properties you&#39;ll notice the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;605&quot;&gt;FilterExpression&lt;/code&gt; and &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;604&quot;&gt;FilterParameters&lt;/code&gt; properties. You may be wondering why 
we aren&#39;t using these two properties and how the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;603&quot;&gt;FilterParameters&lt;/code&gt; collection differs from the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;602&quot;&gt;SelectParameters&lt;/code&gt; collection. The &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;601&quot;&gt;FilterExpression&lt;/code&gt; and &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;600&quot;&gt;FilterParameters&lt;/code&gt; are properties 
designed for filtering the results &lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;599&quot;&gt;returned&lt;/i&gt; 
by the database. That is, with these two properties, after the records have been 
returned from the backend database, these results are further filtered by the 
&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;598&quot;&gt;FilterExpression&lt;/code&gt; and &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;597&quot;&gt;FilterParameters&lt;/code&gt; before being handed 
over to the data Web control or programmer whose code is requesting the data 
source&#39;s data. Using a parameterized query and &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;596&quot;&gt;SelectParameters&lt;/code&gt;, on the other hand, performs the 
filtering on the database side. 
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;595&quot;&gt;
As you probably can guess, filtering on 
the database side is much more efficient than bringing back &lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;614&quot;&gt;all&lt;/i&gt; data to the data source control and then having it 
filter the results. However, there are times when would want to use the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;613&quot;&gt;FilterExpression&lt;/code&gt; and &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;612&quot;&gt;FilterParameters&lt;/code&gt; properties - in fact, 
both techniques can be used in tandem. For our examples now, stick with the 
parameterized queries and &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;611&quot;&gt;SelectParameters&lt;/code&gt; and just remember that the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;610&quot;&gt;SelectParameters&lt;/code&gt; specify the parameter 
values that are sent in the database&#39;s &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;609&quot;&gt;SELECT&lt;/code&gt; query whereas the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;608&quot;&gt;FilterParameters&lt;/code&gt; are those parameters used to filter 
the data &lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;607&quot;&gt;returned&lt;/i&gt; from the database (and 
would only be set if there was a &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;606&quot;&gt;FilterExpression&lt;/code&gt; value defined). 
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;

&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;392&quot;&gt;

&lt;/div&gt;
&lt;h2 class=&quot;section&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;391&quot;&gt;
Filtering Based on a Hard-Coded 
Value&lt;/h2&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;
&lt;br itxtnodeid=&quot;390&quot; /&gt;In both the &quot;Specify columns from a table or 
view&quot; and &quot;Specify a custom SQL statement or stored procedure&quot; options, when 
specifying the parameter value you are asked to choose the &quot;Parameter source&quot; 
with a drop-down list containing the following choices: 
&lt;/div&gt;
&lt;ul itxtharvested=&quot;0&quot; itxtnodeid=&quot;389&quot;&gt;
&lt;li itxtharvested=&quot;0&quot; itxtnodeid=&quot;621&quot;&gt;None 
&lt;/li&gt;
&lt;li itxtharvested=&quot;0&quot; itxtnodeid=&quot;620&quot;&gt;Cookie 
&lt;/li&gt;
&lt;li itxtharvested=&quot;0&quot; itxtnodeid=&quot;619&quot;&gt;Control 
&lt;/li&gt;
&lt;li itxtharvested=&quot;0&quot; itxtnodeid=&quot;618&quot;&gt;Form 
&lt;/li&gt;
&lt;li itxtharvested=&quot;0&quot; itxtnodeid=&quot;617&quot;&gt;Profile 
&lt;/li&gt;
&lt;li itxtharvested=&quot;0&quot; itxtnodeid=&quot;616&quot;&gt;QueryString 
&lt;/li&gt;
&lt;li itxtharvested=&quot;0&quot; itxtnodeid=&quot;615&quot;&gt;Session &lt;/li&gt;
&lt;/ul&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;
To specify a hard-coded 
value, select the None option and then, in the value textbox, enter the 
hard-coded value. Once you have specified the parameter value and complete the 
wizard, the SqlDataSource control&#39;s declarative markup will look like: 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;388&quot;&gt;

&lt;/div&gt;
&lt;table border=&quot;0&quot; itxtharvested=&quot;0&quot; itxtnodeid=&quot;622&quot;&gt;
&lt;tbody itxtharvested=&quot;0&quot; itxtnodeid=&quot;623&quot;&gt;
&lt;tr itxtharvested=&quot;0&quot; itxtnodeid=&quot;624&quot;&gt;
&lt;td bgcolor=&quot;#cccccc&quot; itxtharvested=&quot;0&quot; itxtnodeid=&quot;625&quot; width=&quot;100%&quot;&gt;&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;626&quot;&gt;&lt;pre itxtbad=&quot;1&quot; itxtnodeid=&quot;627&quot;&gt;&lt;asp:sqldatasource 1?=&quot;&quot; id=&quot;&amp;lt;i itxtBad=&quot;&gt;ID&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;i itxtbad=&quot;1&quot;&gt;connectionString&lt;/i&gt;&quot;
    ProviderName=&quot;&lt;i itxtbad=&quot;1&quot;&gt;providerName&lt;/i&gt;&quot;

    SelectCommand=&quot;&lt;i itxtbad=&quot;1&quot;&gt;parameterizedQuery&lt;/i&gt;&quot;&amp;gt;
    &lt;selectparameters&gt;
        &lt;asp:parameter 1?=&quot;&quot; defaultvalue=&quot;&amp;lt;i itxtBad=&quot;&gt;hardCodedValue&quot; 
                       Name=&quot;&lt;i itxtbad=&quot;1&quot;&gt;parameterName&lt;/i&gt;&quot; 
                       Type=&quot;&lt;i itxtbad=&quot;1&quot;&gt;dataType&lt;/i&gt;&quot; /&amp;gt;
    &lt;/asp:parameter&gt;
&lt;/selectparameters&gt;&lt;/asp:sqldatasource&gt;
&lt;/pre&gt;
&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;

&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;387&quot;&gt;
Specifically, there&#39;s one &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;637&quot;&gt;&lt;asp:parameter&gt;&lt;/asp:parameter&gt;&lt;/code&gt; instance for &lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;636&quot;&gt;each&lt;/i&gt; hard-coded parameter value you specified 
in the wizard. The parameter&#39;s &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;635&quot;&gt;DefaultValue&lt;/code&gt; attribute holds the value you entered into 
the value textbox, while the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;634&quot;&gt;Name&lt;/code&gt; attribute refers to the parameter&#39;s name. (For 
Microsoft Access, which uses &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;633&quot;&gt;?&lt;/code&gt; 
for the parameters, the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;632&quot;&gt;Name&lt;/code&gt; 
attribute refers to the database column that the parameter applies to, although 
this value can be changed since the parameter name is really &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;631&quot;&gt;?&lt;/code&gt;. The only important thing to note 
here is that the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;630&quot;&gt;&lt;asp:parameter&gt;&lt;/asp:parameter&gt;&lt;/code&gt; instances are applied in order to 
the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;629&quot;&gt;?&lt;/code&gt; parameters.) Finally, the 
&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;628&quot;&gt;Type&lt;/code&gt; parameter specifies the 
data type of the parameter value. 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;386&quot;&gt;
In the download available at the end of 
this article you&#39;ll find a demo called &quot;Filter on Hard-Coded Value Demo.&quot; In 
this demo, the SqlDataSource is configured to retrieve all products, filtering 
them such that only those with a &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;639&quot;&gt;UnitPrice &amp;lt; 15.00&lt;/code&gt; are returned. The resulting 
SqlDataSource markup, and a screen shot of the results when bound to a &lt;a href=&quot;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/GridViewEx.asp&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;638&quot;&gt;GridView&lt;/a&gt;, are shown below: 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;385&quot;&gt;

&lt;/div&gt;
&lt;table border=&quot;0&quot; itxtharvested=&quot;0&quot; itxtnodeid=&quot;640&quot;&gt;
&lt;tbody itxtharvested=&quot;0&quot; itxtnodeid=&quot;641&quot;&gt;
&lt;tr itxtharvested=&quot;0&quot; itxtnodeid=&quot;642&quot;&gt;
&lt;td bgcolor=&quot;#cccccc&quot; itxtharvested=&quot;0&quot; itxtnodeid=&quot;643&quot; width=&quot;100%&quot;&gt;&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;644&quot;&gt;&lt;asp:sqldatasource 659?=&quot;&quot; id=&quot;&amp;lt;i itxtNodeId=&quot; itxtbad=&quot;1&quot;&gt;ID&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;658&quot;&gt;connectionString&lt;/i&gt;&quot;&lt;br itxtnodeid=&quot;657&quot; /&gt;    ProviderName=&quot;&lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;656&quot;&gt;providerName&lt;/i&gt;&quot;&lt;br itxtnodeid=&quot;655&quot; /&gt;    SelectCommand=&quot;&lt;b itxtbad=&quot;1&quot; itxtnodeid=&quot;654&quot;&gt;SELECT 
[ProductID], [ProductName], [UnitPrice] FROM [Products] WHERE ([UnitPrice] = 
?)&lt;/b&gt;&quot;&amp;gt;&lt;br itxtnodeid=&quot;653&quot; /&gt;    &lt;selectparameters&gt;&lt;br itxtnodeid=&quot;652&quot; /&gt;        &lt;asp:parameter 651?=&quot;&quot; defaultvalue=&quot;&amp;lt;b itxtNodeId=&quot; itxtbad=&quot;1&quot;&gt;15.00&quot; &lt;br itxtnodeid=&quot;650&quot; /&gt;            Name=&quot;&lt;b itxtbad=&quot;1&quot; itxtnodeid=&quot;649&quot;&gt;UnitPrice&lt;/b&gt;&quot; &lt;br itxtnodeid=&quot;648&quot; /&gt;            Type=&quot;&lt;b itxtbad=&quot;1&quot; itxtnodeid=&quot;647&quot;&gt;Decimal&lt;/b&gt;&quot; 
/&amp;gt;&lt;br itxtnodeid=&quot;646&quot; /&gt;    &lt;/asp:parameter&gt;&lt;/selectparameters&gt;&lt;/asp:sqldatasource&gt; &lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;

&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;384&quot;&gt;

&lt;/div&gt;
&lt;center itxtharvested=&quot;0&quot; itxtnodeid=&quot;383&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;254&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;660&quot; src=&quot;http://aspnet.4guysfromrolla.com/images/DS/fds4.png&quot; width=&quot;314&quot; /&gt; &lt;/center&gt;&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;

&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;382&quot;&gt;

&lt;/div&gt;
&lt;h2 class=&quot;section&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;381&quot;&gt;
Filtering Based on a QueryString 
Value&lt;/h2&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;
&lt;br itxtnodeid=&quot;380&quot; /&gt;In the Northwind database each product belongs to 
a category. Therefore, we might want a page that lists all of the categories in 
the database with each category having a hyperlink to a page that displays the 
products in the selected category. One way to accomplish this is to create two 

pages: &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;379&quot;&gt;Categories.aspx&lt;/code&gt;, which 
lists all of the categories, and &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;378&quot;&gt;ProductsInCategory.aspx&lt;/code&gt;, which lists all products for a 
category. The challenge here is how to specify what category&#39;s products to 
display in the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;377&quot;&gt;ProductsInCategory.aspx&lt;/code&gt; page. While there are many 
techniques for passing information between pages in a website, a common one is 
to use the querystring. With this approach we&#39;d visit the products page using 
the URL &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;376&quot;&gt;ProductsInCategory.aspx?CategoryID=&lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;661&quot;&gt;categoryID&lt;/i&gt;&lt;/code&gt; and would then display the products in 
the &lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;375&quot;&gt;categoryID&lt;/i&gt; category. (See &lt;a href=&quot;http://aspnet.4guysfromrolla.com/articles/020205-1.aspx&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;374&quot;&gt;Passing Parameters from One Page to Another&lt;/a&gt; for a class to 
help streamline the code needed to pass parameters from one page to another via 
the querystring.) 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;373&quot;&gt;
To use a querystring value to filter 
results, simply choose the QueryString option from the &quot;Parameter source&quot; 
drop-down list. Then, enter the name of the querystring value you want to use in 
the querystring field textbox. After doing so, the SqlDataSource&#39;s declarative 
markup will include an &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;667&quot;&gt;&lt;asp:querystringparameter&gt;&lt;/asp:querystringparameter&gt;&lt;/code&gt; instance in its &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;666&quot;&gt;SelectParameters&lt;/code&gt; collection. The &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;665&quot;&gt;&lt;asp:querystringparameter&gt;&lt;/asp:querystringparameter&gt;&lt;/code&gt; 
instance, as shown below, provides the parameter name (&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;664&quot;&gt;Name&lt;/code&gt;), the name of the querystring value (&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;663&quot;&gt;QueryStringField&lt;/code&gt;) and the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;662&quot;&gt;Type&lt;/code&gt;: 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;372&quot;&gt;

&lt;/div&gt;
&lt;table border=&quot;0&quot; itxtharvested=&quot;0&quot; itxtnodeid=&quot;668&quot;&gt;
&lt;tbody itxtharvested=&quot;0&quot; itxtnodeid=&quot;669&quot;&gt;
&lt;tr itxtharvested=&quot;0&quot; itxtnodeid=&quot;670&quot;&gt;
&lt;td bgcolor=&quot;#cccccc&quot; itxtharvested=&quot;0&quot; itxtnodeid=&quot;671&quot; width=&quot;100%&quot;&gt;&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;672&quot;&gt;&lt;asp:sqldatasource 687?=&quot;&quot; id=&quot;&amp;lt;i itxtNodeId=&quot; itxtbad=&quot;1&quot;&gt;ID&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;686&quot;&gt;connectionString&lt;/i&gt;&quot;&lt;br itxtnodeid=&quot;685&quot; /&gt;    ProviderName=&quot;&lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;684&quot;&gt;providerName&lt;/i&gt;&quot;&lt;br itxtnodeid=&quot;683&quot; /&gt;    SelectCommand=&quot;&lt;b itxtbad=&quot;1&quot; itxtnodeid=&quot;682&quot;&gt;SELECT 
[ProductID], [ProductName], [UnitPrice] FROM [Products] WHERE ([CategoryID] = 
?)&lt;/b&gt;&quot;&amp;gt;&lt;br itxtnodeid=&quot;681&quot; /&gt;    &lt;selectparameters&gt;&lt;br itxtnodeid=&quot;680&quot; /&gt;        &lt;asp:querystringparameter 679?=&quot;&quot; itxtbad=&quot;1&quot; type=&quot;&amp;lt;b itxtNodeId=&quot;&gt;Int32&quot; &lt;br itxtnodeid=&quot;678&quot; /&gt;            Name=&quot;&lt;b itxtbad=&quot;1&quot; itxtnodeid=&quot;677&quot;&gt;CategoryID&lt;/b&gt;&quot; &lt;br itxtnodeid=&quot;676&quot; /&gt;            QueryStringField=&quot;&lt;b itxtbad=&quot;1&quot; itxtnodeid=&quot;675&quot;&gt;CategoryID&lt;/b&gt;&quot; /&amp;gt;&lt;br itxtnodeid=&quot;674&quot; /&gt;    &lt;/asp:querystringparameter&gt;&lt;/selectparameters&gt;&lt;/asp:sqldatasource&gt; &lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;

&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;371&quot;&gt;
The following screen shots show the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;690&quot;&gt;Categories.aspx&lt;/code&gt; page, which lists all 
categories along with a View Products link, and the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;689&quot;&gt;ProductsInCategory.aspx&lt;/code&gt; page, when visited as &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;688&quot;&gt;ProductsInCategory.aspx?CategoryID=1&lt;/code&gt; 
(viewing products in the Beverages category). 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;370&quot;&gt;

&lt;/div&gt;
&lt;center itxtharvested=&quot;0&quot; itxtnodeid=&quot;369&quot;&gt;
&lt;h2 class=&quot;section&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;697&quot;&gt;
The Complete List of Categories, 
Each With a View Products Link&lt;/h2&gt;
&lt;br itxtnodeid=&quot;696&quot; /&gt;&lt;img border=&quot;1&quot; height=&quot;280&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;695&quot; src=&quot;http://aspnet.4guysfromrolla.com/images/DS/fds6.png&quot; width=&quot;505&quot; /&gt; 
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;694&quot;&gt;

&lt;/div&gt;
&lt;h2 class=&quot;section&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;693&quot;&gt;
The Products in the Beverages 
Category (&lt;code&gt;ProductsInCategory.aspx?CategoryID=1&lt;/code&gt;)&lt;/h2&gt;
&lt;br itxtnodeid=&quot;692&quot; /&gt;&lt;img border=&quot;0&quot; height=&quot;343&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;691&quot; src=&quot;http://aspnet.4guysfromrolla.com/images/DS/fds7.png&quot; width=&quot;389&quot; /&gt; &lt;/center&gt;&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;

&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;368&quot;&gt;

&lt;/div&gt;
&lt;h2 class=&quot;section&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;367&quot;&gt;
Filtering Based on a Web Control 
Value&lt;/h2&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;
&lt;br itxtnodeid=&quot;366&quot; /&gt;The parameter values for a SqlDataSource can also 
be set based on a value from a Web control on the page. Returning to the 
Categories/Products master-detail example from before, rather than having two 
pages we might want to have one page that uses a DropDownList control to list 
all categories and shows the Products for the selected category in a GridView. 
To accomplish this, start by creating a page that displays a DropDownList that 
contains the categories. Next, add a SqlDataSource to return the products whose 
&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;365&quot;&gt;CategoryID&lt;/code&gt; equals the selected 
category in the DropDownList. To accomplish this, choose Control as the 
&quot;Parameter source.&quot; This will display a drop-down list of controls on the page, 
allowing your to choose which control&#39;s value should be used. Pick the 
DropDownList you added moments ago. 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;364&quot;&gt;
After performing these steps, the 
SqlDataSource&#39;s declarative markup will include an &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;705&quot;&gt;&lt;asp:controlparameter&gt;&lt;/asp:controlparameter&gt;&lt;/code&gt; instance in its &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;704&quot;&gt;SelectParameters&lt;/code&gt; collection. The &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;703&quot;&gt;&lt;asp:controlparameter&gt;&lt;/asp:controlparameter&gt;&lt;/code&gt; instance, 
as shown below, provides the parameter name (&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;702&quot;&gt;Name&lt;/code&gt;), the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;701&quot;&gt;ID&lt;/code&gt; of the control to use (&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;700&quot;&gt;ControlID&lt;/code&gt;), the control property whose value will be 
used as the parameter&#39;s value (&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;699&quot;&gt;PropertyName&lt;/code&gt;), and the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;698&quot;&gt;Type&lt;/code&gt;: 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;363&quot;&gt;

&lt;/div&gt;
&lt;table border=&quot;0&quot; itxtharvested=&quot;0&quot; itxtnodeid=&quot;706&quot;&gt;
&lt;tbody itxtharvested=&quot;0&quot; itxtnodeid=&quot;707&quot;&gt;
&lt;tr itxtharvested=&quot;0&quot; itxtnodeid=&quot;708&quot;&gt;
&lt;td bgcolor=&quot;#cccccc&quot; itxtharvested=&quot;0&quot; itxtnodeid=&quot;709&quot; width=&quot;100%&quot;&gt;&lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;710&quot;&gt;&lt;asp:sqldatasource 726?=&quot;&quot; id=&quot;&amp;lt;i itxtNodeId=&quot; itxtbad=&quot;1&quot;&gt;ID&quot; runat=&quot;server&quot; ConnectionString=&quot;&lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;725&quot;&gt;connectionString&lt;/i&gt;&quot;&lt;br itxtnodeid=&quot;724&quot; /&gt;    ProviderName=&quot;&lt;i itxtbad=&quot;1&quot; itxtnodeid=&quot;723&quot;&gt;providerName&lt;/i&gt;&quot;&lt;br itxtnodeid=&quot;722&quot; /&gt;    SelectCommand=&quot;&lt;b itxtbad=&quot;1&quot; itxtnodeid=&quot;721&quot;&gt;SELECT 
[ProductID], [ProductName], [UnitPrice] FROM [Products] WHERE ([CategoryID] = 
?)&lt;/b&gt;&quot;&amp;gt;&lt;br itxtnodeid=&quot;720&quot; /&gt;    &lt;selectparameters&gt;&lt;br itxtnodeid=&quot;719&quot; /&gt;        &lt;asp:controlparameter 718?=&quot;&quot; itxtbad=&quot;1&quot; type=&quot;&amp;lt;b itxtNodeId=&quot;&gt;Int32&quot; &lt;br itxtnodeid=&quot;717&quot; /&gt;            Name=&quot;&lt;b itxtbad=&quot;1&quot; itxtnodeid=&quot;716&quot;&gt;CategoryID&lt;/b&gt;&quot; &lt;br itxtnodeid=&quot;715&quot; /&gt;            ControlID=&quot;&lt;b itxtbad=&quot;1&quot; itxtnodeid=&quot;714&quot;&gt;categoriesDDL&lt;/b&gt;&quot;             PropertyName=&quot;&lt;b itxtbad=&quot;1&quot; itxtnodeid=&quot;713&quot;&gt;SelectedValue&lt;/b&gt;&quot; /&amp;gt;&lt;br itxtnodeid=&quot;712&quot; /&gt;    &lt;/asp:controlparameter&gt;&lt;/selectparameters&gt;&lt;/asp:sqldatasource&gt; &lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;

&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;362&quot;&gt;
The following screen shot shows a page 
that lists the categories in a DropDownList and the selected categories 
corresponding products in a GridView. This page uses two SqlDataSource controls 
- one to retrieve all catgories (which is bound to the DropDownList) and one to 
return the corresponding products (which uses the &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;728&quot;&gt;&lt;asp:controlparameter&gt;&lt;/asp:controlparameter&gt;&lt;/code&gt; and is bound to the 
GridView). I set the DropDownList&#39;s &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;727&quot;&gt;AutoPostBack&lt;/code&gt; property to True so that whenever the 
DropDownList changes a postback ensues and the GridView is updated to show the 
applicable products. 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;361&quot;&gt;

&lt;/div&gt;
&lt;center itxtharvested=&quot;0&quot; itxtnodeid=&quot;360&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;412&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;729&quot; src=&quot;http://aspnet.4guysfromrolla.com/images/DS/fds8.png&quot; width=&quot;424&quot; /&gt; &lt;/center&gt;&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;

&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;359&quot;&gt;

&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;358&quot;&gt;

&lt;/div&gt;
&lt;h2 class=&quot;section&quot; itxtbad=&quot;1&quot; itxtnodeid=&quot;357&quot;&gt;
Conclusion&lt;/h2&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;435&quot;&gt;
&lt;br itxtnodeid=&quot;356&quot; /&gt;In this article we saw how to use parameterized queries along 
with the SqlDataSource&#39;s &lt;code itxtharvested=&quot;0&quot; itxtnodeid=&quot;355&quot;&gt;SelectParameters&lt;/code&gt; collection to filter the results 
returned from a database query. The SqlDataSource allows the values used in the 
parameters to come from a bevy of sources, including hard-coded values, 
querystring values, Web control property values, session variables, and so on. 
These parameter values can be specified declaratively, requiring no code on our 
part. These parameter values can also be set programmatically, a topic we&#39;ll 
address in a future article in this series! 
&lt;/div&gt;
&lt;div itxtharvested=&quot;0&quot; itxtnodeid=&quot;354&quot;&gt;
Happy Programming! &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mavrasolutions.blogspot.com/feeds/3894497589522760648/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mavrasolutions.blogspot.com/2012/06/accessing-and-updating-data-in-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/3894497589522760648'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/62615523823450575/posts/default/3894497589522760648'/><link rel='alternate' type='text/html' href='http://mavrasolutions.blogspot.com/2012/06/accessing-and-updating-data-in-aspnet.html' title='Accessing and Updating Data in ASP.NET: Filtering Database Data with Parameters'/><author><name>Masood H.Virk</name><uri>http://www.blogger.com/profile/03667911252458341664</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBJGC-Ds1kIQeOrTgSrkIU3DHo806KHOVfrE0RkuSfJYo2LMlSqSL_O09eLUXR6zn3gHVKNMiCnbTel5YP0YDYSNPraix57Rlob-743JmZVzy12w1mntsSj0oU-xiF2hNXCEKFDzyjkL-lQRoNEvR3AxbG4DkfVJIBcVior54CC6WTwQ/s1600/Pic001.JPG'/></author><thr:total>0</thr:total></entry></feed>