<?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-1569908609926231479</id><updated>2026-04-03T00:49:53.849+02:00</updated><category term="(417) Expectation Failed"/><title type='text'>How to Dot Net</title><subtitle type='html'>How to tips and tricks for Microsoft Visual Studio .net</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>23</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-403054239724762273</id><published>2018-05-15T09:21:00.000+02:00</published><updated>2018-05-15T09:21:47.286+02:00</updated><title type='text'>Validate South African ID Number</title><content type='html'>&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;The South African ID Number is a unique number given to every person who is a South African citizen, or who has been granted permanent South African residence. Use &lt;a href=&quot;https://www.westerncape.gov.za/general-publication/decoding-your-south-african-id-number-0&quot; target=&quot;_blank&quot;&gt;this&lt;/a&gt; site to find out how the number is made up.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;The South African ID Number can be validated using the Luhn algorithm.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;I use the following code to validate South African ID Numbers in my applications:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;vb.net&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;pre style=&quot;color: #333333; line-height: 16.25px;&quot;&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Shared&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Function&lt;/span&gt; &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;RSA_ID_Number&lt;/span&gt;(&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;ByVal&lt;/span&gt; id_no &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;String&lt;/span&gt;) &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;Boolean&lt;/span&gt;
        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Dim&lt;/span&gt; is_valid &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;Boolean&lt;/span&gt; = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;False&lt;/span&gt;

        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Try&lt;/span&gt;
            &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;If&lt;/span&gt; id_no.Length = &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;13&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Then&lt;/span&gt;
                &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Dim&lt;/span&gt; intcheck_a &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;Integer&lt;/span&gt; = &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;0&lt;/span&gt;
                &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Dim&lt;/span&gt; strCheck_b &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;&quot;&lt;/span&gt;
                &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Dim&lt;/span&gt; intcheck_b &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;Integer&lt;/span&gt; = &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;0&lt;/span&gt;
                &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Dim&lt;/span&gt; intCheck_c &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;Integer&lt;/span&gt; = &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;0&lt;/span&gt;
                &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Dim&lt;/span&gt; check_calc_result &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;Integer&lt;/span&gt; = &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;0&lt;/span&gt;
                &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Dim&lt;/span&gt; check_digit &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;Integer&lt;/span&gt; = id_no.Substring(&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;12&lt;/span&gt;, &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1&lt;/span&gt;)

                &lt;span style=&quot;color: #888888;&quot;&gt;&#39; Step 1&lt;/span&gt;
                &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;For&lt;/span&gt; i = &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;To&lt;/span&gt; id_no.Length - &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1&lt;/span&gt;
                    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Select&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Case&lt;/span&gt; i
                        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Case&lt;/span&gt; &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;0&lt;/span&gt;, &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;2&lt;/span&gt;, &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;4&lt;/span&gt;, &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;6&lt;/span&gt;, &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;8&lt;/span&gt;, &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;10&lt;/span&gt;
                            intcheck_a += Convert.ToInt64(id_no.Substring(i, &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1&lt;/span&gt;))
                        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Case&lt;/span&gt; &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1&lt;/span&gt;, &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;3&lt;/span&gt;, &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;5&lt;/span&gt;, &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;7&lt;/span&gt;, &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;9&lt;/span&gt;, &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;11&lt;/span&gt;
                            strCheck_b &amp;amp;= id_no.Substring(i, &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1&lt;/span&gt;)
                    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Select&lt;/span&gt;
                &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Next&lt;/span&gt;

                &lt;span style=&quot;color: #888888;&quot;&gt;&#39; Step 2&lt;/span&gt;
                intcheck_b = Convert.ToInt64(strCheck_b) * &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;2&lt;/span&gt;
                strCheck_b = intcheck_b.ToString()

                &lt;span style=&quot;color: #888888;&quot;&gt;&#39; Step 3&lt;/span&gt;
                intcheck_b = &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;0&lt;/span&gt;
                &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;For&lt;/span&gt; i &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;Integer&lt;/span&gt; = &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;To&lt;/span&gt; strCheck_b.Length - &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1&lt;/span&gt;
                    intcheck_b += Convert.ToInt64(strCheck_b.Substring(i, &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1&lt;/span&gt;))
                &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Next&lt;/span&gt;

                &lt;span style=&quot;color: #888888;&quot;&gt;&#39; Step 4&lt;/span&gt;
                intCheck_c = intcheck_a + intcheck_b

                check_calc_result = &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;10&lt;/span&gt; - intCheck_c.ToString.Substring(intCheck_c.ToString.Length - &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1&lt;/span&gt;, &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1&lt;/span&gt;)

                is_valid = check_calc_result = check_digit
            &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;If&lt;/span&gt;

        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Catch&lt;/span&gt; ex &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;As&lt;/span&gt; Exception : &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Throw&lt;/span&gt;

        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Try&lt;/span&gt;

        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Return&lt;/span&gt; is_valid
    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;Function&lt;/span&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/403054239724762273/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2018/05/validate-south-african-id-number.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/403054239724762273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/403054239724762273'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2018/05/validate-south-african-id-number.html' title='Validate South African ID Number'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-639714174078871920</id><published>2015-11-03T09:33:00.001+02:00</published><updated>2016-07-18T08:14:36.473+02:00</updated><title type='text'>IIf in javascript/jQuery</title><content type='html'>&lt;div class=&quot;PadderBetweenControlandBody&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;The conditional operator(c#/java/javascript)
or IIf(vb), also called an inline if statement, is very useful.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;I have used IIF in my vb and c# exploits very
often. I wrote a post about the conditional operator for c#&amp;nbsp;&lt;a href=&quot;http://howto-dotnet.blogspot.co.za/2012/09/iif-in-c.html&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;here&lt;/span&gt;&lt;/a&gt;, and it has proven to be very popular.&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;margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;To use the conditional operator in javasctipt or
jQuery is just as simple as using it in&amp;nbsp;c# or vb.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;The syntax is: (&lt;b&gt;condition ? first_expression : second_expression);&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;A simple example is to
set a variable based on the condition of another variable:&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;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;background: white; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: white; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt; animal = &lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;&#39;cat&#39;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;background: white; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;background: white; color: blue; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;background: white; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt; species = (animal == &lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;&#39;cat&#39;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt; ? &lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;&#39;feline&#39;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt; : &lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;&#39;canine&#39;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;This snippet checks the
variable animal to see if it is set to&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;&#39;cat&#39;&lt;/span&gt;&lt;span style=&quot;font-size: 12.0pt;&quot;&gt;.&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt; If the condition is true, species is set to&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;&#39;feline&#39;&lt;/span&gt;&lt;span style=&quot;font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;. If not,
species is set to&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;&#39;canine&#39;&lt;/span&gt;&lt;span style=&quot;font-size: 12.0pt;&quot;&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Another way to use it would
be to set the class of a web page element using the jQuery addClass method:&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;background: white; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;($(&lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;&quot;#contactnumber&quot;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;).hasClass(&lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;&quot;requiredElement&quot;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;)
? &lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt; : $(&lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;&quot;#contactnumber&quot;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;).addClass(&lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;&quot;requiredElement&quot;&lt;/span&gt;&lt;span style=&quot;background: white; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;));&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;This snippet checks the element with an id of&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;contactnumber&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt; &lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;to see if it has the class&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;requiredElement&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt; &lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;assigned to it. If it does, then
nothing is changed, otherwise the class&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;background: white; color: #a31515; font-family: &amp;quot;consolas&amp;quot;; font-size: 9.5pt;&quot;&gt;requiredElement&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt; &lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;is added to
the element.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Please let me know in the
comments, if this helped.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Happy coding.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/639714174078871920/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2015/11/iif-in-javascriptjquery.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/639714174078871920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/639714174078871920'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2015/11/iif-in-javascriptjquery.html' title='IIf in javascript/jQuery'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-7887541712859788488</id><published>2015-05-07T14:16:00.001+02:00</published><updated>2015-05-07T14:28:09.475+02:00</updated><title type='text'>Microsoft Exchange Web Services – Sending an E-Mail</title><content type='html'>&lt;span xmlns=&quot;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
Before you start find out that comes before this by checking out this post first:&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;&lt;a href=&quot;http://howto-dotnet.blogspot.com/2015/05/microsoft-exchange-web-services-first.html&quot;&gt;&lt;b&gt;Microsoft Exchange Web Services – First things first&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;One of the more obvious things that you might want to do with EWS is send an e-mail.&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span xmlns=&quot;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;  Dim subject As String = &quot;Your subject&quot;  
  Dim html_Content As String = &quot;&amp;lt;div style=&quot;&quot;font-family:Arial;font-size:10pt;color:black&quot;&quot;&amp;gt;Insert your html content for your e-mail here&amp;lt;/div&amp;gt;&quot;  
  Dim _SendTo As String = &quot;email@address.com&quot;  
   
  Dim replyMessage As New Microsoft.Exchange.WebServices.Data.EmailMessage(_service)  
  replyMessage.Subject = subject  
  replyMessage.Body = html_Content  
  replyMessage.ToRecipients.Add(_SendTo)  
   
  replyMessage.SendAndSaveCopy()  
   
&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;This code snippet will send an e-mail to the address that you specify. &lt;b&gt;Remember to use the code in the post referenced at the top of this post.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;More posts about Exchange Web Services will follow.&lt;br /&gt;&lt;br /&gt;Please let me know if you found this info helpful.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/7887541712859788488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2015/05/microsoft-exchange-web-services-sending.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/7887541712859788488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/7887541712859788488'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2015/05/microsoft-exchange-web-services-sending.html' title='Microsoft Exchange Web Services – Sending an E-Mail'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-5829779544569793053</id><published>2015-05-05T10:37:00.001+02:00</published><updated>2015-05-05T10:53:42.074+02:00</updated><title type='text'>Microsoft Exchange Web Services – First things first</title><content type='html'>&lt;span xmlns=&quot;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;&lt;br /&gt;Microsoft Exchange Web Services (EWS) allows you to manage your Microsoft Exchange account using built in web services on the Exchange server.&lt;br /&gt;Some of the things EWS allows you to do:&lt;/span&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span xmlns=&quot;&quot;&gt;Read mail in any of the folders that your account has access to&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span xmlns=&quot;&quot;&gt;Send e-mails from your account&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span xmlns=&quot;&quot;&gt;Manage appointments&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span xmlns=&quot;&quot;&gt;Move e-mails from one folder to another&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;span xmlns=&quot;&quot;&gt;The first thing I can recommend is to download and install the &lt;strong&gt;Microsoft Exchange Web Services API&lt;/strong&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;&lt;br /&gt;&lt;strong&gt;Version 2.2 of the API can be found here:&lt;/strong&gt;&lt;br /&gt;&lt;a href=&quot;https://www.microsoft.com/en-us/download/details.aspx?id=42951&quot;&gt;https://www.microsoft.com/en-us/download/details.aspx?id=42951&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Use the following link to find out where your Exchange Web Services are installed, so that you can use the URL as the _service.Url in the code below:&lt;/strong&gt;&lt;br /&gt;&lt;a href=&quot;http://blogs.msdn.com/b/deva/archive/2011/12/02/how-to-get-the-ews-endpoint-url-from-outlook-2007-2010.aspx&quot;&gt;http://blogs.msdn.com/b/deva/archive/2011/12/02/how-to-get-the-ews-endpoint-url-from-outlook-2007-2010.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Once you have the API installed, and you know what the services URL is, you can start a new Visual Studio project, and add Microsoft.Exchange.WebServices.dll as a reference to the project.&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;In my installation&#39;s case it is located in &lt;strong&gt;C:\Program Files\Microsoft\Exchange\Web Services\2.2.&lt;/strong&gt;&lt;br /&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;&lt;br /&gt;You are now ready to get going:&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQTjcJ5KDmF9Tx85cTen5YR35tDvJfHTDXcsaPy-WJ4ugXCd8SGkGB3JHyw4iU2r7PHX_3wCupGiBdoZq14UPbxojpmQUPZtPn1PDL-oCJhCe-jLO5Ymb6iHlOJleqVStDGzcc-3mx9D6q/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span xmlns=&quot;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;      Private _service As Microsoft.Exchange.WebServices.Data.ExchangeService = New Microsoft.Exchange.WebServices.Data.ExchangeService(Microsoft.Exchange.WebServices.Data.ExchangeVersion.Exchange2010_SP1)  
      Private _serviceCredentials = New Microsoft.Exchange.WebServices.Data.WebCredentials(&quot;exchangeUserId&quot;, &quot;exchangePassword&quot;, &quot;optionalDomainName&quot;)  
   
      Private Sub Initiate_EWS_Service()  
           _service.Credentials = _serviceCredentials  
           _service.Url = New Uri(&quot;https://exchangeWebServiceURL&quot;)  
      End Sub  
   
      Initiate_EWS_Service()  
   
&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
This little bit of code will connect to your Exchange Server and authenticate your supplied credentials. You can use _service to interact with the exchange server account, and perform the functions I mentioned at the beginning of this post.&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;&lt;br /&gt;More posts about Exchange Web Services will follow.&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;&lt;br /&gt;Please let me know if you found this info helpful.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/5829779544569793053/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2015/05/microsoft-exchange-web-services-first.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/5829779544569793053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/5829779544569793053'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2015/05/microsoft-exchange-web-services-first.html' title='Microsoft Exchange Web Services – First things first'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-4955814790055593722</id><published>2013-07-16T13:09:00.003+02:00</published><updated>2013-07-16T13:09:27.536+02:00</updated><title type='text'>Object doesn&#39;t support property or method &#39;querySelectorAll&#39; - IE9</title><content type='html'>&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt;&quot;&gt;I
have recently been plagued by an error that I found very difficult to fix.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt;&quot;&gt;Object doesn&#39;t
support property or method &#39;querySelectorAll&#39;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt;&quot;&gt;This error only
occurs when using IE9!&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt;&quot;&gt;There
are lots of explanations all over the place on how to fix the problem. Our main
problem is that we don’t even use the JavaScript querySelectorAll function, but
I suspect that one of the 3&lt;sup&gt;rd&lt;/sup&gt; party add-ons (Component One) that we
use does.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt;&quot;&gt;Many
solutions just tell you to add  to the top of your page,
and that will sort things out for you.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt;&quot;&gt;What
a joke!!! Unfortunately, it is not that simple!&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt;&quot;&gt;There
is more to it, to make it work.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt;&quot;&gt;Visual
Studio 2010 adds the following to .aspx and .htm pages when you create them:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 9.5pt;&quot;&gt;DOCTYPE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;html&lt;/span&gt;
&lt;span style=&quot;color: red;&quot;&gt;PUBLIC&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;-//W3C//DTD
XHTML 1.0 Transitional//EN&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt;&quot;&gt;This is what works!&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt;&quot;&gt;There
are other versions of the  tag that also seem to have
worked in my testing:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 9.5pt;&quot;&gt;DOCTYPE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;html&lt;/span&gt;
&lt;span style=&quot;color: red;&quot;&gt;PUBLIC&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;-//W3C//DTD
XHTML 4.0 Transitional//EN&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 9.5pt;&quot;&gt;DOCTYPE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;html&lt;/span&gt;
&lt;span style=&quot;color: red;&quot;&gt;PUBLIC&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;-//W3C//DTD
HTML 1.0 Transitional//EN&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 9.5pt;&quot;&gt;DOCTYPE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;html&lt;/span&gt;
&lt;span style=&quot;color: red;&quot;&gt;PUBLIC&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;-//W3C//DTD
HTML 1.0 Transitional//EN&quot;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt;&quot;&gt;We
had ours set to the following, and it caused the error to come up:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 10.0pt;&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: 10.0pt;&quot;&gt;DOCTYPE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.0pt;&quot;&gt;
&lt;span style=&quot;color: red;&quot;&gt;HTML&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;PUBLIC&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif; font-size: 10pt;&quot;&gt;That may have possibly come from a previous
version of Visual Studio, and when users weren’t using IE9, everything was
fine, but as soon as an IE9 user accessed our problem site, the error occurred.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Arial, sans-serif; font-size: 10pt;&quot;&gt;As always… Let me know if this helped you or
not.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/4955814790055593722/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2013/07/object-doesnt-support-property-or.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/4955814790055593722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/4955814790055593722'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2013/07/object-doesnt-support-property-or.html' title='Object doesn&#39;t support property or method &#39;querySelectorAll&#39; - IE9'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-8774206051731092232</id><published>2013-06-14T11:30:00.000+02:00</published><updated>2013-09-04T23:22:55.870+02:00</updated><title type='text'>Wait for jQuery ajax functions to complete</title><content type='html'>&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;This is something that kept me busy for a little while. There weren&#39;t many explanations that helped me to see how this works, but I managed to get something that worked for me.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;I needed to return a json string from a handler and then check that it existed. My problem is that because&amp;nbsp;&lt;b&gt;jQuery &lt;/b&gt;is&amp;nbsp;asynchronous, my validation code always fired before the string was returned from the .ajax function call had completed. This mean&#39;t that I couldn&#39;t check that my order contains the required currency data.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;The key is to use $.when...then(function...&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;$.when will allow the code to complete the function calling the $ajax code, before continuing with the specified function.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;This is how I got it working...&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;var CurrentOrderCurrencyRows_json;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 13px;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;GetCurrencyRows() {&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-ZA;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 13px;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;OrderId = 25;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;ReturnValue =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;$.when(ReturnCurrencyRows(OrderId)).then(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-ZA;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;() {&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReturnValue = ValidateCurrencyRowsExist(&quot;There are no currency data rows!&quot;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: darkgreen; font-family: Consolas; font-size: 13px;&quot;&gt;// Do what you want with ReturnValue&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;});&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;, serif; font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: darkgreen; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: darkgreen; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; ReturnCurrencyRows(OrderId) {&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; BaseURL = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;http://localhost/testapp/handlerFolder/&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; url = BaseURL + &lt;span style=&quot;color: maroon;&quot;&gt;&quot;ReturnOrderCurrencyRows_json.ashx?id=&quot;&lt;/span&gt;
+ OrderId;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (url != &lt;span style=&quot;color: maroon;&quot;&gt;&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; $.ajax({&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type: &lt;span style=&quot;color: maroon;&quot;&gt;&quot;GET&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url:
url,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data: &lt;span style=&quot;color: maroon;&quot;&gt;&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
dataType: &lt;span style=&quot;color: maroon;&quot;&gt;&quot;json&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
success: &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; (data, status) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CurrentOrderCurrencyRows_json
= data;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; error: &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; (data, status) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
alert(&lt;span style=&quot;color: maroon;&quot;&gt;&#39;Error: &#39;&lt;/span&gt; + status);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; ValidateCurrencyRowsExist(ReturnErrorMessage) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (CurrentOrderCurrencyRows_json != undefined) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: maroon;&quot;&gt;&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;else&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; ReturnErrorMessage;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;Note:&lt;/b&gt;&amp;nbsp;The above code will not work unless you call the $.ajax function specifying &quot;&lt;span style=&quot;color: blue;&quot;&gt;return&quot;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Good luck, and as always... Feedback is very very welcome.&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/8774206051731092232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2013/06/wait-for-jquery-ajax-functions-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/8774206051731092232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/8774206051731092232'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2013/06/wait-for-jquery-ajax-functions-to.html' title='Wait for jQuery ajax functions to complete'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-3098057534269404736</id><published>2013-04-19T13:06:00.000+02:00</published><updated>2013-04-19T13:06:54.253+02:00</updated><title type='text'>jQuery ajax().load caches url</title><content type='html'>&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;In my mind, the jQuery ajax().load&amp;nbsp;functionality&amp;nbsp;is possibly one of the best things about jQuery.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;I ran into a problem that drove me nuts for a little while...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;I have a div:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon; font-family: Consolas; font-size: 9.5pt;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;divStatus&quot;&amp;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;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;I wanted to load some html into it each time I show a popup that contains it, like this:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: darkgreen;&quot;&gt;// Page Variables&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; ParsedURL;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; port;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; BaseUrl = &lt;span style=&quot;color: maroon;&quot;&gt;&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; $(&lt;span style=&quot;color: blue;&quot;&gt;function&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; url = document.URL;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ParsedURL
= parseUri(url);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; port =
ParsedURL.port;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (port != &lt;span style=&quot;color: maroon;&quot;&gt;&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; port = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;:&quot;&lt;/span&gt; + port;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;ShowStatusesDDL();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
ReadAndDisplayCookieData();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; ShowStatusesDDL() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: darkgreen;&quot;&gt;// Build the Base URL&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; BaseUrl =
ParsedURL.protocol + &lt;span style=&quot;color: maroon;&quot;&gt;&quot;://&quot;&lt;/span&gt; +
ParsedURL.host + port + ParsedURL.directory;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: darkgreen;&quot;&gt;// Add the rest of the text to the url for the
BuildStatusDropDownList Handler&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; LoadUrl = BaseUrl + &lt;span style=&quot;color: maroon;&quot;&gt;&quot;WebHandlers/BuildStatusDropDownList.ashx?t=&quot;&lt;/span&gt;
+ ParsedURL.queryKey[&lt;span style=&quot;color: maroon;&quot;&gt;&quot;t&quot;&lt;/span&gt;] + &lt;span style=&quot;color: maroon;&quot;&gt;&quot;&amp;amp;id=&quot;&lt;/span&gt; + ParsedURL.queryKey[&lt;span style=&quot;color: maroon;&quot;&gt;&quot;id&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(&lt;span style=&quot;color: maroon;&quot;&gt;&#39;#divStatus&#39;&lt;/span&gt;).load(LoadUrl);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;The problem with this code, is that every time the .load method runs, the url is the same. The .load method caches the url, and if it isn&#39;t different each time the .load method runs, it will return the cached return values.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;To fix this you need to make the url unique every time it runs, like this:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: darkgreen;&quot;&gt;// Page Variables&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; ParsedURL;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; port;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; BaseUrl = &lt;span style=&quot;color: maroon;&quot;&gt;&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; $(&lt;span style=&quot;color: blue;&quot;&gt;function&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; url = document.URL;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ParsedURL
= parseUri(url);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; port =
ParsedURL.port;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (port != &lt;span style=&quot;color: maroon;&quot;&gt;&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; port = &lt;span style=&quot;color: maroon;&quot;&gt;&quot;:&quot;&lt;/span&gt; + port;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;ShowStatusesDDL();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;ReadAndDisplayCookieData();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; ShowStatusesDDL() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: darkgreen;&quot;&gt;// Build the Base URL&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; BaseUrl =
ParsedURL.protocol + &lt;span style=&quot;color: maroon;&quot;&gt;&quot;://&quot;&lt;/span&gt; +
ParsedURL.host + port + ParsedURL.directory;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: darkgreen;&quot;&gt;// Build a Globally Unique Identifier to add to the url
to make it unique every time it is loaded - &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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: darkgreen;&quot;&gt;// This is because jQuery.load caches the url and won&#39;t
re-load it each time unless the url is different&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; RandomGuid = guid();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: darkgreen;&quot;&gt;// Add the rest of the text to the url for the
BuildStatusDropDownList Handler&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;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; LoadUrl = BaseUrl + &lt;span style=&quot;color: maroon;&quot;&gt;&quot;WebHandlers/BuildStatusDropDownList.ashx?t=&quot;&lt;/span&gt;
+ ParsedURL.queryKey[&lt;span style=&quot;color: maroon;&quot;&gt;&quot;t&quot;&lt;/span&gt;] + &lt;span style=&quot;color: maroon;&quot;&gt;&quot;&amp;amp;id=&quot;&lt;/span&gt; + ParsedURL.queryKey[&lt;span style=&quot;color: maroon;&quot;&gt;&quot;id&quot;&lt;/span&gt;] + &lt;span style=&quot;color: maroon;&quot;&gt;&quot;&amp;amp;guid=&quot;&lt;/span&gt;
+ RandomGuid;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(&lt;span style=&quot;color: maroon;&quot;&gt;&#39;#divStatus&#39;&lt;/span&gt;).load(LoadUrl);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; S4() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; (((1 + Math.random()) * 0x10000) |
0).toString(16).substring(1);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;function&lt;/span&gt; guid() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; (S4() + S4() + &lt;span style=&quot;color: maroon;&quot;&gt;&quot;-&quot;&lt;/span&gt;
+ S4() + &lt;span style=&quot;color: maroon;&quot;&gt;&quot;-&quot;&lt;/span&gt; + S4() + &lt;span style=&quot;color: maroon;&quot;&gt;&quot;-&quot;&lt;/span&gt; + S4() + &lt;span style=&quot;color: maroon;&quot;&gt;&quot;-&quot;&lt;/span&gt;
+ S4() + S4() + S4());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Pretty basic, but if you don&#39;t know about the .load method caching, it will confise the hell out of you.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/3098057534269404736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2013/04/jquery-ajaxload-caches-url.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/3098057534269404736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/3098057534269404736'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2013/04/jquery-ajaxload-caches-url.html' title='jQuery ajax().load caches url'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-2708312082909428856</id><published>2013-01-08T16:36:00.000+02:00</published><updated>2013-03-27T16:56:24.753+02:00</updated><title type='text'>How to learn to write software</title><content type='html'>Learning how to write software is one of those things that you have to do in such a way that it suits you.&lt;br /&gt;
&lt;br /&gt;
Some people enjoy an environment in which there is a structured approach, and they have someone who has some form of curriculum that is followed, teach them. They are given the history of software development, the theory behind software development and some syntax to work with. They are told how that syntax fits together with other syntax and the reasoning behind why it is like that. Then they are given tasks to do to demonstrate their understanding.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://600c4ovhxbkq-ktafq3zrqhn34.hop.clickbank.net/&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhObaJ-JseQpBLWieXi3hF3pIr-ZvkVdiAoYPVIQqKNqJlQ8c5OnQ01cHs09SuXb1e5zZzlkCGam1sGUJCb9Er-xFVOJkqderaYDNChNroTDukhdAlFidr9eT_vLUVo_36ArPUg4W5OIXw/s200/iPhoneDev.png&quot; width=&quot;173&quot; /&gt;
&lt;/a&gt;
&lt;/div&gt;
&lt;br /&gt;
Others like to learn how to write software on their own. That’s how I did it, and I would like to think that I’m not bad at what I do.&lt;br /&gt;
&lt;br /&gt;
I’m not going to say that one method of learning how to write software is better than any other method, simply because I only really know about the method I used. I don’t have any fancy degrees or anything like that. What I do have is the knowledge that I have been employed for a long time by many different companies to write software that did what they needed and wanted. I’m definitely not the world’s best programmer, but I’m also not the worst.&lt;br /&gt;
&lt;br /&gt;
I learned to write software by having a need to do something on a computer, and at the time, not knowing how to make it happen. So, the first step for me was to decide to do it myself.&lt;br /&gt;
&lt;br /&gt;
I could have called a programmer in to do the work, but that would have cost money I didn’t have. Besides, I love computers, so development was kind of a natural way to go for me to go.&lt;br /&gt;
&lt;br /&gt;
I didn’t start out programming totally green. I played with a Sinclair ZX Spectrum computer as a kid. It was the latest and greatest computer that I could get my hands on at the time. It plugged into a TV, didn’t have any way to store the programs that were typed in, unless you plugged a tape recorder into it to store it on cassette tape. It did have 16k of ram and could display 16 colours on the TV it was plugged into.&lt;br /&gt;
&lt;br /&gt;
I started out buying books with the code that once typed into the computer and executed, would provide me with hours of gaming pleasure, but it used to take hours to enter the code into the computer before I could play the game. I saved the games onto cassette tape, and if I was lucky enough to have the saved game work the next time I tried to load it, I was able to play them again and again.&lt;br /&gt;
&lt;br /&gt;
That’s was my first introduction to coding. The language was Basic. I didn’t really learn to programme through this experience, but I did get to understand how the code fitted together and that was a decent base to start on.&lt;br /&gt;
&lt;br /&gt;
Many years later, I had the opportunity to work in a software development company as their technical manager, and since I had a basic understanding of how software was put together, I began to learn. We were using VB3 and VB4 at the time, and those were light years ahead of the old Spectrum Basic I first encountered, but I seemed to pick it up pretty easily.&lt;br /&gt;
&lt;br /&gt;
I never actually wrote much code for that company, but I did do some. I still didn’t really know what I was doing as a developer until I left that company and began looking after my own client’s hardware and software needs. I had a client that needed a very custom application written. I quoted them, and when they accepted my quote, I had to find out how to actually write an application that did what they wanted, or find someone who would charge me to write it for me. I chose to write it because I couldn’t afford to pay someone else to do it for me.&lt;br /&gt;
&lt;br /&gt;
Their requirement was pretty simple:&lt;br /&gt;
&lt;br /&gt;
They needed to record the volume of liquid cosmetics that were filled into their containers for quality control needs. They wanted to record the volume by weight, therefore needed to be able to enter the specific gravity of the liquid going into the containers. Fortunately they provided me with the formula to work that out. Scales were connected to the computer and values came in from them, through serial cables, that the application had to record in a database, linking a product, batch and the values to each other.&lt;br /&gt;
&lt;br /&gt;
There were some rules:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Must be password protected.&lt;/li&gt;
&lt;li&gt;Must have a scale calibration module.&lt;/li&gt;
&lt;li&gt;Must store products for linking to container sizes and batch numbers.&lt;/li&gt;
&lt;li&gt;Must have various reports for auditing purposes.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
I really didn’t know enough about coding at the beginning of the project to get it done. I had been paid and spent a deposit so had no choice but to deliver an application.&lt;br /&gt;
&lt;br /&gt;
That’s where my learning how to write software really began.&lt;br /&gt;
&lt;br /&gt;
I knew come basic syntax and how to use it, but didn’t really know how to write software, so I just started at the beginning. I knew that I had to provide access to a database for storage and decided to use SQL Server. I was writing in VB6, so found out how to use ADO to connect to SQL Server.&lt;br /&gt;
&lt;br /&gt;
The first thing I did was design the user table and wrote the user login module. Once I had that done, I knew how to access, insert records, update records and delete in a SQL database. From there it was just a case of deciding what to do next and do it. If I didn’t know how to do what I wanted to do, I found out.&lt;br /&gt;
&lt;br /&gt;
That’s how I learned how to write software. It probably wasn’t the best way to go about it, but it worked for me.&lt;br /&gt;
&lt;br /&gt;
My advice to anyone wanting to learn how to write software, who doesn’t want to go the formal route, is to get hold of a computer that can run Visual Studio Express and to decide on a project, then to find out how to write code. Hopefully you have some knowledge about computers, but the most important thing Is to actually dive in and get dirty.&lt;br /&gt;
&lt;br /&gt;
If you are thinking about learning to write software, you aren’t learning, you are thinking about learning.&lt;br /&gt;
&lt;br /&gt;
Don’t think. Do!&lt;br /&gt;
&lt;br /&gt;
How did you learn?</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/2708312082909428856/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2013/01/how-to-learn-to-write-software.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/2708312082909428856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/2708312082909428856'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2013/01/how-to-learn-to-write-software.html' title='How to learn to write software'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhObaJ-JseQpBLWieXi3hF3pIr-ZvkVdiAoYPVIQqKNqJlQ8c5OnQ01cHs09SuXb1e5zZzlkCGam1sGUJCb9Er-xFVOJkqderaYDNChNroTDukhdAlFidr9eT_vLUVo_36ArPUg4W5OIXw/s72-c/iPhoneDev.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-7975936907548972469</id><published>2013-01-07T08:59:00.004+02:00</published><updated>2013-01-07T08:59:41.025+02:00</updated><title type='text'>Copy or clone a DataTable and insert rows</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;From time to time you may have the need to make an exact duplicate of a DataTable. This is very easily done using the .clone() method.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;The obvious place to start is to create a DataTable to use as the source...&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#39; Create the Datatable&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; dtSource &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;DataTable&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Contacts&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#39; Create some columns for the table&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; colID &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;DataColumn&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;id&quot;&lt;/span&gt;, &lt;span style=&quot;color: #2b91af;&quot;&gt;Type&lt;/span&gt;.GetType(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;System.Int32&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; colFirstName &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;DataColumn&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;FirstName&quot;&lt;/span&gt;, &lt;span style=&quot;color: #2b91af;&quot;&gt;Type&lt;/span&gt;.GetType(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;System.String&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; colLastName &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;DataColumn&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;LastName&quot;&lt;/span&gt;, &lt;span style=&quot;color: #2b91af;&quot;&gt;Type&lt;/span&gt;.GetType(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;System.String&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#39; Add the columns to the Datatable&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;dtSource.Columns.Add(colID)&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;dtSource.Columns.Add(colFirstName)&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;dtSource.Columns.Add(colLastName)&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#39; Create some rows to the DatatTable&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; row1 &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;DataRow&lt;/span&gt; = dtSource.NewRow()&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;row1(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;id&quot;&lt;/span&gt;) = 1&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;row1(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;FirstName&quot;&lt;/span&gt;) = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;John&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;row1(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;LastName&quot;&lt;/span&gt;) = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Smith&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; row2 &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;DataRow&lt;/span&gt; = dtSource.NewRow()&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;row2(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;id&quot;&lt;/span&gt;) = 2&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;row2(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;FirstName&quot;&lt;/span&gt;) = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;James&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;row2(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;LastName&quot;&lt;/span&gt;) = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Bond&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; row3 &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;DataRow&lt;/span&gt; = dtSource.NewRow()&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;row3(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;id&quot;&lt;/span&gt;) = 3&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;row3(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;FirstName&quot;&lt;/span&gt;) = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Jane&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;row3(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;LastName&quot;&lt;/span&gt;) = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Doe&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#39; Add the rows to the Data Table&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;dtSource.Rows.Add(row1)&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;dtSource.Rows.Add(row2)&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;dtSource.Rows.Add(row3)&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Now we have a DataTable with 3 columns and 3 rows called Contacts.&lt;/span&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;To make a copy of it we use the .Clone() Method...&lt;/span&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; dtTarget &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;DataTable&lt;/span&gt; = dtSource.Clone()&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;That&#39;s all there is to making an exact copy of the DataTable. &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;One very important thing keep in mind is that the .Clone() method&lt;b&gt; will only copy the structure and NOT the data or rows from the source DataTable&lt;/b&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;If you want to import the rows from the source to the target DataTable, you must use the .ImportRow() method.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: small; line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;For&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Each&lt;/span&gt; row &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;DataRow&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;In&lt;/span&gt; dtSource.Rows&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: small; line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;dtTarget.ImportRow(row)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: small; line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Next&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;font-family: Arial, Helvetica, sans-serif; font-size: small; line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;As always... Comments are welcome.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/7975936907548972469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2013/01/copy-or-clone-datatable-and-insert-rows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/7975936907548972469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/7975936907548972469'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2013/01/copy-or-clone-datatable-and-insert-rows.html' title='Copy or clone a DataTable and insert rows'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-6058799479396088359</id><published>2012-12-10T10:43:00.002+02:00</published><updated>2012-12-10T10:43:24.834+02:00</updated><title type='text'>Pass Greater Than or Lesser Than in XML</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;If you have a need to pass a greater than (&amp;gt;) or lesser than (&amp;lt;) symbol to a SQL stored procedure using a XML string, then this may help you...&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Most of the stored procs that I work with in my work environment require me to pass data in to them using XML. This is not by personal choice but it is required to keep to standards set a loooong time ago.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;The stored proc builds a query based on the WhereClause that is passed within the XML string.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Passing a where clause that contains the&amp;nbsp;greater than (&amp;gt;) or lesser than (&amp;lt;) symbols will cause an error in your query because they are reserved as building blocks of an XML string. I get around this by using substitution characters like this...&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; StartDate &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: #a31515;&quot;&gt;&quot;2012-12-01&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; EndDate &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: #a31515;&quot;&gt;&quot;2012-12-07&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt; XML &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;StringBuilder&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Exec sp_ReturnData &#39;&amp;lt;Contact
Debug=&quot;&quot;1&quot;&quot;&amp;gt;&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;XML.Append(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;&amp;lt;Record
WhereClause=&quot;&quot; Where ActionDate [gt]= &#39;&quot;&lt;/span&gt; &amp;amp; StartDate
&amp;amp; &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;&#39; And ActionDate [lt]= &#39;&quot;&lt;/span&gt;
&amp;amp; EndDate &amp;amp; &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;&#39;&quot;&quot; /&amp;gt;&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;XML.Append(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;&amp;lt;/Contact&amp;gt;&#39;&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: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;In my stored proc there is a variable declared as @WhereClause which contanes the &quot;WhereClause&quot; that I pass in through the XML.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;I perform a character substitution on @WhereClause like this...&lt;/span&gt;&lt;br /&gt;


&lt;div class=&quot;MsoNormal&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;; line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: small; line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;Set&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;
&lt;/span&gt;@WhereClause &lt;span style=&quot;color: grey;&quot;&gt;=&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 class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;@WhereClause&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;[lt]&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;font-family: &#39;Courier New&#39;; font-size: small; line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;Set&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;
@WhereClause &lt;span style=&quot;color: grey;&quot;&gt;=&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 class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;@WhereClause&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;[gt]&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: small;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;And then I set the sql command and add @WhereClause to it...&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;;&quot;&gt;Set &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;@SQL&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &#39;Courier New&#39;; line-height: normal;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; line-height: normal;&quot;&gt;&#39;SELECT FirstName, Surname
From MyTable &#39;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;; line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;;&quot;&gt;Set&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; @SQL &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; @SQL &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; @WhereClause&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;font-family: &#39;Courier New&#39;; line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;You can pick your own characters to substitute. Just make sure they aren&#39;t characters that you might use elsewhere, or the wrong characters will be substituted.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Do you use a different method to do this? Let me know in the comments.&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/6058799479396088359/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2012/12/pass-greater-than-or-lesser-than-in-xml.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/6058799479396088359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/6058799479396088359'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2012/12/pass-greater-than-or-lesser-than-in-xml.html' title='Pass Greater Than or Lesser Than in XML'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-3328310125095012760</id><published>2012-11-19T11:42:00.000+02:00</published><updated>2012-11-19T11:49:52.128+02:00</updated><title type='text'>Building a development machine - Start to finish...</title><content type='html'>I was recently forced to re-load all of the required software on a new development machine.&lt;br /&gt;
&lt;br /&gt;
No! I&#39;m not stupid. I may be a little crazy, but that&#39;s debatable.&lt;br /&gt;
&lt;br /&gt;
I was forced to load the machine because some wonderful people (read&amp;nbsp;thieves) decided that my development laptop and all other computer equipment in my home, should be theirs.&lt;br /&gt;
&lt;br /&gt;
It took 4 days for my office to buy me a new machine, and in those 4 days, I went a little nuts from boredom. No form of computer for more than a day, and I feel it big time.&lt;br /&gt;
&lt;br /&gt;
Anyway... The new laptop arrived with Windows 7 installed.&lt;br /&gt;
&lt;br /&gt;
The first step was to install Visual Studio 2010. That took what seemed to be a lifetime. Then I installed SP1, and that strangely enough took even longer to install.&lt;br /&gt;
&lt;br /&gt;
SQL Server was next. 2008 R2 takes another life time to install and configure. I then had to copy the live DB to my laptop. It&#39;s a whole 28Gig!!! That took about 5 or 6 hours to copy, because low and behold, there happened to be network connectivity issues in the office on that particular day.&lt;br /&gt;
&lt;br /&gt;
So now I had a machine that I&amp;nbsp;could at least begin to work on.&lt;br /&gt;
&lt;br /&gt;
Then I found out just how many other little, but essential pieces of software that I use on a daily basis to do seemingly simple things with...&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Paint.Net&lt;/b&gt; for those little image creation and&amp;nbsp;re-sizing, colour sampling and general editing of images.&lt;br /&gt;
&lt;b&gt;Notepad2 &lt;/b&gt;or &lt;b&gt;Notepad++&lt;/b&gt; for simple or complex text editing.&lt;br /&gt;
&lt;b&gt;Google Chrome&lt;/b&gt; and/or &lt;b&gt;Firefox &lt;/b&gt;for consistency checking of web apps.&lt;br /&gt;
Any nice &lt;b&gt;snipping tool&lt;/b&gt; for grabbing of sections of the screen.&lt;br /&gt;
&lt;b&gt;Dropbox &lt;/b&gt;or &lt;b&gt;Google Drive&lt;/b&gt; for cloud storage of almost anything you want to backup.&lt;br /&gt;
&lt;b&gt;Acrobat Reader&lt;/b&gt; for opening PDF docs.&lt;br /&gt;
&lt;br /&gt;
There are also those million and one little apps that I have written over the years that make my development life simpler.&lt;br /&gt;
&lt;br /&gt;
All in all, I think it took me about 30 hours to get to a point where I could actually do some work. This also excludes re-writing those little apps, that I forgot to backup, that perform small but&amp;nbsp;crucial&amp;nbsp;tasks for me. I know my very big, huge (some very bad swear word here), mess up!&lt;br /&gt;
&lt;br /&gt;
How about you... &lt;b&gt;How long does it take you to get a new machine going to a point of being able to get some work done?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/3328310125095012760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2012/11/building-development-machine-start-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/3328310125095012760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/3328310125095012760'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2012/11/building-development-machine-start-to.html' title='Building a development machine - Start to finish...'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-7850021148065062718</id><published>2012-09-25T13:27:00.001+02:00</published><updated>2014-09-10T12:16:54.737+02:00</updated><title type='text'>IIf in c#</title><content type='html'>&lt;span xmlns=&quot;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;Visual Basic and c# are very similar. That&#39;s my opinion, but in some small cases there is no similarity.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span xmlns=&quot;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div style=&quot;padding-left: 250px; width: 100%;&quot;&gt;
&lt;a href=&quot;http://www.amazon.com/gp/product/1494208393/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=1494208393&amp;amp;linkCode=as2&amp;amp;tag=twitter_quin-20&amp;amp;linkId=UM5IIARHTJTAVCBN&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&amp;amp;ASIN=1494208393&amp;amp;Format=_SL110_&amp;amp;ID=AsinImage&amp;amp;MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;WS=1&amp;amp;tag=twitter_quin-20&quot; /&gt;&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://ir-na.amazon-adsystem.com/e/ir?t=twitter_quin-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=1494208393&quot; height=&quot;1&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt;
&lt;/div&gt;
&lt;br /&gt;


&lt;span xmlns=&quot;&quot;&gt;The VB IIf function is one example of which there is nothing that looks even slightly similar in c#.&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;The equivalent in c# is…&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;a == &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;1&quot;&lt;/span&gt; ? &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt; : &lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;How to use this is pretty simple…&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; ReturnedValue = a == &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;1&quot;&lt;/span&gt; ? &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt; : &lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;or&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; ReturnedValue = a == &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;1&quot;&lt;/span&gt; ? 5 : 10;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;or&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; ReturnedValue = a == &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;canine&quot;&lt;/span&gt; ? &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;dog&quot;&lt;/span&gt; : &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;cat&quot;&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;However you decide to use it, it looks a bit strange to a veteran VB user.&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;To make it more VB friendly I have these methods that look and function like the VB IIf function…&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharpcode&quot; style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: Consolas, &#39;Courier New&#39;, Courier, monospace; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;&quot;&gt;    &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;object&lt;/span&gt; IIf(&lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; Expression, &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;object&lt;/span&gt; TruePart, &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;object&lt;/span&gt; FalsePart)
    {
      &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;object&lt;/span&gt; ReturnValue = Expression == &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;true&lt;/span&gt; ? TruePart : FalsePart;

      &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; ReturnValue;
    }

    &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; IIf(&lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; Expression, &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; TruePart, &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; FalsePart)
    {
      &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; ReturnValue = Expression == &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;true&lt;/span&gt; ? TruePart : FalsePart;

      &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; ReturnValue;
    }

    &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; IIf(&lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; Expression, &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; TruePart, &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; FalsePart)
    {
      &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; ReturnValue = Expression == &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;true&lt;/span&gt; ? TruePart : FalsePart;

      &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; ReturnValue;
    }

    &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; IIf(&lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; Expression, &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; TruePart, &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; FalsePart)
    {
      &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; ReturnValue = Expression == &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;true&lt;/span&gt; ? TruePart : FalsePart;

      &lt;span class=&quot;kwrd&quot; style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; ReturnValue;
    }&lt;/pre&gt;
&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;Use them like this…&lt;/span&gt;&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; ReturnedValue = IIf(aa == &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;canine&quot;&lt;/span&gt;, &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;dog&quot;&lt;/span&gt;, &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;cat&quot;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span xmlns=&quot;&quot;&gt;Happy coding&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/7850021148065062718/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2012/09/iif-in-c.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/7850021148065062718'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/7850021148065062718'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2012/09/iif-in-c.html' title='IIf in c#'/><author><name>Quinton Carroll</name><uri>http://www.blogger.com/profile/15073249299556378388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-4647546840845600822</id><published>2012-08-23T09:48:00.001+02:00</published><updated>2012-08-23T10:09:25.519+02:00</updated><title type='text'>Create a DataTable easily</title><content type='html'>&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;EN-ZA&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:EnableOpenTypeKerning/&gt;
   &lt;w:DontFlipMirrorIndents/&gt;
   &lt;w:OverrideTableStyleHps/&gt;
   &lt;w:UseFELayout/&gt;
  &lt;/w:Compatibility&gt;
  &lt;w:DoNotOptimizeForBrowser/&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val=&quot;Cambria Math&quot;/&gt;
   &lt;m:brkBin m:val=&quot;before&quot;/&gt;
   &lt;m:brkBinSub m:val=&quot;&amp;#45;-&quot;/&gt;
   &lt;m:smallFrac m:val=&quot;off&quot;/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val=&quot;0&quot;/&gt;
   &lt;m:rMargin m:val=&quot;0&quot;/&gt;
   &lt;m:defJc m:val=&quot;centerGroup&quot;/&gt;
   &lt;m:wrapIndent m:val=&quot;1440&quot;/&gt;
   &lt;m:intLim m:val=&quot;subSup&quot;/&gt;
   &lt;m:naryLim m:val=&quot;undOvr&quot;/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState=&quot;false&quot; DefUnhideWhenUsed=&quot;true&quot;
  DefSemiHidden=&quot;true&quot; DefQFormat=&quot;false&quot; DefPriority=&quot;99&quot;
  LatentStyleCount=&quot;267&quot;&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Normal&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;heading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;35&quot; QFormat=&quot;true&quot; Name=&quot;caption&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;10&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; Name=&quot;Default Paragraph Font&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;11&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtitle&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;22&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Strong&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;20&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;59&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Table Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; UnhideWhenUsed=&quot;false&quot; Name=&quot;Placeholder Text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;No Spacing&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; UnhideWhenUsed=&quot;false&quot; Name=&quot;Revision&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;34&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;List Paragraph&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;29&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;30&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;19&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtle Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;21&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;31&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtle Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;32&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;33&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Book Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;37&quot; Name=&quot;Bibliography&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; QFormat=&quot;true&quot; Name=&quot;TOC Heading&quot;/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
 {mso-style-name:&quot;Table Normal&quot;;
 mso-tstyle-rowband-size:0;
 mso-tstyle-colband-size:0;
 mso-style-noshow:yes;
 mso-style-priority:99;
 mso-style-parent:&quot;&quot;;
 mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
 mso-para-margin-top:0cm;
 mso-para-margin-right:0cm;
 mso-para-margin-bottom:10.0pt;
 mso-para-margin-left:0cm;
 mso-pagination:widow-orphan;
 font-size:11.0pt;
 mso-bidi-font-size:10.0pt;
 font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
 mso-ascii-font-family:Calibri;
 mso-ascii-theme-font:minor-latin;
 mso-hansi-font-family:Calibri;
 mso-hansi-theme-font:minor-latin;
 mso-bidi-font-family:&quot;Times New Roman&quot;;
 mso-bidi-theme-font:minor-bidi;}
&lt;/style&gt;
&lt;![endif]--&gt;

&lt;div class=&quot;MsoNormal&quot;&gt;
I have a need to create Data Tables for many reasons in my
quest for complete projects. If you need to do it, and you, like me, find the
whole thing of defining each column and type a big schlep, check this out.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Shared&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Function&lt;/span&gt;
BuildDataTable(&lt;span style=&quot;color: blue;&quot;&gt;ByVal&lt;/span&gt; TableName &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&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;ByVal&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; Parameters &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;List&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;Of&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;TableParams&lt;/span&gt;)) &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;DataTable&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Dim&lt;/span&gt;
dtReturn &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;DataTable&lt;/span&gt;(TableName)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Try&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&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;For&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Each&lt;/span&gt; param &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;TableParams&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;In&lt;/span&gt;
Parameters&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dtReturn.Columns.Add(&lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;DataColumn&lt;/span&gt;(param.ColumnName,
param.ColumnType))&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&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;Next&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Catch&lt;/span&gt; ex &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;Exception&lt;/span&gt; : &lt;span style=&quot;color: blue;&quot;&gt;Throw&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Finally&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormalCxSpMiddle&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-add-space: auto; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Try&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Return&lt;/span&gt;
dtReturn&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Function&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&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;TableParams&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&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;Public&lt;/span&gt;
ColumnName &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&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&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;Public&lt;/span&gt;
ColumnType &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;Type&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&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;Public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;ByVal&lt;/span&gt; ColumnName &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: blue;&quot;&gt;ByVal&lt;/span&gt;
ColumnType &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;Type&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&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: blue;&quot;&gt;Me&lt;/span&gt;.ColumnName
= ColumnName&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&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: blue;&quot;&gt;Me&lt;/span&gt;.ColumnType
= ColumnType&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&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;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;Class&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Use the above Function like this…&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;Dim&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; TableParams &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;List&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;Of&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;TableParams&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;TableParams.Add(&lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt;
&lt;span style=&quot;color: #2b91af;&quot;&gt;TableParams&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;id&quot;&lt;/span&gt;,
&lt;span style=&quot;color: #2b91af;&quot;&gt;Type&lt;/span&gt;.GetType(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;System.Int32&quot;&lt;/span&gt;)))&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;TableParams.Add(&lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt;
&lt;span style=&quot;color: #2b91af;&quot;&gt;TableParams&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;CompanyName&quot;&lt;/span&gt;,
&lt;span style=&quot;color: #2b91af;&quot;&gt;Type&lt;/span&gt;.GetType(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;System.String&quot;&lt;/span&gt;)))&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;TableParams.Add(&lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;TableParams&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;EMail&quot;&lt;/span&gt;, &lt;span style=&quot;color: #2b91af;&quot;&gt;Type&lt;/span&gt;.GetType(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;System.String&quot;&lt;/span&gt;)))&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;TableParams.Add(&lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt;
&lt;span style=&quot;color: #2b91af;&quot;&gt;TableParams&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;FirstName&quot;&lt;/span&gt;,
&lt;span style=&quot;color: #2b91af;&quot;&gt;Type&lt;/span&gt;.GetType(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;System.String&quot;&lt;/span&gt;)))&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;TableParams.Add(&lt;span style=&quot;color: blue;&quot;&gt;New&lt;/span&gt;
&lt;span style=&quot;color: #2b91af;&quot;&gt;TableParams&lt;/span&gt;(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Surname&quot;&lt;/span&gt;,
&lt;span style=&quot;color: #2b91af;&quot;&gt;Type&lt;/span&gt;.GetType(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;System.String&quot;&lt;/span&gt;)))&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none; text-indent: 36.0pt;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;Dim&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; dtInviteList &lt;span style=&quot;color: blue;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;DataTable&lt;/span&gt; = &lt;span style=&quot;color: #2b91af;&quot;&gt;Common&lt;/span&gt;.BuildDataTable(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;ContactDetails&quot;&lt;/span&gt;, TableParams)&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/4647546840845600822/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2012/08/create-datatable-easily.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/4647546840845600822'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/4647546840845600822'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2012/08/create-datatable-easily.html' title='Create a DataTable easily'/><author><name>Quinton Carroll</name><uri>http://www.blogger.com/profile/15073249299556378388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-3415662968380984035</id><published>2012-08-23T09:29:00.001+02:00</published><updated>2015-05-05T09:55:53.222+02:00</updated><title type='text'>Word cannot register your account</title><content type='html'>&lt;span xmlns=&quot;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;I know that this isn&#39;t .net related, but I couldn&#39;t find much to help with this problem anywhere, and since I managed to solve it for myself, I thought I would post my solution here. I hope you don&#39;t mind.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot; tile=&quot;Professional Memory Card Recovery Software - Recover Lost or Deleted Photos in 3 Steps&quot;&gt;
&lt;a href=&quot;http://db09abyb14kh1ismsnt0viuh44.hop.clickbank.net/?tid=HOWTODOTNET&quot; target=&quot;_blank&quot; tile=&quot;Professional Memory Card Recovery Software - Recover Lost or Deleted Photos in 3 Steps&quot;&gt;
&lt;img border=&quot;0&quot; height=&quot;80&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbyahbMR6D5qprqVyTzI1imFKty8VQgmBpvhLd0Y1Oitwb50oI8-qNdRpXaDKWBe0Ba6BqtmqQbRPj63ROgTff0fieN4eRzob3IKNLq28QVe9NVDKNaEJP-BttQalI6LBRo9luI1vMh_4/s320/SD+Card+Recovery.png&quot; width=&quot;320&quot; /&gt;
&lt;/a&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;If you receive the message &quot;&lt;strong&gt;Word cannot register your account&lt;/strong&gt;&quot; when trying to register your account on Blogger.com, try the following…&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;I recently found something that may help with this problem. It is caused by your google account not allowing access to &quot;less secure&quot; applications. MS Word is one of them, and access is denied by default.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;&lt;b&gt;To allow less secure applications to sign in using your Google account, you need to change the access setting.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;&lt;b&gt;Follow the following link and select &quot;Turn On&quot;:&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;&lt;a href=&quot;https://www.google.com/settings/security/lesssecureapps&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;https://www.google.com/settings/security/lesssecureapps&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;This will allow you to log into blogger through MS Office, and to post to your blog.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Please let me know how it works out for you in the comments.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;&lt;strike&gt;1. Log into the Blogger settings page for your account.&lt;/strike&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;&lt;strike&gt;2. Send an &quot;Author&quot; invite to yourself at a different Google account to the one you used to log into Blogger with.&lt;/strike&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;&lt;strike&gt;3. Follow the link sent to your 2nd Google account, and log into Blogger using the 2nd Google account. This will set your 2nd account up on your blog with &quot;Author&quot; privileges.&lt;/strike&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;&lt;strike&gt;4. Go back to word and use your 2nd Google account credentials to register using word on Blogger.&lt;/strike&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;&lt;strike&gt;This worked for me. I hope it does for everyone else with this problem.&lt;/strike&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot; xmlns=&quot;&quot;&gt;&lt;strong&gt;&lt;strike&gt;I haven&#39;t tried it, but it may just work to see if you can change your main Google account to have author privileges in Blogger instead of or as well as having &quot;Admin&quot; privileges.&lt;/strike&gt;&lt;/strong&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/3415662968380984035/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2012/08/word-cannot-register-your-account.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/3415662968380984035'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/3415662968380984035'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2012/08/word-cannot-register-your-account.html' title='Word cannot register your account'/><author><name>Quinton Carroll</name><uri>http://www.blogger.com/profile/15073249299556378388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbyahbMR6D5qprqVyTzI1imFKty8VQgmBpvhLd0Y1Oitwb50oI8-qNdRpXaDKWBe0Ba6BqtmqQbRPj63ROgTff0fieN4eRzob3IKNLq28QVe9NVDKNaEJP-BttQalI6LBRo9luI1vMh_4/s72-c/SD+Card+Recovery.png" height="72" width="72"/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-5034578143376026793</id><published>2010-08-23T11:08:00.001+02:00</published><updated>2010-08-23T11:14:42.288+02:00</updated><title type='text'>InputBox for c#</title><content type='html'>&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;One of the little things that has been left out of the c# tool box is the vb style input box that allows you to input a string into a text box and have the string returned back to you.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;This is my solution...&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;Create a little FixedToolWindow that looks like this...&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&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/AVvXsEhojuwzaLX0H1_7TSwUAjsa3sGopmPiFggCgtAZyBHkTGckAFHZBZmTBpWTKTWaa2fUqy2HTg9G8XBRojrhMvJvP_V1sCOiaveWjHULGzAdx8OmRFQHhDvslCEk2VPvZMEJ8FzXm0LA0tg/s1600/InputBox.JPG&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/AVvXsEhojuwzaLX0H1_7TSwUAjsa3sGopmPiFggCgtAZyBHkTGckAFHZBZmTBpWTKTWaa2fUqy2HTg9G8XBRojrhMvJvP_V1sCOiaveWjHULGzAdx8OmRFQHhDvslCEk2VPvZMEJ8FzXm0LA0tg/s320/InputBox.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;It needs a label, a text box and two buttons.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
Name your form and controls:&lt;br /&gt;
&lt;br /&gt;
Form - InputBox.&lt;br /&gt;
Caption Label - lblCaption.&lt;br /&gt;
Text Box - txtInputText.&lt;br /&gt;
Ok Button - btnOk.&lt;br /&gt;
Cancel Button - btnCancel.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;lblCaption is used to display any instructions you have for the user, txtInputText for the text to input, btnOk to cause dialogResult.OK to be returned to the calling code and btnCancel to cause DialogResult.Cancel to be returned to the calling code.&lt;br /&gt;
&lt;br /&gt;
Set the form&#39;s AcceptButton and CancelButton properties to btnOk and btnCancel respectively. &lt;br /&gt;
&lt;br /&gt;
You must go to the designer code for the form itself and set the caption label and input text box to public so they will be accessible when you use the form.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;pre style=&quot;background: url(&amp;quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQTjcJ5KDmF9Tx85cTen5YR35tDvJfHTDXcsaPy-WJ4ugXCd8SGkGB3JHyw4iU2r7PHX_3wCupGiBdoZq14UPbxojpmQUPZtPn1PDL-oCJhCe-jLO5Ymb6iHlOJleqVStDGzcc-3mx9D6q/s320/codebg.gif&amp;quot;) repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;     public System.Windows.Forms.Label lblCaption;  
     public System.Windows.Forms.TextBox txtInputText;  
&lt;/code&gt;&lt;/pre&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
Set the DialogResult of btnOk button to &quot;OK&quot;, and the DialogResult of btnCancel button to &quot;Cancel&quot;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;Then use the following code on the form to receive a caption and title to display and default value for the input string...&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;pre style=&quot;background: url(&amp;quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQTjcJ5KDmF9Tx85cTen5YR35tDvJfHTDXcsaPy-WJ4ugXCd8SGkGB3JHyw4iU2r7PHX_3wCupGiBdoZq14UPbxojpmQUPZtPn1PDL-oCJhCe-jLO5Ymb6iHlOJleqVStDGzcc-3mx9D6q/s320/codebg.gif&amp;quot;) repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;   public partial class InputBox : Form  
   {  
     /// &amp;lt;summary&amp;gt;  
     /// Caption for the Input Box  
     /// &amp;lt;/summary&amp;gt;  
     private string Caption;  
     /// &amp;lt;summary&amp;gt;  
     /// Title for the Input Box  
     /// &amp;lt;/summary&amp;gt;  
     private string Title;  
     /// &amp;lt;summary&amp;gt;  
     /// Default text for the Imput Box  
     /// &amp;lt;/summary&amp;gt;  
     private string DefaultText;  
     /// &amp;lt;summary&amp;gt;  
     /// Provides a string based input function to get feedback from the user  
     /// &amp;lt;/summary&amp;gt;  
     /// &amp;lt;param name=&quot;_Caption&quot;&amp;gt;&amp;lt;/param&amp;gt;  
     /// &amp;lt;param name=&quot;_Title&quot;&amp;gt;&amp;lt;/param&amp;gt;  
     /// &amp;lt;param name=&quot;_DefaultText&quot;&amp;gt;&amp;lt;/param&amp;gt;  
     public InputBox(string _Caption, string _Title, string _DefaultText)  
     {  
       InitializeComponent();  
       Caption = _Caption;  
       Title = _Title;  
       DefaultText = _DefaultText;  
     }  
     private void InputBox_Load(object sender, EventArgs e)  
     {  
       this.Text = Title;  
       lblCaption.Text = Caption;  
       txtInputText.Text = DefaultText;  
     }  
   }&amp;nbsp; &lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;You will use it like this...&lt;/div&gt;&lt;br /&gt;
&lt;pre style=&quot;background: url(&amp;quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQTjcJ5KDmF9Tx85cTen5YR35tDvJfHTDXcsaPy-WJ4ugXCd8SGkGB3JHyw4iU2r7PHX_3wCupGiBdoZq14UPbxojpmQUPZtPn1PDL-oCJhCe-jLO5Ymb6iHlOJleqVStDGzcc-3mx9D6q/s320/codebg.gif&amp;quot;) repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;         InputBox inputbox = new InputBox(Caption, Title, DefaultText);  
         DialogResult dlg = inputbox.ShowDialog();  
         if (dlg == DialogResult.OK)  
         {  
           string firstName = inputbox.txtInputText.Text;
         }  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana,sans-serif;&quot;&gt;As you can see it is then pretty simple to use, and has pretty much the same functionality as the vb Input Box control.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/5034578143376026793/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2010/08/inputbox-for-c.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/5034578143376026793'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/5034578143376026793'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2010/08/inputbox-for-c.html' title='InputBox for c#'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhojuwzaLX0H1_7TSwUAjsa3sGopmPiFggCgtAZyBHkTGckAFHZBZmTBpWTKTWaa2fUqy2HTg9G8XBRojrhMvJvP_V1sCOiaveWjHULGzAdx8OmRFQHhDvslCEk2VPvZMEJ8FzXm0LA0tg/s72-c/InputBox.JPG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-723045656848737350</id><published>2010-08-05T11:32:00.000+02:00</published><updated>2010-08-05T11:32:38.324+02:00</updated><title type='text'>The c# and VB.net wars...</title><content type='html'>&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;Why is it that whenever there is a difference in opinion, people tend to get violent and nasty about it?&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;Once upon a time there was Borland GW Basic. That was about 20 or so years ago.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;Do you remember having to number your lines of code? I do, and if that makes me old, then so be it.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;After a little while there was Q Basic from Microsoft. To get any sort of graphical anything, you had to use funny things like any normal keyboard character.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;Microsoft then brought VB version 1 out. While it still was run and compiled in a DOS environment, it actually has a visual element to it that allowed the developer to create a GUI for their apps.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
When windows 3.0 came out, Microsoft came up with VB3. I&#39;m not really sure where VB2 went, but they provided developers with the ability to create apps with niceer looking GUI&#39;s. It wasn&#39;t great, but it worked.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;By this time Borland seemed to have given up on Basic as a language, and came up with C and Delphi.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;C and C++ became known as the elite developer&#39;s language, and Delphi, while being taught in schools, never really made it to the big time.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;As the versions of Windows became bigger and more extensive, so did the VB versions.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;Microsoft went on to VB4, VB5 (very briefly) and then on to VB6. Each version was a little &quot;better&quot; and offered more extensive featured.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;VB6 stuck around for many years, with most C and C++ developers laughing at the VB6 developers because VB didn&#39;t have the complexities that C and C++ had. There was even some guy that asked me what language one of my applications was written in, and when I said VB6, he laughed and said it looked like it. How stupid is that. Can you not write an application in C++ that someone else may not like the look of?&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;If anything VB6 gave a lot of developers what they wanted and needed. Something to create applications quickly and easily with. This is why C and C++ developers laughed at the VB6 crowd. They were, and are still of the opinion that if you cannot control the memory allocations yourself, then you are a moron, and need to learn how to write real applications.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;VB6 had one huge hole in its armor. DLL Hell. I can&#39;t tell you how often I was brought to a shaking rage at having to deal with the problems brought about my this. I even once managed crashed the OS of one of the CEO&#39;s of one of the biggest companies in South Africa, to the point of the OS needing to be re-installed from scratch because one of our dll&#39;s over wrote a newer one. You get my point, I&#39;m sure.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;After the many years that VB6 stuck around, Microsoft came up with their holy grail of ideas on the software development front. They, in theory had come up with a way to get rid of dll hell, and then dot net framework was born.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;VB.net came out as part of the Visual Studio .net suite of development tools. This included a new visual version of C++. Version 1.0 of the framework was cool, but was quickly replaced with version 1.1.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;It tool me a long time to get the hang of VB.net. ADO.net threw me. Call it what you like, but there are far more differences between VB6 and VB.net than there are similarities. Despite the differences, it was kept in the VB suite, probably because if the syntax similarities.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;I do wonder if anyone at Microsoft ever thought about scrapping the VB line, and just moving over to c#. It would have been just as much effort for me to learn c# way back when, instead of VB.net. If anyone can tell me why VB was kept, please do.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;It wasn&#39;t really until version 2.5 of the framework came out that the &quot;c# is better&quot; thing started.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;I currently use both c# and VB.net. I find c# to be a little easier and quicker to develop in. Both can do pretty much exactly the same things, so why keep both?&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt; &lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;I do feel that VB.net will be fazed out over the years, but I doubt it will be any time soon.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;I only started working with c# in late 2007, and was pretty happy with my ability to work with it after only a week or two of using it.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;My current job is at a company that claims to be a VB.net only shop, but there are PHP, c# and VB.net apps here.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;While I do prefer to work in c#, I find that VB.net gets the job done just as well.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;So why this hate for VB.net by c# developers? as far as I know VB.net developers don&#39;t hate c#.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;Some say that they dislike the way functions and subs are started and ended. Others just don&#39;t like the syntax because it is too cluttered or whatever.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;I personally don&#39;t care either way. The way I look at it, is that I am a professional, and I am paid to write software. If my employer wants me to use VB.net, then that is what I will do.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;Apparently c# developers get paid about 30% more than VB.net developers. Really? I&#39;m being paid the same as any c# developer, and I get the job done for my employer.&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;What&#39;s the problem?&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/723045656848737350/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2010/08/c-and-vbnet-wars.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/723045656848737350'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/723045656848737350'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2010/08/c-and-vbnet-wars.html' title='The c# and VB.net wars...'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-6583429861155109360</id><published>2010-07-22T13:31:00.001+02:00</published><updated>2010-07-22T16:06:55.240+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="(417) Expectation Failed"/><title type='text'>(417) Expectation Failed - Twitter and .net aren&#39;t nice to each other</title><content type='html'>&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;I have been writing applications that work with the Twitter API for a few years now. It&#39;s pretty simple, but if you don&#39;t know where to start, you could run into some trouble.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;The first big problem I ran into was the &quot;(417) Expectation Failed&quot; error that Twitter started to return one day out of the blue.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;I was using the Yedda dll to do all of my interaction with the Twitter API, and I didn&#39;t really know how it worked, so I went through it for a while, getting to know it.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;I then got a little frustrated with it, and wrote my own Twitter class to use. I still had the &quot;(417) Expectation Failed&quot; error coming back when I tried to post to the API.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;After a little research, I found out that the API no longer likes the HTTP header with the &quot;100-Continue&quot; value.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;To fix this, I needed to add the following line of code to my method:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&quot;request.ServicePoint.Expect100Continue = false;&quot;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;This fixed my Post code, and I was happy for a little while.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Then my world came crashing down, and the error came back. Again, it was without warning, and I was left scratching my head.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;I went back to Google, and after a few hours searching, I found the solution.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;This is how I did it:&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;     public static String ExecutePostCommand(String url, String UserName, String Password, String data)  
     {  
       HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);   
       request.ServicePoint.Expect100Continue = false;  
       try  
       {  
         if (!String.IsNullOrEmpty(UserName) &amp;amp;&amp;amp; !String.IsNullOrEmpty(Password))  
         {  
           request.Credentials = new NetworkCredential(UserName, Password);  
           request.ContentType = &quot;application/x-www-form-urlencoded&quot;;  
           request.Method = &quot;POST&quot;;  
           byte[] bytes = Encoding.UTF8.GetBytes(data);  
           request.ContentLength = bytes.Length;  
           using (Stream requestStream = request.GetRequestStream())  
           {  
             requestStream.Write(bytes, 0, bytes.Length);  
             //HttpWebResponse response = (HttpWebResponse)request.GetResponse()  
             using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())  
             {  
               using (StreamReader reader = new StreamReader(response.GetResponseStream()))  
               {  
                 return reader.ReadToEnd();  
               }  
             }  
           }  
         }  
       }  
       catch (WebException ex)  
       {  
         if (ex.Response is HttpWebResponse)  
         {  
           if ((ex.Response as HttpWebResponse).StatusCode == HttpStatusCode.NotFound)  
           {  
             return null;  
           }  
         }  
         throw ex;  
       }  
       return null;  
     }  
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;You will see that I am using a HTTPWebRequest in the code. The original Yedda dll used a WebRequest instead.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;My code works now, and I&#39;m happy, that&#39;s until the next little/big API change that makes me pull my already thinning hair out.&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/6583429861155109360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2010/07/417-expectation-failed-twitter-and-net.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/6583429861155109360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/6583429861155109360'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2010/07/417-expectation-failed-twitter-and-net.html' title='(417) Expectation Failed - Twitter and .net aren&#39;t nice to each other'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-3403991648779157188</id><published>2010-06-10T10:31:00.003+02:00</published><updated>2010-06-10T10:52:34.142+02:00</updated><title type='text'>Get mouse location on form no matter what</title><content type='html'>&lt;span style=&quot;font-family:verdana;&quot;&gt;Someone asked me how to get the mouse location on a windows form no matter what controls are on the form.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;A lot of suggestions were made about using the following...&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;Place a label on the form and use the following code in the Mouse Move event on the form.&lt;/span&gt;&lt;span&gt;&lt;br /&gt;&lt;pre style=&quot;font-family: arial; font-size: 12px; border: 1px dashed rgb(204, 204, 204); width: 99%; height: auto; overflow: auto; background: url(&amp;quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQTjcJ5KDmF9Tx85cTen5YR35tDvJfHTDXcsaPy-WJ4ugXCd8SGkGB3JHyw4iU2r7PHX_3wCupGiBdoZq14UPbxojpmQUPZtPn1PDL-oCJhCe-jLO5Ymb6iHlOJleqVStDGzcc-3mx9D6q/s320/codebg.gif&amp;quot;) repeat scroll 0% 0% rgb(240, 240, 240); padding: 0px; color: rgb(0, 0, 0); text-align: left; line-height: 20px;&quot;&gt;&lt;code style=&quot;color: rgb(0, 0, 0); word-wrap: normal;&quot;&gt;   Private Sub Form1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove&lt;br /&gt;   Label1.Text = Cursor.Position.ToString()&lt;br /&gt; End Sub&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;While the code in the Mouse Move event handler will work, there will be a problem in that it will stop working as soon as the mouse moves over a control on the form. This is because the Mouse Move event of the control takes over. Your code is only in the Mouse Move even handler of the form.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;To handle this you could create a Mouse Move even handler for every control on your form, and work out the position of the mouse on the form with some clever code.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;I have to ask... What happens if you have many container controls all full of other controls. Do you really want to have to create a Mouse Move event handler for each one, and then have to work out if the control your cursor is moving over is within a container control?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;My guess is no!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;I have a much simpler solution...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;Add a timer to your form, set the interval property to something like 10 milliseconds, and use the following in a Timer Tick event handler...&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;br /&gt;&lt;pre style=&quot;font-family: arial; font-size: 12px; border: 1px dashed rgb(204, 204, 204); width: 99%; height: auto; overflow: auto; background: url(&amp;quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQTjcJ5KDmF9Tx85cTen5YR35tDvJfHTDXcsaPy-WJ4ugXCd8SGkGB3JHyw4iU2r7PHX_3wCupGiBdoZq14UPbxojpmQUPZtPn1PDL-oCJhCe-jLO5Ymb6iHlOJleqVStDGzcc-3mx9D6q/s320/codebg.gif&amp;quot;) repeat scroll 0% 0% rgb(240, 240, 240); padding: 0px; color: rgb(0, 0, 0); text-align: left; line-height: 20px;&quot;&gt;&lt;code style=&quot;color: rgb(0, 0, 0); word-wrap: normal;&quot;&gt;   Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick &lt;br /&gt;    Label1.Text = Me.PointToClient(Me.MousePosition).ToString() &lt;br /&gt;  End Sub &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;This will give you the position of the mouse cursor on the form, no matter what controls your cursor moves over.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/3403991648779157188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2010/06/get-mouse-location-on-form-no-matter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/3403991648779157188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/3403991648779157188'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2010/06/get-mouse-location-on-form-no-matter.html' title='Get mouse location on form no matter what'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-6409583551092361209</id><published>2010-06-08T10:21:00.019+02:00</published><updated>2013-02-06T17:23:35.444+02:00</updated><title type='text'>Transparent Windows Forms Label Control</title><content type='html'>&lt;span style=&quot;font-family: verdana;&quot;&gt;I was recently asked how to make a windows forms Label control background transparent.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;Being mostly a web app developer, I simply answered that it was easy and all you have to do is set the back color of the label to color.Transparent.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot; tile=&quot;Professional Memory Card Recovery Software - Recover Lost or Deleted Photos in 3 Steps&quot;&gt;
&lt;a href=&quot;http://db09abyb14kh1ismsnt0viuh44.hop.clickbank.net/?tid=HOWTODOTNET&quot; target=&quot;_blank&quot; tile=&quot;Professional Memory Card Recovery Software - Recover Lost or Deleted Photos in 3 Steps&quot;&gt;
&lt;img border=&quot;0&quot; height=&quot;80&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbyahbMR6D5qprqVyTzI1imFKty8VQgmBpvhLd0Y1Oitwb50oI8-qNdRpXaDKWBe0Ba6BqtmqQbRPj63ROgTff0fieN4eRzob3IKNLq28QVe9NVDKNaEJP-BttQalI6LBRo9luI1vMh_4/s320/SD+Card+Recovery.png&quot; width=&quot;320&quot; /&gt;
&lt;/a&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;I tried it, and to my shock and horror, I was wrong. It is not that simple, because that is not the way that .net windows applications render the background of controls.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;The way it works, is that the control (label in my case) will take on the back color of its parent control when you set its back color to Transparent. This is usually the form&#39;s back color, causing any controls under the label will have a nice fat rectangular shape, the same color of its containing control around the contents of the label.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;Some people suggest that you can set the form&#39;s Transparency Key property to the same color as the back color of the label. All that does is make the form transparent so you can see whatever is behind the form through it, where that color is rendered on the form.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;The best solution I came across is to create a new label control in your project...&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;http://www.doogal.co.uk/transparent.php&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;According the the author, there can be a problem in rendering the label in some cases, but it worked out perfectly for me.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;The code is great, but is missing the how to use it part for those of you who don&#39;t know how to implement it.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;To use it...&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;Basically you must create a new class in your application and copy the following code into your class (replace everything created for you with the code):&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;[c#]&lt;/span&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; using System;
using System.Drawing;
using System.Windows.Forms;
namespace WinFormsControls
{
 public class TransparentLabel : Control
 {

   public TransparentLabel()
   {
     TabStop = false;
   }

   protected override CreateParams CreateParams
   {
     get
     {
       CreateParams cp = base.CreateParams;
       cp.ExStyle |= 0x20;
       return cp;
     }
   }
 
   protected override void OnPaintBackground(PaintEventArgs e)
   {
     // do nothing
   }
 
   protected override void OnPaint(PaintEventArgs e)
   {
     using (SolidBrush brush = new SolidBrush(ForeColor))
     {
       e.Graphics.DrawString(Text, Font, brush, -1, 0);
     }
   }
 }
}&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;br /&gt;[VB]&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; Imports System 
Imports System.Drawing 
Imports System.Windows.Forms 
Namespace WinFormsControls 
  Public Class TransparentLabel : Inherits Control 
    Public Sub TransparentLabel() 
      TabStop = False 
    End Sub 
    Protected Overrides ReadOnly Property CreateParams() As CreateParams 
      Get 
        Dim cp As CreateParams = MyBase.CreateParams 
        cp.ExStyle = cp.ExStyle Or &amp;amp;H20 
        Return cp 
      End Get 
    End Property 
    Protected Overrides Sub OnPaintBackground(ByVal e As PaintEventArgs) 
      &#39; do nothing 
    End Sub 
    Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) 
      Using brush As New SolidBrush(ForeColor) 
        e.Graphics.DrawString(Text, Font, brush, -1, 0) 
      End Using 
    End Sub 
  End Class 
End Namespace &lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;Use the control like this:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;[c#]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;; font-size: 11pt; line-height: 111%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;; font-size: 11pt; line-height: 111%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;TransparentLabel lblTrans = new TransparentLabel();
lblTrans.Height = 35;
lblTrans.Width = 35;
lblTrans.Top = 50;
lblTrans.Left = 50;
lblTrans.Text = &quot;l&quot;;
lblTrans.Font = new Font(&quot;Wingdings&quot;, 30);
this.Controls.Add(lblTrans);
lblTrans.Visible = true;
lblTrans.BringToFront();&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;span style=&quot;font-family: &amp;quot;; font-size: 11pt; line-height: 111%;&quot;&gt;[VB]&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;/span&gt;&lt;pre style=&quot;background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;Dim lblTrans As New TransparentLabel()
lblTrans.Height = 35
lblTrans.Width = 35
lblTrans.Top = 50
lblTrans.Left = 50
lblTrans.Text = &quot;l&quot;
lblTrans.Font = New Font(&quot;Wingdings&quot;, 30)
Me.Controls.Add(lblTrans)
lblTrans.Visible = True
lblTrans.BringToFront()&lt;/code&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;; font-size: 12pt; line-height: 111%;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;Remember to include the following at the top of your code window to be able to use the control on your form:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;[c#]&lt;br /&gt;&lt;pre style=&quot;background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; using WinFormsControls;&lt;/code&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;[VB]&lt;br /&gt;&lt;pre style=&quot;background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; Imports YourProjectName.WinFormsControls&lt;/code&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;br /&gt;
If you want to use the control in multiple projects, I would suggest that you add this code to a dll and include the dll in your project.&lt;br /&gt;
&lt;br /&gt;
Happy coding.</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/6409583551092361209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2010/06/transparent-windows-forms-label-control.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/6409583551092361209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/6409583551092361209'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2010/06/transparent-windows-forms-label-control.html' title='Transparent Windows Forms Label Control'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbyahbMR6D5qprqVyTzI1imFKty8VQgmBpvhLd0Y1Oitwb50oI8-qNdRpXaDKWBe0Ba6BqtmqQbRPj63ROgTff0fieN4eRzob3IKNLq28QVe9NVDKNaEJP-BttQalI6LBRo9luI1vMh_4/s72-c/SD+Card+Recovery.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-3652437313450178419</id><published>2010-03-10T09:16:00.001+02:00</published><updated>2010-03-10T14:59:46.294+02:00</updated><title type='text'>Shifting Perspective</title><content type='html'>&lt;span style=&quot;font-family: verdana;&quot;&gt;Software development is an ever changing environment. Projects come and projects go, but one thing that will stay in place, hacking away at the hot keyboard is the poor developer.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;This creature is destined to have blurry vision, carpel tunnel syndrome, and a very high caffeine to blood ratio. This mere mortal is expected to do the impossible in the shortest possible time, without thought to feelings or exhaustion levels.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;Does this wonder of modern society care? No! He thrives on the unknown challenges that are thrown in his direction.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;There is one thing that will always make me cringe.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;The software development manager.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;Nine times out of ten, the software manager comes from a development background himself. He spent hour after hour slapping away at his keyboard, churning out line after line of code, only to have a bug report longer than his arm thrown in his face the day after submitting his code.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;Does he remember the pain, the anguish? Again, No!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;The software development manager, will have challenges of his own. Delivering on time is his primary focus, and if he has a new task that needs to be done “now”, then he will seldom think about the state of the poor developer’s mind while he is churning his code out.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;He will arrive at the side of the developer seemingly out of this air, and demand a shift of focus. This requires the poor long suffering developer, to perform super human feats of the mind in order to focus on this new task that is going to interrupt his thought process.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;Some of the tasks that will have to be performed are:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;1. Re-route his brains neural pathways to be able to focus on his manager’s face instead of his screen and keyboard.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;2. Actually physically have to restrain him self from ripping the said manager’s face off for interrupting him.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;3. Listen and reply when needed to any thing the manager requests.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;4. Ask questions about the new task.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;These go on and on, but the bottom line is that he basically, now has to start thinking about something else that is supposedly more important than his interrupted task. This requires a lot of locating his thinking part of his brain, which was shut down in the process of listening to his manager.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;Once he locates it, he can then start to think about what is needed to start his new task.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;He has to be able to visualize what is needed, so that he can even begin to write any code. The code itself isn’t all that difficult once you get to know it.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;It is the calculations, flows, designs of the GUI, the duplicative code that needs to be centralized, etc.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;There a million and one small little seemingly (on their own) stupid bits of code that together for an application that does wonderful things.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;Interrupt a developer at work at your own peril and cost!&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/3652437313450178419/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2010/03/shifting-perspective.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/3652437313450178419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/3652437313450178419'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2010/03/shifting-perspective.html' title='Shifting Perspective'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-4622429399304784282</id><published>2009-06-23T06:36:00.002+02:00</published><updated>2009-06-23T07:36:03.109+02:00</updated><title type='text'>Simplifying the ExecuteNonQuery Method</title><content type='html'>&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685252&quot;&gt;&lt;span style=&quot;color: rgb(15, 36, 62);&quot; dtid=&quot;2251799813685253&quot;&gt;&lt;span dtid=&quot;2251799813685254&quot;  style=&quot;font-family:Arial;&quot;&gt;&lt;span dtid=&quot;2251799813685255&quot;  style=&quot;font-size:10;&quot;&gt;Tagging onto the last post, I have another  two functions that make my life easier...&lt;o:p dtid=&quot;2251799813685256&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685257&quot;&gt;&lt;span style=&quot;color: rgb(15, 36, 62);font-family:Arial;font-size:10;&quot; dtid=&quot;2251799813685258&quot;  &gt;&lt;o:p dtid=&quot;2251799813685259&quot;&gt;   &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685260&quot;&gt;&lt;span style=&quot;color: rgb(15, 36, 62);&quot; dtid=&quot;2251799813685261&quot;&gt;&lt;span dtid=&quot;2251799813685262&quot;  style=&quot;font-family:Arial;&quot;&gt;&lt;span dtid=&quot;2251799813685263&quot;  style=&quot;font-size:10;&quot;&gt;You still need to pick up a connection string  from your Web.Config for both of these functions:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685260&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(15, 36, 62);&quot; dtid=&quot;2251799813685261&quot;&gt;&lt;span dtid=&quot;2251799813685262&quot;  style=&quot;font-family:Arial;&quot;&gt;&lt;span dtid=&quot;2251799813685263&quot;  style=&quot;font-size:10;&quot;&gt;&lt;o:p dtid=&quot;2251799813685264&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685265&quot;&gt;&lt;span style=&quot;color: rgb(15, 36, 62);font-family:Arial;font-size:10;&quot; dtid=&quot;2251799813685266&quot;  &gt;&lt;o:p dtid=&quot;2251799813685267&quot;&gt;   &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685268&quot;&gt;&lt;span dtid=&quot;2251799813685269&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:blue;&quot; dtid=&quot;2251799813685270&quot;  &gt;Public&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685271&quot; &gt; &lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:blue;&quot; dtid=&quot;2251799813685272&quot;  &gt;static string&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685273&quot; &gt; GetConnectionString()&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Times New Roman&#39;,&#39;serif&#39;;&quot; dtid=&quot;2251799813685274&quot; &gt;&lt;o:p dtid=&quot;2251799813685275&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685276&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;font-size:10;&quot; dtid=&quot;2251799813685277&quot;  &gt;{&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Times New Roman&#39;,&#39;serif&#39;;&quot; dtid=&quot;2251799813685278&quot; &gt;&lt;o:p dtid=&quot;2251799813685279&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685280&quot;&gt;&lt;span dtid=&quot;2251799813685281&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:blue;&quot; dtid=&quot;2251799813685282&quot;  &gt;return&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685283&quot; &gt; System.Configuration.&lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685284&quot; &gt;ConfigurationManager&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685285&quot; &gt;.AppSettings[&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685286&quot; &gt;&quot;sqlConnectionString&quot;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685287&quot; &gt;];&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Times New Roman&#39;,&#39;serif&#39;;&quot; dtid=&quot;2251799813685288&quot; &gt;&lt;o:p dtid=&quot;2251799813685289&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685290&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;font-size:10;&quot; dtid=&quot;2251799813685291&quot;  &gt;}&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685290&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Times New Roman&#39;,&#39;serif&#39;;&quot; dtid=&quot;2251799813685292&quot; &gt;&lt;o:p dtid=&quot;2251799813685293&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685294&quot;&gt;&lt;span style=&quot;color: rgb(15, 36, 62);font-family:Arial;font-size:10;&quot; dtid=&quot;2251799813685295&quot;  &gt;&lt;o:p dtid=&quot;2251799813685296&quot;&gt;   &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685297&quot;&gt;&lt;span style=&quot;color: rgb(15, 36, 62);&quot; dtid=&quot;2251799813685298&quot;&gt;&lt;span dtid=&quot;2251799813685299&quot;  style=&quot;font-family:Arial;&quot;&gt;&lt;span dtid=&quot;2251799813685300&quot;  style=&quot;font-size:10;&quot;&gt;Simplifying the ExecuteNonQuery Method:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685297&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(15, 36, 62);&quot; dtid=&quot;2251799813685298&quot;&gt;&lt;span dtid=&quot;2251799813685299&quot;  style=&quot;font-family:Arial;&quot;&gt;&lt;span dtid=&quot;2251799813685300&quot;  style=&quot;font-size:10;&quot;&gt;&lt;o:p dtid=&quot;2251799813685301&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685302&quot;&gt;&lt;span style=&quot;color: rgb(15, 36, 62);font-family:Arial;font-size:10;&quot; dtid=&quot;2251799813685303&quot;  &gt;&lt;o:p dtid=&quot;2251799813685304&quot;&gt;   &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685305&quot;&gt;&lt;span dtid=&quot;2251799813685306&quot;  style=&quot;font-family:&#39;Courier New&#39;;&quot;&gt;&lt;span dtid=&quot;2251799813685307&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(0, 32, 96);&quot; dtid=&quot;2251799813685308&quot;&gt;     &lt;/span&gt;&lt;span dtid=&quot;2251799813685309&quot;  style=&quot;color:blue;&quot;&gt;public&lt;/span&gt;&lt;span dtid=&quot;2251799813685310&quot; style=&quot;color: rgb(0, 0, 0);&quot;&gt; &lt;/span&gt;&lt;span dtid=&quot;2251799813685311&quot;  style=&quot;color:blue;&quot;&gt;static&lt;/span&gt;&lt;span dtid=&quot;2251799813685312&quot; style=&quot;color: rgb(0, 0, 0);&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175);&quot; dtid=&quot;2251799813685313&quot;&gt;String&lt;/span&gt;&lt;span dtid=&quot;2251799813685314&quot; style=&quot;color: rgb(0, 0, 0);&quot;&gt; ExecuteNonQuery(&lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175);&quot; dtid=&quot;2251799813685315&quot;&gt;String&lt;/span&gt;&lt;span dtid=&quot;2251799813685316&quot; style=&quot;color: rgb(0, 0, 0);&quot;&gt; lvCommand)&lt;o:p dtid=&quot;2251799813685317&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685318&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685319&quot; &gt;&lt;span dtid=&quot;2251799813685320&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685321&quot;&gt;    &lt;/span&gt;{&lt;o:p dtid=&quot;2251799813685322&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685323&quot;&gt;&lt;span dtid=&quot;2251799813685324&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685325&quot; &gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685326&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:green;&quot; dtid=&quot;2251799813685327&quot;  &gt;// This will execute a SQL Command (Update or  Insert Into) and will return the number of records&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685328&quot; &gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685329&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685330&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685331&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685332&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685333&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685334&quot; &gt;String&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685335&quot; &gt; lvReturn = &lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685336&quot; &gt;&quot;0&quot;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685337&quot; &gt;;&lt;o:p dtid=&quot;2251799813685338&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685339&quot;&gt;&lt;span dtid=&quot;2251799813685340&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685341&quot; &gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685342&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:green;&quot; dtid=&quot;2251799813685343&quot;  &gt;// Setup your connection to your  database&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685344&quot; &gt;&lt;o:p dtid=&quot;2251799813685345&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685346&quot;&gt;&lt;span dtid=&quot;2251799813685347&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685348&quot; &gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685349&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685350&quot;&gt;  &lt;/span&gt;SqlConnection&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685351&quot; &gt; cn = &lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:blue;&quot; dtid=&quot;2251799813685352&quot;  &gt;new&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685353&quot; &gt; &lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685354&quot; &gt;SqlConnection&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685355&quot; &gt;(GetConnectionString());&lt;o:p dtid=&quot;2251799813685356&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685357&quot;&gt;&lt;span dtid=&quot;2251799813685358&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685359&quot; &gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685360&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:green;&quot; dtid=&quot;2251799813685361&quot;  &gt;// Create a SQLCommand object&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685362&quot; &gt;&lt;o:p dtid=&quot;2251799813685363&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685364&quot;&gt;&lt;span dtid=&quot;2251799813685365&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685366&quot; &gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685367&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685368&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685369&quot; &gt;SqlCommand&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685370&quot; &gt; lvSQL = &lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:blue;&quot; dtid=&quot;2251799813685371&quot;  &gt;new&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685372&quot; &gt; &lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685373&quot; &gt;SqlCommand&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685374&quot; &gt;(lvCommand, cn);&lt;o:p dtid=&quot;2251799813685375&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685376&quot;&gt;&lt;span dtid=&quot;2251799813685377&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685378&quot; &gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685379&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:blue;&quot; dtid=&quot;2251799813685380&quot;  &gt;try&lt;o:p dtid=&quot;2251799813685381&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685382&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685383&quot; &gt;&lt;span dtid=&quot;2251799813685384&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685385&quot;&gt;        &lt;/span&gt;{&lt;o:p dtid=&quot;2251799813685386&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685387&quot;&gt;&lt;span dtid=&quot;2251799813685388&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685389&quot; &gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685390&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:green;&quot; dtid=&quot;2251799813685391&quot;  &gt;// Open a connection to your  database&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685392&quot; &gt;&lt;o:p dtid=&quot;2251799813685393&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685394&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685395&quot; &gt;&lt;span dtid=&quot;2251799813685396&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685397&quot;&gt;            &lt;/span&gt;cn.Open();&lt;o:p dtid=&quot;2251799813685398&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685399&quot;&gt;&lt;span dtid=&quot;2251799813685400&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685401&quot; &gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685402&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:green;&quot; dtid=&quot;2251799813685403&quot;  &gt;// Execute your query&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685404&quot; &gt;&lt;o:p dtid=&quot;2251799813685405&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685406&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685407&quot; &gt;&lt;span dtid=&quot;2251799813685408&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685409&quot;&gt;            &lt;/span&gt;lvReturn =  lvSQL.ExecuteNonQuery().ToString();&lt;o:p dtid=&quot;2251799813685410&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685411&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685412&quot; &gt;&lt;span dtid=&quot;2251799813685413&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685414&quot;&gt;        &lt;/span&gt;}&lt;o:p dtid=&quot;2251799813685415&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685416&quot;&gt;&lt;span dtid=&quot;2251799813685417&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685418&quot; &gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685419&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:blue;&quot; dtid=&quot;2251799813685420&quot;  &gt;catch&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685421&quot; &gt; (&lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685422&quot; &gt;Exception&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685423&quot; &gt; ex)&lt;o:p dtid=&quot;2251799813685424&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685425&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685426&quot; &gt;&lt;span dtid=&quot;2251799813685427&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685428&quot;&gt;        &lt;/span&gt;{&lt;o:p dtid=&quot;2251799813685429&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685430&quot;&gt;&lt;span dtid=&quot;2251799813685431&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685432&quot; &gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685433&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:green;&quot; dtid=&quot;2251799813685434&quot;  &gt;// If there is an error set lvReturn to  &lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685435&quot; &gt;&lt;span dtid=&quot;2251799813685436&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685437&quot; &gt;&lt;o:p dtid=&quot;2251799813685438&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685439&quot;&gt;&lt;span dtid=&quot;2251799813685440&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685441&quot; &gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685442&quot;&gt;            &lt;/span&gt;lvReturn = &lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685443&quot; &gt;&quot;0&quot;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685444&quot; &gt;;&lt;o:p dtid=&quot;2251799813685445&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685446&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685447&quot; &gt;&lt;span dtid=&quot;2251799813685448&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685449&quot;&gt;        &lt;/span&gt;}&lt;o:p dtid=&quot;2251799813685450&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685451&quot;&gt;&lt;span dtid=&quot;2251799813685452&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685453&quot; &gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685454&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:blue;&quot; dtid=&quot;2251799813685455&quot;  &gt;finally&lt;o:p dtid=&quot;2251799813685456&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685457&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685458&quot; &gt;&lt;span dtid=&quot;2251799813685459&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685460&quot;&gt;        &lt;/span&gt;{&lt;o:p dtid=&quot;2251799813685461&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685462&quot;&gt;&lt;span dtid=&quot;2251799813685463&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685464&quot; &gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685465&quot;&gt;         &lt;/span&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685466&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:green;&quot; dtid=&quot;2251799813685467&quot;  &gt;// Whatever happens, check to see if the  connection is still open and if it is, close it&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685468&quot; &gt;&lt;o:p dtid=&quot;2251799813685469&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685470&quot;&gt;&lt;span dtid=&quot;2251799813685471&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685472&quot; &gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685473&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:blue;&quot; dtid=&quot;2251799813685474&quot;  &gt;if&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685475&quot; &gt; (cn.State != &lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685476&quot; &gt;ConnectionState&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685477&quot; &gt;.Closed)&lt;o:p dtid=&quot;2251799813685478&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685479&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685480&quot; &gt;&lt;span dtid=&quot;2251799813685481&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685482&quot;&gt;            &lt;/span&gt;{&lt;o:p dtid=&quot;2251799813685483&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685484&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685485&quot; &gt;&lt;span dtid=&quot;2251799813685486&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685487&quot;&gt;                &lt;/span&gt;cn.Close();&lt;o:p dtid=&quot;2251799813685488&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685489&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685490&quot; &gt;&lt;span dtid=&quot;2251799813685491&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685492&quot;&gt;            &lt;/span&gt;}&lt;o:p dtid=&quot;2251799813685493&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685494&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685495&quot; &gt;&lt;span dtid=&quot;2251799813685496&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685497&quot;&gt;        &lt;/span&gt;}&lt;o:p dtid=&quot;2251799813685498&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685499&quot;&gt;&lt;span dtid=&quot;2251799813685500&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685501&quot; &gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685502&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:green;&quot; dtid=&quot;2251799813685503&quot;  &gt;// Return the number of records  affected&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685504&quot; &gt;&lt;o:p dtid=&quot;2251799813685505&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685506&quot;&gt;&lt;span dtid=&quot;2251799813685507&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685508&quot; &gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685509&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685510&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:&#39;Courier New&#39;;color:blue;&quot; dtid=&quot;2251799813685511&quot;  &gt;return&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685512&quot; &gt; lvReturn;&lt;o:p dtid=&quot;2251799813685513&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685514&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685515&quot; &gt;&lt;span dtid=&quot;2251799813685516&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;2251799813685517&quot;&gt;    &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685514&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685515&quot; &gt;&lt;span dtid=&quot;2251799813685516&quot;  style=&quot;font-size:10;&quot;&gt;&lt;o:p dtid=&quot;2251799813685518&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685519&quot;&gt;&lt;span style=&quot;color: rgb(15, 36, 62);font-family:Arial;font-size:10;&quot; dtid=&quot;2251799813685520&quot;  &gt;&lt;o:p dtid=&quot;2251799813685521&quot;&gt;   &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685522&quot;&gt;&lt;span style=&quot;color: rgb(15, 36, 62);&quot; dtid=&quot;2251799813685523&quot;&gt;&lt;span dtid=&quot;2251799813685524&quot;  style=&quot;font-family:Arial;&quot;&gt;&lt;span dtid=&quot;2251799813685525&quot;  style=&quot;font-size:10;&quot;&gt;To use the function, call it like this...&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685522&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(15, 36, 62);&quot; dtid=&quot;2251799813685523&quot;&gt;&lt;span dtid=&quot;2251799813685524&quot;  style=&quot;font-family:Arial;&quot;&gt;&lt;span dtid=&quot;2251799813685525&quot;  style=&quot;font-size:10;&quot;&gt;&lt;o:p dtid=&quot;2251799813685526&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685527&quot;&gt;&lt;span style=&quot;color: rgb(15, 36, 62);font-family:Arial;font-size:10;&quot; dtid=&quot;2251799813685528&quot;  &gt;&lt;o:p dtid=&quot;2251799813685529&quot;&gt;   &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685530&quot;&gt;&lt;span dtid=&quot;2251799813685531&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685532&quot; &gt;String&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685533&quot; &gt; lvCommand = &lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685534&quot; &gt;&quot;Update A_Table Set A_Field = &#39;The String&#39;  Where AnotherField = &#39;Another String&#39;&quot;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685535&quot; &gt;;&lt;o:p dtid=&quot;2251799813685536&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685537&quot;&gt;&lt;span dtid=&quot;2251799813685538&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685539&quot; &gt;Int32&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685540&quot; &gt; lvAffectedRowCount = &lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685541&quot; &gt;Int32&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;&quot; dtid=&quot;2251799813685542&quot; &gt;.Parse(ExecuteScalar(lvCommand));&lt;/span&gt;&lt;span style=&quot;color: rgb(15, 36, 62);&quot; dtid=&quot;2251799813685543&quot;&gt;&lt;o:p dtid=&quot;2251799813685544&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685545&quot;&gt;&lt;span style=&quot;color: rgb(15, 36, 62);font-family:Arial;font-size:10;&quot; dtid=&quot;2251799813685546&quot;  &gt;&lt;o:p dtid=&quot;2251799813685547&quot;&gt;   &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685548&quot;&gt;&lt;span style=&quot;color: rgb(15, 36, 62);&quot; dtid=&quot;2251799813685549&quot;&gt;&lt;span dtid=&quot;2251799813685550&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span dtid=&quot;2251799813685551&quot;  style=&quot;font-family:Arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685548&quot;&gt;&lt;span style=&quot;color: rgb(15, 36, 62);&quot; dtid=&quot;2251799813685549&quot;&gt;&lt;span dtid=&quot;2251799813685550&quot;  style=&quot;font-size:10;&quot;&gt;&lt;span dtid=&quot;2251799813685551&quot;  style=&quot;font-family:Arial;&quot;&gt;Again, Pretty simple.&lt;o:p dtid=&quot;2251799813685552&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685553&quot;&gt;&lt;span style=&quot;color: rgb(15, 36, 62);font-family:Arial;font-size:10;&quot; dtid=&quot;2251799813685554&quot;  &gt;&lt;o:p dtid=&quot;2251799813685555&quot;&gt;   &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;2251799813685290&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Courier New&#39;;font-size:10;&quot; dtid=&quot;2251799813685291&quot;  &gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 0);font-family:&#39;Times New Roman&#39;,&#39;serif&#39;;&quot; dtid=&quot;2251799813685292&quot; &gt;&lt;o:p dtid=&quot;2251799813685293&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/4622429399304784282/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2009/06/tagging-onto-last-post-i-have-another.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/4622429399304784282'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/4622429399304784282'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2009/06/tagging-onto-last-post-i-have-another.html' title='Simplifying the ExecuteNonQuery Method'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-3517357334648083336</id><published>2009-06-18T08:06:00.002+02:00</published><updated>2009-06-18T08:43:32.133+02:00</updated><title type='text'>Database Actions that Drive Me Nuts</title><content type='html'>&lt;p style=&quot;margin: 0cm 0cm 10pt;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527876&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: rgb(0, 32, 96); font-family: Arial;&quot; dtid=&quot;3377699720527877&quot;&gt;There are so many actions while writing  software that you have to do over and over and over... again.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 10pt;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527878&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: rgb(0, 32, 96); font-family: Arial;&quot; dtid=&quot;3377699720527879&quot;&gt;Things like opening database connections,  filling a dataset or data table with data from the database, executing a SQL  command and retrieving a scalar value from a database. 99% of the time I write  database driven apps, and I have to do these things all the time. They are so  boring and repetitive!!!&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 10pt;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527880&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: rgb(0, 32, 96); font-family: Arial;&quot; dtid=&quot;3377699720527881&quot;&gt;These small functions help me make these  action tolerable, and quite simple to do:&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 10pt;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527882&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: rgb(0, 32, 96); font-family: Arial;&quot; dtid=&quot;3377699720527883&quot;&gt;There is a small function that these  functions call, called GetConnectionString. This basically gets the connection  string that you set in your Web.Config file.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527884&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527885&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720527886&quot;&gt;&lt;span style=&quot;color: rgb(0, 32, 96);&quot; dtid=&quot;3377699720527887&quot;&gt;     &lt;/span&gt;&lt;span style=&quot;color: blue;&quot; dtid=&quot;3377699720527888&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: windowtext;&quot; dtid=&quot;3377699720527889&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot; dtid=&quot;3377699720527890&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: windowtext;&quot; dtid=&quot;3377699720527891&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot; dtid=&quot;3377699720527892&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: windowtext;&quot; dtid=&quot;3377699720527893&quot;&gt; GetConnectionString()&lt;o:p dtid=&quot;3377699720527894&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527895&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527896&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720527897&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720527898&quot;&gt;    &lt;/span&gt;{&lt;o:p dtid=&quot;3377699720527899&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527900&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720527901&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527902&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720527903&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527904&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527905&quot;&gt; System.Configuration.&lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175); font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527906&quot;&gt;ConfigurationManager&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527907&quot;&gt;.AppSettings[&lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21); font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527908&quot;&gt;&quot;sqlConnectionString&quot;&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527909&quot;&gt;];&lt;o:p dtid=&quot;3377699720527910&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527911&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527912&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720527913&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720527914&quot;&gt;    &lt;/span&gt;}&lt;o:p dtid=&quot;3377699720527915&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 10pt;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527916&quot;&gt;&lt;o:p dtid=&quot;3377699720527917&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: rgb(0, 32, 96); font-family: Arial;&quot;&gt;&lt;/span&gt;  &lt;/o:p&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 10pt;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527918&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: rgb(0, 32, 96); font-family: Arial;&quot; dtid=&quot;3377699720527919&quot;&gt;Simplifying the ExecuteScalar  Method...&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527920&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527921&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720527922&quot;&gt;&lt;span style=&quot;color: rgb(0, 32, 96);&quot; dtid=&quot;3377699720527923&quot;&gt;     &lt;/span&gt;&lt;span style=&quot;color: blue;&quot; dtid=&quot;3377699720527924&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: windowtext;&quot; dtid=&quot;3377699720527925&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot; dtid=&quot;3377699720527926&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: windowtext;&quot; dtid=&quot;3377699720527927&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175);&quot; dtid=&quot;3377699720527928&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: windowtext;&quot; dtid=&quot;3377699720527929&quot;&gt; ExecuteScalar(&lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175);&quot; dtid=&quot;3377699720527930&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: windowtext;&quot; dtid=&quot;3377699720527931&quot;&gt; lvCommand)&lt;o:p dtid=&quot;3377699720527932&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527933&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527934&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720527935&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720527936&quot;&gt;    &lt;/span&gt;{&lt;o:p dtid=&quot;3377699720527937&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527938&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720527939&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527940&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720527941&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527942&quot;&gt;// If a record is found, this will return the  first column of the first row of the found data&lt;o:p dtid=&quot;3377699720527943&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527944&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720527945&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527946&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720527947&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175); font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527948&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527949&quot;&gt; lvReturn = &lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21); font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527950&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527951&quot;&gt;;&lt;o:p dtid=&quot;3377699720527952&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527953&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720527954&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527955&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720527956&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527957&quot;&gt;// Setup your connection to your  database&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527958&quot;&gt;&lt;o:p dtid=&quot;3377699720527959&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527960&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720527961&quot;&gt;&lt;span style=&quot;color: rgb(43, 145, 175); font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527962&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720527963&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720527964&quot;&gt;  &lt;/span&gt;SqlConnection&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527965&quot;&gt; cn = &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527966&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527967&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175); font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527968&quot;&gt;SqlConnection&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527969&quot;&gt;(GetConnectionString());&lt;o:p dtid=&quot;3377699720527970&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527971&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720527972&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527973&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720527974&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527975&quot;&gt;// Create a SQLCommand object&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527976&quot;&gt;&lt;o:p dtid=&quot;3377699720527977&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527978&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720527979&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527980&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720527981&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720527982&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175); font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527983&quot;&gt;SqlCommand&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527984&quot;&gt; lvSQL = &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527985&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527986&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175); font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527987&quot;&gt;SqlCommand&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527988&quot;&gt;(lvCommand, cn);&lt;o:p dtid=&quot;3377699720527989&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527990&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720527991&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527992&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720527993&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527994&quot;&gt;try&lt;o:p dtid=&quot;3377699720527995&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720527996&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720527997&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720527998&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720527999&quot;&gt;        &lt;/span&gt;{&lt;o:p dtid=&quot;3377699720528000&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528001&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528002&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528003&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528004&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528005&quot;&gt;// Open a connection to your  database&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528006&quot;&gt;&lt;o:p dtid=&quot;3377699720528007&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528008&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528009&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528010&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528011&quot;&gt;            &lt;/span&gt;cn.Open();&lt;o:p dtid=&quot;3377699720528012&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528013&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528014&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528015&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528016&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528017&quot;&gt;// Execute your query&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528018&quot;&gt;&lt;o:p dtid=&quot;3377699720528019&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528020&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528021&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528022&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528023&quot;&gt;            &lt;/span&gt;lvReturn =  lvSQL.ExecuteScalar().ToString();&lt;o:p dtid=&quot;3377699720528024&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528025&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528026&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528027&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528028&quot;&gt;        &lt;/span&gt;}&lt;o:p dtid=&quot;3377699720528029&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528030&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528031&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528032&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528033&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528034&quot;&gt;catch&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528035&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175); font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528036&quot;&gt;Exception&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528037&quot;&gt; ex)&lt;o:p dtid=&quot;3377699720528038&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528039&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528040&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528041&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528042&quot;&gt;        &lt;/span&gt;{&lt;o:p dtid=&quot;3377699720528043&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528044&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528045&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528046&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528047&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528048&quot;&gt;// If there is an error set lvReturn to  &lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21); font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528049&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528050&quot;&gt;&lt;o:p dtid=&quot;3377699720528051&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528052&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528053&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528054&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528055&quot;&gt;            &lt;/span&gt;lvReturn = &lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21); font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528056&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528057&quot;&gt;;&lt;o:p dtid=&quot;3377699720528058&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528059&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528060&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528061&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528062&quot;&gt;        &lt;/span&gt;}&lt;o:p dtid=&quot;3377699720528063&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528064&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528065&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528066&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528067&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528068&quot;&gt;finally&lt;o:p dtid=&quot;3377699720528069&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528070&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528071&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528072&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528073&quot;&gt;        &lt;/span&gt;{&lt;o:p dtid=&quot;3377699720528074&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528075&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528076&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528077&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528078&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528079&quot;&gt;// Whatever happens, check to see if the  connection is still open and if it is, close it&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528080&quot;&gt;&lt;o:p dtid=&quot;3377699720528081&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528082&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528083&quot;&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528084&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528085&quot;&gt;            &lt;/span&gt;if&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528086&quot;&gt; (cn.State != &lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175); font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528087&quot;&gt;ConnectionState&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528088&quot;&gt;.Closed)&lt;o:p dtid=&quot;3377699720528089&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528090&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528091&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528092&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528093&quot;&gt;            &lt;/span&gt;{&lt;o:p dtid=&quot;3377699720528094&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528095&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528096&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528097&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528098&quot;&gt;                &lt;/span&gt;cn.Close();&lt;o:p dtid=&quot;3377699720528099&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528100&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528101&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528102&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528103&quot;&gt;            &lt;/span&gt;}&lt;o:p dtid=&quot;3377699720528104&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528105&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528106&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528107&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528108&quot;&gt;        &lt;/span&gt;}&lt;o:p dtid=&quot;3377699720528109&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528110&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528111&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528112&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528113&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528114&quot;&gt;// Return the data that was found or the  empty string is none&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528115&quot;&gt;&lt;o:p dtid=&quot;3377699720528116&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528117&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528118&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528119&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528120&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528121&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528122&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528123&quot;&gt; lvReturn;&lt;o:p dtid=&quot;3377699720528124&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528125&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528126&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528127&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528128&quot;&gt;    &lt;/span&gt;}&lt;o:p dtid=&quot;3377699720528129&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 10pt;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528130&quot;&gt;&lt;o:p dtid=&quot;3377699720528131&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: rgb(0, 32, 96); font-family: Arial;&quot;&gt;&lt;/span&gt;  &lt;/o:p&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 10pt;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528132&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: rgb(0, 32, 96); font-family: Arial;&quot; dtid=&quot;3377699720528133&quot;&gt;To use this function call it like  this...&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528134&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528135&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528136&quot;&gt;&lt;span style=&quot;color: rgb(0, 32, 96);&quot; dtid=&quot;3377699720528137&quot;&gt;     &lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175);&quot; dtid=&quot;3377699720528138&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: windowtext;&quot; dtid=&quot;3377699720528139&quot;&gt; lvCommand = &lt;/span&gt;&lt;span style=&quot;color: rgb(163, 21, 21);&quot; dtid=&quot;3377699720528140&quot;&gt;&quot;Select AdminStatus  From YourTable Where UserName = &#39;SomeName&#39;&quot;&lt;/span&gt;&lt;span style=&quot;color: windowtext;&quot; dtid=&quot;3377699720528141&quot;&gt;;&lt;o:p dtid=&quot;3377699720528142&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 0pt; line-height: normal;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528143&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot; dtid=&quot;3377699720528144&quot;&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528145&quot;&gt;&lt;span style=&quot;&quot; dtid=&quot;3377699720528146&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(43, 145, 175); font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528147&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: windowtext; font-family: &#39;Courier New&#39;;&quot; dtid=&quot;3377699720528148&quot;&gt; lvAdminStatus =  ExecuteScalar(lvCommand);&lt;o:p dtid=&quot;3377699720528149&quot;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 10pt;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528150&quot;&gt;&lt;o:p dtid=&quot;3377699720528151&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: rgb(0, 32, 96); font-family: Arial;&quot;&gt;&lt;/span&gt;  &lt;/o:p&gt;&lt;/p&gt;&lt;p style=&quot;margin: 0cm 0cm 10pt;&quot; class=&quot;MsoNormal&quot; dtid=&quot;3377699720528152&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: rgb(0, 32, 96); font-family: Arial;&quot; dtid=&quot;3377699720528153&quot;&gt;It’s that simple. No having to create your  connection, create your sqlcommand object, open your connection, execute your  command and close your connection every time you want to use the ExecuteScalar  method.&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/3517357334648083336/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2009/06/database-actions-that-drive-me-nuts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/3517357334648083336'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/3517357334648083336'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2009/06/database-actions-that-drive-me-nuts.html' title='Database Actions that Drive Me Nuts'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1569908609926231479.post-4539796334959776614</id><published>2009-01-06T14:01:00.012+02:00</published><updated>2009-01-07T12:01:33.706+02:00</updated><title type='text'>How to - Send a SMTP E-Mail in ASP.Net</title><content type='html'>&lt;span style=&quot;font-family: Tahoma&quot;&gt;&lt;br /&gt; One of the things that a lot of web developers need and want to do, is to send E-Mails from their pages in response to various actions.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;It is pretty easy to do, and I have put a small web page example together to show you how to do it.&lt;br /&gt;&lt;br /&gt;        &lt;strong&gt;[Web Page HTML]&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style=&quot;font-size: 10pt; font-family: Courier&quot;&gt;&lt;br /&gt;        &amp;lt;table style=&amp;quot;font-family: Tahoma; font-size: 8pt&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;tr&amp;gt;&lt;br /&gt;                &amp;lt;td style=&amp;quot;text-align:center&amp;quot;&amp;gt;&lt;br /&gt;                    &amp;lt;a href=&amp;quot;Default.aspx&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;                &amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;/tr&amp;gt;&lt;br /&gt;        &amp;lt;/table&amp;gt;&lt;br /&gt;        &amp;lt;table style=&amp;quot;font-family: Tahoma; font-size: 8pt; width: 550px&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;tr&amp;gt;&lt;br /&gt;                &amp;lt;td style=&amp;quot;width: 550px; text-align: center&amp;quot;&amp;gt;&lt;br /&gt;                    &amp;lt;asp:Label ID=&amp;quot;Label1&amp;quot; runat=&amp;quot;server&amp;quot; Text=&amp;quot;Send E-Mail&amp;quot; style=&amp;quot;font-family: Tahoma; font-size: 16pt&amp;quot;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;                &amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;/tr&amp;gt;&lt;br /&gt;        &amp;lt;/table&amp;gt;&lt;br /&gt;        &amp;lt;table style=&amp;quot;font-family: Tahoma; font-size: 8pt; width: 550px&amp;quot;&amp;gt;&lt;br /&gt;            &amp;lt;tr&amp;gt;&lt;br /&gt;                &amp;lt;td style=&amp;quot;width: 100px&amp;quot;&amp;gt;&lt;br /&gt;                    &amp;lt;asp:Label ID=&amp;quot;lblTo&amp;quot; runat=&amp;quot;server&amp;quot; Text=&amp;quot;To&amp;quot;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;                &amp;lt;/td&amp;gt;&lt;br /&gt;                &amp;lt;td style=&amp;quot;width: 400px&amp;quot;&amp;gt;&lt;br /&gt;                    &amp;lt;asp:TextBox ID=&amp;quot;txtTo&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;                &amp;lt;/td&amp;gt;&lt;br /&gt;                &amp;lt;td&amp;gt;&lt;br /&gt;                    &amp;lt;asp:RequiredFieldValidator ID=&amp;quot;RequiredFieldValidator1&amp;quot; ControlToValidate=&amp;quot;txtTo&amp;quot; runat=&amp;quot;server&amp;quot; ErrorMessage=&amp;quot;Required&amp;quot;&amp;gt;&amp;lt;/asp:RequiredFieldValidator&amp;gt;&lt;br /&gt;                &amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;/tr&amp;gt;            &lt;br /&gt;            &amp;lt;tr&amp;gt;&lt;br /&gt;                &amp;lt;td style=&amp;quot;width: 100px&amp;quot;&amp;gt;&lt;br /&gt;                    &amp;lt;asp:Label ID=&amp;quot;lblSubject&amp;quot; runat=&amp;quot;server&amp;quot; Text=&amp;quot;Subject&amp;quot;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;                &amp;lt;/td&amp;gt;&lt;br /&gt;                &amp;lt;td style=&amp;quot;width: 400px&amp;quot;&amp;gt;&lt;br /&gt;                    &amp;lt;asp:TextBox ID=&amp;quot;txtSubject&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;                &amp;lt;/td&amp;gt;&lt;br /&gt;                &amp;lt;td&amp;gt;&lt;br /&gt;                    &amp;lt;asp:RequiredFieldValidator ID=&amp;quot;RequiredFieldValidator2&amp;quot; ControlToValidate=&amp;quot;txtSubject&amp;quot; runat=&amp;quot;server&amp;quot; ErrorMessage=&amp;quot;Required&amp;quot;&amp;gt;&amp;lt;/asp:RequiredFieldValidator&amp;gt;&lt;br /&gt;                &amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;/tr&amp;gt;            &lt;br /&gt;            &amp;lt;tr&amp;gt;&lt;br /&gt;                &amp;lt;td style=&amp;quot;width: 100px&amp;quot;&amp;gt;&lt;br /&gt;                    &amp;lt;asp:Label ID=&amp;quot;lblMessage&amp;quot; runat=&amp;quot;server&amp;quot; Text=&amp;quot;Message&amp;quot;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;                &amp;lt;/td&amp;gt;&lt;br /&gt;                &amp;lt;td style=&amp;quot;width: 400px&amp;quot;&amp;gt;&lt;br /&gt;                    &amp;lt;asp:TextBox ID=&amp;quot;txtMessage&amp;quot; runat=&amp;quot;server&amp;quot; TextMode=&amp;quot;MultiLine&amp;quot; Rows=&amp;quot;10&amp;quot; style=&amp;quot;width: 100%&amp;quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;                &amp;lt;/td&amp;gt;&lt;br /&gt;                &amp;lt;td&amp;gt;&lt;br /&gt;                    &amp;lt;asp:RequiredFieldValidator ID=&amp;quot;RequiredFieldValidator3&amp;quot; ControlToValidate=&amp;quot;txtMessage&amp;quot; runat=&amp;quot;server&amp;quot; ErrorMessage=&amp;quot;Required&amp;quot;&amp;gt;&amp;lt;/asp:RequiredFieldValidator&amp;gt;&lt;br /&gt;                &amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;/tr&amp;gt;            &lt;br /&gt;            &amp;lt;tr&amp;gt;&lt;br /&gt;                &amp;lt;td style=&amp;quot;width: 100%&amp;quot; colspan=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;                    &amp;lt;asp:Button ID=&amp;quot;btnSend&amp;quot; runat=&amp;quot;server&amp;quot; Text=&amp;quot;Send E-Mail&amp;quot; OnClick=&amp;quot;btnSend_Click&amp;quot; /&amp;gt;&lt;br /&gt;                    &amp;lt;asp:Label ID=&amp;quot;lblStatus&amp;quot; runat=&amp;quot;server&amp;quot; Text=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;                &amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;/tr&amp;gt;            &lt;br /&gt;        &amp;lt;/table&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style=&quot;font-family: Tahoma&quot;&gt;&lt;br /&gt;&lt;br /&gt;This will give you a page with a text box to enter the E-Mail address of the recipient, a subject and a message to be sent.&lt;br /&gt;&lt;br /&gt;Copy and paste it between your page&#39;s opening and closing &quot;form&quot; element.&lt;br /&gt;&lt;br /&gt;Next you will need to use the following code behind examples to make the page send the E-Mails... &lt;/span&gt;&lt;br /&gt;    &lt;span style=&quot;font-family: Tahoma&quot;&gt;&lt;strong&gt;&lt;br /&gt;&lt;br /&gt;[VB Code Behind Example]&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style=&quot;font-size: 10pt; font-family: Courier&quot;&gt;&lt;br /&gt;    Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As System.EventArgs)&lt;br /&gt;        Dim lvFromAddress As String = &quot;Senders_E-MailAddress&quot;&lt;br /&gt;        Dim lvToAddress As String = txtTo.Text&lt;br /&gt;        Dim lvSubject As String = txtSubject.Text&lt;br /&gt;        Dim lvMessage As String = txtMessage.Text&lt;br /&gt;&lt;br /&gt;        lblStatus.Text = SendMail(lvFromAddress, lvToAddress, lvSubject, lvMessage)&lt;br /&gt;    End Sub&lt;br /&gt;&lt;br /&gt;    Private Function SendMail(ByVal FromAddress As String, ByVal ToAddress As String, ByVal Subject As String, ByVal Message As String) As String&lt;br /&gt;        Dim lvReturn As String = &quot;&quot;&lt;br /&gt;        Try&lt;br /&gt;            &#39;create the mail message&lt;br /&gt;            Dim mail As New MailMessage()&lt;br /&gt;            Dim MailServer As String = &quot;localhost&quot;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            &#39;set the addresses&lt;br /&gt;            mail.From = New MailAddress(FromAddress)&lt;br /&gt;            mail.To.Add(ToAddress)&lt;br /&gt;&lt;br /&gt;            &#39;set the content&lt;br /&gt;            mail.Subject = Subject&lt;br /&gt;            mail.Body = Message&lt;br /&gt;            mail.IsBodyHtml = True&lt;br /&gt;&lt;br /&gt;            Dim lvMailSender As New SmtpClient(MailServer)&lt;br /&gt;            lvMailSender.Send(mail)&lt;br /&gt;            lvReturn = &quot;Message sent&quot;&lt;br /&gt;        Catch&lt;br /&gt;            &#39;lvError = Err.Number&lt;br /&gt;            lvReturn = &quot;Error &quot; &amp; Err.Number &amp; &quot; - &quot; &amp; Err.Description&lt;br /&gt;        End Try&lt;br /&gt;&lt;br /&gt;        Return lvReturn&lt;br /&gt;    End Function&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style=&quot;font-family: Tahoma&quot;&gt;&lt;strong&gt;[C# Code Behind Example]&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style=&quot;font-size: 10pt; font-family: Courier&quot;&gt;&lt;br /&gt;    protected void btnSend_Click(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        String lvFromAddress  = &quot;Senders_E-MailAddress&quot;;&lt;br /&gt;        String lvToAddress = txtTo.Text;&lt;br /&gt;        String lvSubject = txtSubject.Text;&lt;br /&gt;        String lvMessage = txtMessage.Text;&lt;br /&gt;&lt;br /&gt;        lblStatus.Text = SendMail(lvFromAddress, lvToAddress, lvSubject, lvMessage);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    protected String SendMail(String FromAddress, String ToAddress, String Subject, String Message)&lt;br /&gt;    {   &lt;br /&gt;        String lvReturn = &quot;&quot;;&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            //create the mail message&lt;br /&gt;            MailMessage mail=new MailMessage();&lt;br /&gt;            String MailServer = &quot;localhost&quot;;&lt;br /&gt;&lt;br /&gt;            //set the addresses&lt;br /&gt;            mail.From = new MailAddress(FromAddress);&lt;br /&gt;            mail.To.Add(ToAddress);&lt;br /&gt;&lt;br /&gt;            //set the content&lt;br /&gt;            mail.Subject = Subject;&lt;br /&gt;            mail.Body = Message;&lt;br /&gt;            mail.IsBodyHtml = true;&lt;br /&gt;&lt;br /&gt;            SmtpClient lvMailSender;&lt;br /&gt;            lvMailSender = new SmtpClient(MailServer);&lt;br /&gt;            lvMailSender.Send(mail);&lt;br /&gt;            lvReturn = &quot;Message sent&quot;;&lt;br /&gt;            return lvReturn;&lt;br /&gt;        }&lt;br /&gt;        catch(Exception ex)&lt;br /&gt;        {&lt;br /&gt;            lvReturn = &quot;Error - &quot; + ex.Message;&lt;br /&gt;            return lvReturn;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style=&quot;font-family: Tahoma&quot;&gt;&lt;br /&gt;Its pretty simple to use.&lt;br /&gt;Please let me know if you have any problems with the code. &lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://howto-dotnet.blogspot.com/feeds/4539796334959776614/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://howto-dotnet.blogspot.com/2009/01/how-to-send-e-mail-in-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/4539796334959776614'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1569908609926231479/posts/default/4539796334959776614'/><link rel='alternate' type='text/html' href='http://howto-dotnet.blogspot.com/2009/01/how-to-send-e-mail-in-aspnet.html' title='How to - Send a SMTP E-Mail in ASP.Net'/><author><name>Quin</name><uri>http://www.blogger.com/profile/11547365761965560572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>