<?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: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-9116576033881093520</id><updated>2011-11-28T06:28:31.697+05:30</updated><title type='text'>.Net Help</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>25</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-7813961193860950430</id><published>2009-01-20T15:57:00.001+05:30</published><updated>2009-01-20T15:57:55.771+05:30</updated><title type='text'>SQL Server 2005 Locking Hints</title><content type='html'>&lt;p&gt;&lt;strong&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Georgia&amp;#39;,&amp;#39;serif&amp;#39;; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN"&gt;ROWLOCK&lt;/span&gt;&lt;/strong&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Georgia&amp;#39;,&amp;#39;serif&amp;#39;; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN"&gt;&lt;br&gt; Use row-level locks when reading or modifying data.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Georgia&amp;#39;,&amp;#39;serif&amp;#39;; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN"&gt;PAGLOCK&lt;/span&gt;&lt;/strong&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Georgia&amp;#39;,&amp;#39;serif&amp;#39;; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN"&gt;&lt;br&gt; Use page-level locks when reading or modifying data.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Georgia&amp;#39;,&amp;#39;serif&amp;#39;; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN"&gt;TABLOCK&lt;/span&gt;&lt;/strong&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Georgia&amp;#39;,&amp;#39;serif&amp;#39;; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN"&gt;&lt;br&gt; Use a table lock when reading or modifying data.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Georgia&amp;#39;,&amp;#39;serif&amp;#39;; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN"&gt;DBLOCK&lt;/span&gt;&lt;/strong&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Georgia&amp;#39;,&amp;#39;serif&amp;#39;; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN"&gt;&lt;br&gt; Use a database lock when reading or modifying data.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Georgia&amp;#39;,&amp;#39;serif&amp;#39;; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN"&gt;UPDLOCK&lt;/span&gt;&lt;/strong&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Georgia&amp;#39;,&amp;#39;serif&amp;#39;; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN"&gt;&lt;br&gt; UPDLOCK reads data without blocking other readers, and update it later with the assurance that the data has not changed since last read.&lt;br&gt;&lt;b&gt;&lt;br&gt;&lt;strong&gt;&lt;span style="FONT-FAMILY: &amp;#39;Georgia&amp;#39;,&amp;#39;serif&amp;#39;"&gt;XLOCK&lt;/span&gt;&lt;/strong&gt;&lt;/b&gt;&lt;br&gt; Use exclusive locks instead of shared locks while reading a table, and use hold locks until the end of the statement or transaction.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Georgia&amp;#39;,&amp;#39;serif&amp;#39;; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN"&gt;HOLDLOCK&lt;/span&gt;&lt;/strong&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Georgia&amp;#39;,&amp;#39;serif&amp;#39;; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN"&gt;&lt;br&gt; Use a hold lock to hold a lock until completion of the transaction, instead of releasing the lock as soon as the required table, row, or data page is no longer required.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Georgia&amp;#39;,&amp;#39;serif&amp;#39;; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN"&gt;NOLOCK&lt;/span&gt;&lt;/strong&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Georgia&amp;#39;,&amp;#39;serif&amp;#39;; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN"&gt;&lt;br&gt; This does not lock any object. This is the default for SELECT operations. It does not apply to INSERT, UPDATE, and DELETE statements.&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="FONT-FAMILY: &amp;#39;Georgia&amp;#39;,&amp;#39;serif&amp;#39;"&gt;&lt;font size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-7813961193860950430?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/7813961193860950430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=7813961193860950430' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/7813961193860950430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/7813961193860950430'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2009/01/sql-server-2005-locking-hints.html' title='SQL Server 2005 Locking Hints'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-1047873436365742411</id><published>2008-11-06T12:29:00.001+05:30</published><updated>2008-11-06T12:29:32.184+05:30</updated><title type='text'>ASP.NET Client Side State Management</title><content type='html'>&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="FONT-FAMILY: Georgia; mso-bidi-font-size: 10.0pt"&gt;&lt;font size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;&lt;a href="http://dotnet.dzone.com/news/aspnet-server-side-state-manag"&gt;http://dotnet.dzone.com/news/aspnet-server-side-state-manag&lt;/a&gt;&lt;/span&gt;&lt;/p&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-1047873436365742411?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/1047873436365742411/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=1047873436365742411' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/1047873436365742411'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/1047873436365742411'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2008/11/aspnet-client-side-state-management.html' title='ASP.NET Client Side State Management'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-5478739240434966861</id><published>2008-11-06T12:28:00.001+05:30</published><updated>2008-11-06T12:28:40.988+05:30</updated><title type='text'>How to launch Window application from C# console application</title><content type='html'>&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;This article is targeted for mid-level programmers who have already worked on C# language. This article uses batch files for demonstration and the reader should have preliminary knowledge of batch files.&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;Sample application describes how to call any Windows application or batch file using a C# console application. This application launches a new process and executes Windows applications in that process.&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;API Used&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;ul style="MARGIN-TOP: 0in" type="disc"&gt; &lt;li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;System.Console.WriteLine()&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;  &lt;li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;System.Diagnostics.Process&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;  &lt;li class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;Process.Start()&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;Step by Step process to create a sample application&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.75in; mso-list: l0 level2 lfo1; tab-stops: list .5in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia; mso-fareast-font-family: Georgia; mso-bidi-font-family: Georgia"&gt;&lt;span style="mso-list: Ignore"&gt;1.&lt;span style="FONT: 7pt &amp;#39;Times New Roman&amp;#39;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;Create a Console project called as InvokeBatchFile.&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.75in; mso-list: l0 level2 lfo1; tab-stops: list .5in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia; mso-fareast-font-family: Georgia; mso-bidi-font-family: Georgia"&gt;&lt;span style="mso-list: Ignore"&gt;2.&lt;span style="FONT: 7pt &amp;#39;Times New Roman&amp;#39;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;Include the following namespce&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Georgia; mso-bidi-font-family: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;Using&lt;/span&gt;&lt;/i&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Georgia; mso-bidi-font-family: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt; &lt;/span&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;System.Diagnostics;&lt;/span&gt;&lt;/i&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.75in; mso-list: l0 level2 lfo1; tab-stops: list .5in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia; mso-fareast-font-family: Georgia; mso-bidi-font-family: Georgia"&gt;&lt;span style="mso-list: Ignore"&gt;3.&lt;span style="FONT: 7pt &amp;#39;Times New Roman&amp;#39;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;Add following code for the Main function&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: teal"&gt;Process&lt;/span&gt; p = &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;try&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; targetDir;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&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;targetDir = &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;.Format(&lt;span style="COLOR: maroon"&gt;@&amp;quot;C:\ CallBatchFile &amp;quot;&lt;/span&gt;);&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&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;p = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: teal"&gt;Process&lt;/span&gt;();&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&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;p.StartInfo.WorkingDirectory = targetDir;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&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;p.StartInfo.FileName = &lt;span style="COLOR: maroon"&gt;&amp;quot;MyBatch.bat&amp;quot;&lt;/span&gt;;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 1in; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;p.StartInfo.Arguments = &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;.Format(&lt;span style="COLOR: maroon"&gt;&amp;quot;C-Sharp Console application&amp;quot;&lt;/span&gt;);&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;p.StartInfo.CreateNoWindow = &lt;span style="COLOR: blue"&gt;false&lt;/span&gt;;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&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;p.Start();&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&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;p.WaitForExit();&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;catch&lt;/span&gt; (&lt;span style="COLOR: teal"&gt;Exception&lt;/span&gt; ex)&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: teal"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="COLOR: maroon"&gt;&amp;quot;Exception Occurred :{0},{1}&amp;quot;&lt;/span&gt;,&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ex.Message, ex.StackTrace.ToString());&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: &amp;#39;Courier New&amp;#39;; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.75in"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;&lt;span style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="FONT-SIZE: 12pt; FONT-FAMILY: Georgia; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;; mso-bidi-font-family: &amp;#39;Times New Roman&amp;#39;; mso-bidi-font-size: 10.0pt; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;br style="PAGE-BREAK-BEFORE: always; mso-special-character: line-break" clear="all"&gt; &lt;/span&gt;&lt;/b&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-5478739240434966861?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/5478739240434966861/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=5478739240434966861' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/5478739240434966861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/5478739240434966861'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2008/11/how-to-launch-window-application-from-c.html' title='How to launch Window application from C# console application'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-1500935275882049903</id><published>2008-11-06T12:27:00.001+05:30</published><updated>2008-11-06T12:27:15.051+05:30</updated><title type='text'>C# Class Generator</title><content type='html'>&lt;div class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt; &lt;div class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Georgia"&gt;&lt;a href="http://www.csharpfriends.com/demos/csharp_class_generator.aspx"&gt;http://www.csharpfriends.com/demos/csharp_class_generator.aspx&lt;/a&gt;&lt;/span&gt;&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-1500935275882049903?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/1500935275882049903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=1500935275882049903' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/1500935275882049903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/1500935275882049903'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2008/11/c-class-generator.html' title='C# Class Generator'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-6555795380718421511</id><published>2008-08-29T12:30:00.001+05:30</published><updated>2008-08-29T12:30:40.960+05:30</updated><title type='text'>Undocumented SQL Server 2000 functions</title><content type='html'>&lt;div lang="EN-US" vlink="purple" link="blue"&gt; &lt;div&gt; &lt;p&gt;&lt;font face="Verdana" size="2"&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;Encryption in SQL server &lt;strong&gt;&lt;b&gt;&lt;font face="Verdana"&gt;&lt;span style="FONT-FAMILY: Verdana"&gt;[pwdencrypt,pwdcompare]&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Verdana" size="2"&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;There are some hidden functions in SQL server through which we can encrypt any string and store the same in the table. This will be very helpful in encrypting the user password and other sensitive user data. Encryption supported by SQL server is one way hash. One way hash is nothing but the string encrypted cannot be decrypted. The only way is to compare values with encrypted string. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;font face="Verdana" size="2"&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-STYLE: italic; FONT-FAMILY: Verdana"&gt;DECLARE @ClearPIN varchar (255)&lt;br&gt;DECLARE @EncryptedPIN varbinary(255)&lt;br&gt; SELECT @ClearPIN = &amp;#39;test&amp;#39;&lt;br&gt;SELECT @EncryptedPIN = &lt;b&gt;&lt;span style="FONT-WEIGHT: bold"&gt;CONVERT&lt;/span&gt;&lt;/b&gt; (varbinary (255), &lt;b&gt;&lt;span style="FONT-WEIGHT: bold"&gt;pwdencrypt&lt;/span&gt;&lt;/b&gt; (@ClearPIN))&lt;br&gt;SELECT &lt;b&gt;&lt;span style="FONT-WEIGHT: bold"&gt;pwdcompare&lt;/span&gt;&lt;/b&gt;(@ClearPIN, @EncryptedPIN, 0) &lt;/span&gt;&lt;/font&gt;&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Verdana" size="2"&gt;&lt;span lang="EN" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;In the above example @EncryptedPIN will store the cipher Text. The data in this string is not the encrypted string instead it will return the hash code of the supplied plain string.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;/div&gt;&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-6555795380718421511?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/6555795380718421511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=6555795380718421511' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/6555795380718421511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/6555795380718421511'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2008/08/undocumented-sql-server-2000-functions.html' title='Undocumented SQL Server 2000 functions'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-846743654110355727</id><published>2008-06-02T19:04:00.000+05:30</published><updated>2008-07-05T12:49:44.517+05:30</updated><title type='text'></title><content type='html'>&lt;P class=western id=jc1m0 style="MARGIN-BOTTOM: 0in"&gt;Now let's get into details. First of all say in our aspx page we need to save the image to the server at the runtime. For this we need to use the stream class to read the file as a byte and then save it to the required path at a particular event. The event can vary from situation to situation. e.g in my project I did this in the page_load event. Some would definitely like to avail this just before producing the report.&lt;/P&gt; &lt;P class=western id=jc1m8 style="MARGIN-TOP: 0.19in; MARGIN-BOTTOM: 0.19in"&gt;Code for storing your Image in to the server&lt;/P&gt; &lt;P id=jc1m9 style="MARGIN-TOP: 0.19in; MARGIN-BOTTOM: 0.19in"&gt;Listing 1&lt;/P&gt; &lt;P id=jc1m52 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m53 face="Courier New, monospace"&gt;&lt;FONT id=jc1m54 size=1&gt;&lt;FONT id=jc1m55 size=1&gt;System.Drawing.Image drawingImage;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m56 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m57 face="Courier New, monospace"&gt;&lt;FONT id=jc1m58 size=2&gt;&lt;FONT id=jc1m59 size=1&gt;&lt;FONT id=jc1m60 color=#000000&gt;drawingImage &lt;/FONT&gt;&lt;FONT id=jc1m61 color=#ff0000&gt;=&lt;/FONT&gt;&lt;FONT id=jc1m62 color=#000000&gt; System.Drawing.Image.FromStream(&lt;/FONT&gt;&lt;FONT id=jc1m63 color=#0000ff&gt;new&lt;/FONT&gt;&lt;FONT id=jc1m64 color=#000000&gt; System.IO.MemoryStream (byteArr));&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m65 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m66 face="Courier New, monospace"&gt;&lt;FONT id=jc1m67 size=2&gt;&lt;FONT id=jc1m68 size=1&gt;&lt;FONT id=jc1m69 color=#0000ff&gt;string&lt;/FONT&gt;&lt;FONT id=jc1m70 color=#000000&gt; strPath;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m71 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m72 face="Courier New, monospace"&gt;&lt;FONT id=jc1m73 size=2&gt;&lt;FONT id=jc1m74 size=1&gt;&lt;FONT id=jc1m75 color=#000000&gt;strPath &lt;/FONT&gt;&lt;FONT id=jc1m76 color=#ff0000&gt;=&lt;/FONT&gt;&lt;FONT id=jc1m77 color=#000000&gt; System.Web.HttpContext.Current.Request.MapPath(&lt;/FONT&gt;&lt;SPAN id=jc1m78 style="BACKGROUND: #e4e4e4"&gt;&lt;FONT id=jc1m79 color=#666666&gt;"path"&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT id=jc1m80 color=#000000&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m81 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m82 face="Courier New, monospace"&gt;&lt;FONT id=jc1m83 size=1&gt;&lt;FONT id=jc1m84 size=1&gt;drawingImage.Save(strPath, System.Drawing.Imaging.ImageFormat.Bmp);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P class=western id=jc1m85 style="MARGIN-TOP: 0.19in; MARGIN-BOTTOM: 0.19in"&gt;After saving the image now its turn for designing the report. For this we need a dataset(xsd) which will store the Image.&lt;/P&gt; &lt;P class=western id=jc1m86 style="MARGIN-TOP: 0.19in; MARGIN-BOTTOM: 0.19in"&gt;For this add a dataset to your project. Create a datatable inside your dataset and add a column to the datatable for storing the image.One thing to note here is the datatype for the column. It should be System.Byte[].&lt;/P&gt; &lt;P id=jc1m87 style="MARGIN-TOP: 0.19in; MARGIN-BOTTOM: 0.19in"&gt;Figure 1&lt;/P&gt; &lt;P class=western id=jc1m88 style="MARGIN-TOP: 0.19in; MARGIN-BOTTOM: 0.19in"&gt;&lt;IMG id=jc1m89 height=326 src="http://docs.google.com/File?id=drc9xst_10hq2wjtgw" width=448 align=bottom border=0 name=graphics1&gt;&lt;/P&gt; &lt;P class=western id=jc1m90 style="MARGIN-TOP: 0.19in; MARGIN-BOTTOM: 0.19in"&gt;After Creating the DataSet we can start on designing the report. Open the Crystal report, add the DataTable to the database fields of your report and then drag and drop the image field to the report.&lt;/P&gt; &lt;P class=western id=jc1m91 style="MARGIN-TOP: 0.19in; MARGIN-BOTTOM: 0.19in"&gt;Now for populating the datatable with the data at the runtime we will have a function inside a class that takes one paramater i.e the Image that needs to be displayed and using the data row we will add it to the datatable and finally return the datatable.&lt;/P&gt; &lt;P class=western id=jc1m92 style="MARGIN-TOP: 0.19in; MARGIN-BOTTOM: 0.19in"&gt;Now for displaying it actually in the report, set the datasource of the crystal report with the data table. The below code demonstrates this.&lt;/P&gt; &lt;P class=western id=jc1m93 style="MARGIN-TOP: 0.19in; MARGIN-BOTTOM: 0.19in"&gt;Code for setting the datasource of the Crystal Report &lt;/P&gt; &lt;P id=jc1m94 style="MARGIN-TOP: 0.19in; MARGIN-BOTTOM: 0.19in"&gt;Listing 2&lt;/P&gt; &lt;P id=jc1m95 style="MARGIN-TOP: 0.19in; MARGIN-BOTTOM: 0.19in"&gt; &lt;P id=jc1m122 style="MARGIN-BOTTOM: 0in"&gt;&lt;/P&gt;C#&lt;/P&gt; &lt;P id=jc1m131 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m132 face="Courier New, monospace"&gt;&lt;FONT id=jc1m133 size=2&gt;&lt;FONT id=jc1m134 size=1&gt;&lt;FONT id=jc1m135 color=#000000&gt;ReportDocument rptTest1 &lt;/FONT&gt;&lt;FONT id=jc1m136 color=#ff0000&gt;=&lt;/FONT&gt; &lt;FONT id=jc1m138 color=#0000ff&gt;new&lt;/FONT&gt;&lt;FONT id=jc1m139 color=#000000&gt; ReportDocument();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m140 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m141 face="Courier New, monospace"&gt;&lt;FONT id=jc1m142 size=2&gt;&lt;FONT id=jc1m143 size=1&gt;&lt;FONT id=jc1m144 color=#000000&gt;rptTest1.Load(System.Web.HttpContext.Current.Request.MapPath(&lt;/FONT&gt;&lt;SPAN id=jc1m145 style="BACKGROUND: #e4e4e4"&gt;&lt;FONT id=jc1m146 color=#666666&gt;"App_Reports/rptpic1.rpt"&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT id=jc1m147 color=#000000&gt;));&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m148 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m149 face="Courier New, monospace"&gt;&lt;FONT id=jc1m150 size=2&gt;&lt;FONT id=jc1m151 size=1&gt;&lt;FONT id=jc1m152 color=#000000&gt;rptTest1.Database.Tables[&lt;/FONT&gt;&lt;SPAN id=jc1m153 style="BACKGROUND: #e4e4e4"&gt;&lt;FONT id=jc1m154 color=#666666&gt;"Images"&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT id=jc1m155 color=#000000&gt;].SetDataSource(rptTest.ImageTable(System.Web.HttpContext.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m156 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m157 face="Courier New, monospace"&gt;&lt;FONT id=jc1m158 size=2&gt;&lt;FONT id=jc1m159 size=1&gt;&lt;FONT id=jc1m160 color=#000000&gt;Current.Request.MapPath(&lt;/FONT&gt;&lt;SPAN id=jc1m161 style="BACKGROUND: #e4e4e4"&gt;&lt;FONT id=jc1m162 color=#666666&gt;"App_Data/test1.bmp"&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT id=jc1m163 color=#000000&gt;)));&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P class=western id=jc1m164 style="MARGIN-TOP: 0.19in; MARGIN-BOTTOM: 0.19in"&gt;Code for filling the data table with the Image&lt;/P&gt; &lt;P id=jc1m165 style="MARGIN-TOP: 0.19in; MARGIN-BOTTOM: 0.19in"&gt;Listing 3&lt;/P&gt; &lt;P id=jc1m166 style="MARGIN-TOP: 0.19in; MARGIN-BOTTOM: 0.19in"&gt; &lt;P id=jc1m321 style="MARGIN-BOTTOM: 0in"&gt;&lt;/P&gt;C#&lt;/P&gt; &lt;P id=jc1m329 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m330 face="Courier New, monospace"&gt;&lt;FONT id=jc1m331 size=2&gt;&lt;FONT id=jc1m332 size=1&gt;&lt;FONT id=jc1m333 color=#0000ff&gt;public&lt;/FONT&gt; &lt;FONT id=jc1m335 color=#0000ff&gt;class&lt;/FONT&gt;&lt;FONT id=jc1m336 color=#000000&gt; rptTest&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m337 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m338 face="Courier New, monospace"&gt;&lt;FONT id=jc1m339 size=1&gt;&lt;FONT id=jc1m340 size=1&gt;{&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m341 style="MARGIN-BOTTOM: 0in"&gt;  &lt;FONT id=jc1m343 face="Courier New, monospace"&gt;&lt;FONT id=jc1m344 size=2&gt;&lt;FONT id=jc1m345 size=1&gt;&lt;FONT id=jc1m346 color=#0000ff&gt;public&lt;/FONT&gt; &lt;FONT id=jc1m348 color=#0000ff&gt;static&lt;/FONT&gt;&lt;FONT id=jc1m349 color=#000000&gt; DataTable ImageTable(&lt;/FONT&gt;&lt;FONT id=jc1m350 color=#0000ff&gt;string&lt;/FONT&gt;&lt;FONT id=jc1m351 color=#000000&gt; ImageFile)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m352 style="MARGIN-BOTTOM: 0in"&gt;  &lt;FONT id=jc1m353 face="Courier New, monospace"&gt;&lt;FONT id=jc1m354 size=1&gt;&lt;FONT id=jc1m355 size=1&gt;{&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m356 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m357 color=#000000&gt;    &lt;FONT id=jc1m358 face="Courier New, monospace"&gt;&lt;FONT id=jc1m359 size=2&gt;&lt;FONT id=jc1m360 size=1&gt;&lt;FONT id=jc1m361 size=1&gt;DataTable data &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT id=jc1m362 color=#ff0000&gt;=&lt;/FONT&gt;&lt;FONT id=jc1m363 color=#000000&gt; newDataTable();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m364 style="MARGIN-BOTTOM: 0in"&gt;    &lt;FONT id=jc1m365 face="Courier New, monospace"&gt;&lt;FONT id=jc1m366 size=1&gt;&lt;FONT id=jc1m367 size=1&gt;DataRow row;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m368 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m369 color=#000000&gt;    &lt;FONT id=jc1m370 face="Courier New, monospace"&gt;&lt;FONT id=jc1m371 size=2&gt;&lt;FONT id=jc1m372 size=1&gt;&lt;FONT id=jc1m373 size=1&gt;data.TableName &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT id=jc1m374 color=#ff0000&gt;=&lt;/FONT&gt; &lt;SPAN id=jc1m376 style="BACKGROUND: #e4e4e4"&gt;&lt;FONT id=jc1m377 color=#666666&gt;"Images"&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT id=jc1m378 color=#000000&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m379 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m380 color=#000000&gt;    &lt;FONT id=jc1m381 face="Courier New, monospace"&gt;&lt;FONT id=jc1m382 size=2&gt;&lt;FONT id=jc1m383 size=1&gt;&lt;FONT id=jc1m384 size=1&gt;data.Columns.Add(&lt;/FONT&gt;&lt;/FONT&gt;&lt;SPAN id=jc1m385 style="BACKGROUND: #e4e4e4"&gt;&lt;FONT id=jc1m386 color=#666666&gt;"img"&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT id=jc1m387 color=#000000&gt;, System.Type.GetType(&lt;/FONT&gt;&lt;SPAN id=jc1m388 style="BACKGROUND: #e4e4e4"&gt;&lt;FONT id=jc1m389 color=#666666&gt;"System.Byte[]"&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT id=jc1m390 color=#000000&gt;));&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m391 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m392 color=#000000&gt;    &lt;FONT id=jc1m393 face="Courier New, monospace"&gt;&lt;FONT id=jc1m394 size=2&gt;&lt;FONT id=jc1m395 size=1&gt;&lt;FONT id=jc1m396 size=1&gt;FileStream fs &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT id=jc1m397 color=#ff0000&gt;=&lt;/FONT&gt; &lt;FONT id=jc1m399 color=#0000ff&gt;new&lt;/FONT&gt;&lt;FONT id=jc1m400 color=#000000&gt; FileStream(ImageFile, FileMode.Open);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m401 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m402 color=#000000&gt;    &lt;FONT id=jc1m403 face="Courier New, monospace"&gt;&lt;FONT id=jc1m404 size=2&gt;&lt;FONT id=jc1m405 size=1&gt;&lt;FONT id=jc1m406 size=1&gt;BinaryReader br &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT id=jc1m407 color=#ff0000&gt;=&lt;/FONT&gt; &lt;FONT id=jc1m409 color=#0000ff&gt;new&lt;/FONT&gt;&lt;FONT id=jc1m410 color=#000000&gt; BinaryReader(fs);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m411 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m412 color=#000000&gt;    &lt;FONT id=jc1m413 face="Courier New, monospace"&gt;&lt;FONT id=jc1m414 size=2&gt;&lt;FONT id=jc1m415 size=1&gt;&lt;FONT id=jc1m416 size=1&gt;row &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT id=jc1m417 color=#ff0000&gt;=&lt;/FONT&gt;&lt;FONT id=jc1m418 color=#000000&gt; data.NewRow();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m419 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m420 color=#000000&gt;    &lt;FONT id=jc1m421 face="Courier New, monospace"&gt;&lt;FONT id=jc1m422 size=2&gt;&lt;FONT id=jc1m423 size=1&gt;&lt;FONT id=jc1m424 size=1&gt;row[0] &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT id=jc1m425 color=#ff0000&gt;=&lt;/FONT&gt;&lt;FONT id=jc1m426 color=#000000&gt; br.ReadBytes(br.BaseStream.Length);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m427 style="MARGIN-BOTTOM: 0in"&gt;    &lt;FONT id=jc1m428 face="Courier New, monospace"&gt;&lt;FONT id=jc1m429 size=1&gt;&lt;FONT id=jc1m430 size=1&gt;data.Rows.Add(row);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m431 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m432 color=#000000&gt;    &lt;FONT id=jc1m433 face="Courier New, monospace"&gt;&lt;FONT id=jc1m434 size=2&gt;&lt;FONT id=jc1m435 size=1&gt;&lt;FONT id=jc1m436 size=1&gt;br &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT id=jc1m437 color=#ff0000&gt;=&lt;/FONT&gt; &lt;FONT id=jc1m439 color=#0000ff&gt;null&lt;/FONT&gt;&lt;FONT id=jc1m440 color=#000000&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m441 style="MARGIN-BOTTOM: 0in"&gt;    &lt;FONT id=jc1m442 face="Courier New, monospace"&gt;&lt;FONT id=jc1m443 size=1&gt;&lt;FONT id=jc1m444 size=1&gt;fs.Close();&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m445 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m446 color=#000000&gt;    &lt;FONT id=jc1m447 face="Courier New, monospace"&gt;&lt;FONT id=jc1m448 size=2&gt;&lt;FONT id=jc1m449 size=1&gt;&lt;FONT id=jc1m450 size=1&gt;fs &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT id=jc1m451 color=#ff0000&gt;=&lt;/FONT&gt; &lt;FONT id=jc1m453 color=#0000ff&gt;null&lt;/FONT&gt;&lt;FONT id=jc1m454 color=#000000&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m455 style="MARGIN-BOTTOM: 0in"&gt;    &lt;FONT id=jc1m457 face="Courier New, monospace"&gt;&lt;FONT id=jc1m458 size=2&gt;&lt;FONT id=jc1m459 size=1&gt;&lt;FONT id=jc1m460 color=#0000ff&gt;return&lt;/FONT&gt;&lt;FONT id=jc1m461 color=#000000&gt; data;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m462 style="MARGIN-BOTTOM: 0in"&gt;  &lt;FONT id=jc1m463 face="Courier New, monospace"&gt;&lt;FONT id=jc1m464 size=1&gt;&lt;FONT id=jc1m465 size=1&gt;}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P id=jc1m466 style="MARGIN-BOTTOM: 0in"&gt;&lt;FONT id=jc1m467 face="Courier New, monospace"&gt;&lt;FONT id=jc1m468 size=1&gt;&lt;FONT id=jc1m469 size=1&gt;}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P class=western id=jc1m470 style="MARGIN-TOP: 0.19in; MARGIN-BOTTOM: 0.19in"&gt;When the program runs, the image gets added up to the data table and then is pulled up by the crystal report without any database overhead.&lt;/P&gt; &lt;P class=western id=jc1m471 style="MARGIN-BOTTOM: 0in"&gt;&lt;BR id=jc1m472&gt;&lt;/P&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-846743654110355727?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/846743654110355727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=846743654110355727' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/846743654110355727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/846743654110355727'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2008/06/now-lets-get-into-details.html' title=''/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-7548078468492596965</id><published>2008-02-20T10:05:00.001+05:30</published><updated>2008-02-20T10:05:08.285+05:30</updated><title type='text'>Remove Spaces From String</title><content type='html'>&lt;div id="1emx" class="ArwC7c ckChnd"&gt;&lt;span&gt;&lt;strong&gt;&lt;em&gt;using System.Text.RegularExpressions;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;&lt;strong&gt;&lt;em&gt;&lt;br&gt;private string RemoveSpaces(string str)&lt;br&gt;{&lt;br&gt; string result = &amp;quot;&amp;quot;;&lt;br&gt; Regex regulEx = new Regex(@&amp;quot;[\s]+&amp;quot;);&lt;br&gt;   result = regulEx.Replace(str,&amp;quot; &amp;quot;);&lt;br&gt; return result;&lt;br&gt;}&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt; &lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-7548078468492596965?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/7548078468492596965/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=7548078468492596965' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/7548078468492596965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/7548078468492596965'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2008/02/remove-spaces-from-string.html' title='Remove Spaces From String'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-8117979491082853664</id><published>2008-02-07T17:15:00.002+05:30</published><updated>2008-07-25T15:11:48.604+05:30</updated><title type='text'>Understanding XSD Schema</title><content type='html'>&lt;b&gt;&lt;span class="clsTitle"&gt;Introduction&lt;/span&gt;&lt;/b&gt; &lt;table align="right"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div id="oc_banner"&gt;&lt;img height="0" src="http://banner-a.oddcast.com/track/affId=216987/bannerId=157/promoId=12755/doc=15seconds.com/issue/track.txt?rnd=7802083" width="0" /&gt;&lt;/div&gt;&lt;img height="1" src="http://mjxads.internet.com/RealMedia/ads/adstream_lx.cgi/intm/webdev/www.15seconds.com/focus/xml/2020470305/flex/OasDefault/Oddcast_SitePal_Q108_1w/oddcastsitepalq407devrocbob.html/64326433393539623437613833353330?_RM_EMPTY_" width="1" /&gt;&lt;noscript&gt;&lt;a href="http://63.236.18.118/RealMedia/ads/click_nx.ads/intm/webdev/www.15seconds.com@468x60-1,468x60-2,house_ribbon,ciu,flex,accessunit,accessunit_one,accessunit_two,accessunit_three,cp1,cp2,cp3,cp4,cp5,cp6,cp7,cp8,cp9,cp10,cp11,cp12,cp13,marketplace01,marketplace02,marketplace03,marketplace04,marketplace05,marketplace06,marketplace07,marketplace08,marketplace09,marketplace10!flex"&gt;&lt;img src="http://63.236.18.118/RealMedia/ads/adstream_nx.ads/intm/webdev/www.15seconds.com@468x60-1,468x60-2,house_ribbon,ciu,flex,accessunit,accessunit_one,accessunit_two,accessunit_three,cp1,cp2,cp3,cp4,cp5,cp6,cp7,cp8,cp9,cp10,cp11,cp12,cp13,marketplace01,marketplace02,marketplace03,marketplace04,marketplace05,marketplace06,marketplace07,marketplace08,marketplace09,marketplace10!flex" border="0" alt="flex" /&gt;&lt;/a&gt;&lt;/noscript&gt; &lt;img height="1" src="http://mjxads.internet.com/RealMedia/ads/adstream_lx.cgi/intm/webdev/www.15seconds.com/focus/xml/1108669246/accessunit/OasDefault/Oracle_SMB_GEMS_1o/oracle_au_ebook.html/64326433393539623437613833353330?_RM_EMPTY_" width="1" /&gt;&lt;noscript&gt;&lt;a href="http://63.236.18.118/RealMedia/ads/click_nx.ads/intm/webdev/www.15seconds.com@468x60-1,468x60-2,house_ribbon,ciu,flex,accessunit,accessunit_one,accessunit_two,accessunit_three,cp1,cp2,cp3,cp4,cp5,cp6,cp7,cp8,cp9,cp10,cp11,cp12,cp13,marketplace01,marketplace02,marketplace03,marketplace04,marketplace05,marketplace06,marketplace07,marketplace08,marketplace09,marketplace10!accessunit"&gt;&lt;img src="http://63.236.18.118/RealMedia/ads/adstream_nx.ads/intm/webdev/www.15seconds.com@468x60-1,468x60-2,house_ribbon,ciu,flex,accessunit,accessunit_one,accessunit_two,accessunit_three,cp1,cp2,cp3,cp4,cp5,cp6,cp7,cp8,cp9,cp10,cp11,cp12,cp13,marketplace01,marketplace02,marketplace03,marketplace04,marketplace05,marketplace06,marketplace07,marketplace08,marketplace09,marketplace10!accessunit" border="0" alt="accessunit" /&gt;&lt;/a&gt;&lt;/noscript&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span class="clsBlurb"&gt;&lt;p&gt;Those who deal with data transfer or document exchange within or across organizations with heterogeneous platforms will certainly accept and appreciate the need and power of XML. I am not going to delve into the merits of XML. I will, however, address a simple but powerful schema concept called XSD or XML Schema Definition. &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;What is XSD Schema? &lt;/li&gt;&lt;li&gt;What are the advantages of XSD Schema? &lt;/li&gt;&lt;li&gt;What is important in XSD Schema? &lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="clsTitle"&gt;What Is a Schema?&lt;/span&gt;&lt;/b&gt; &lt;p&gt;&lt;span class="clsBlurb"&gt;A schema is a "Structure", and the actual document or data that is represented through the schema is called "Document Instance". Those who are familiar with relational databases can map a schema to a Table Structure and a Document Instance to a record in a Table. And those who are familiar with object-oriented technology can map a schema to a Class Definition and map a Document Instance to an Object Instance. &lt;/p&gt;&lt;/span&gt;&lt;p&gt;A structure of an XML document can be defined as follows: &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Document Type Definition (DTDs) &lt;/li&gt;&lt;li&gt;XML Schema Definition (XSD) &lt;/li&gt;&lt;li&gt;XML Data Reduced (XDR) -proprietary to Microsoft Technology &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;We are specifically going to work with XML Schema Definitions (XSD). &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span class="clsTitle"&gt;What Is XSD?&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="clsBlurb"&gt;XSD provides the syntax and defines a way in which elements and attributes can be represented in a XML document. It also advocates that the given XML document should be of a specific format and specific data type. &lt;/p&gt;&lt;/span&gt;&lt;p&gt;XSD is fully recommended by W3C consortium as a standard for defining an XML Document. To know more about latest information on XSD, please refer the W3C site&lt;span class="clsBlurb"&gt;(&lt;a href="http://www.w3.org/"&gt;http://www.w3.org/&lt;/a&gt;).&lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span class="clsTitle"&gt;Advantages of XSD&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="clsBlurb"&gt;So what is the benefit of this XSD Schema? &lt;/p&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;XSD Schema is an XML document so there is no real need to learn any new syntax, unlike DTDs. &lt;p&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;XSD Schema supports Inheritance, where one schema can inherit from another schema. This is a great feature because it provides the opportunity for re-usability. &lt;p&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;XSD schema provides the ability to define own data type from the existing data type. &lt;p&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;XSD schema provides the ability to specify data types for both elements and attributes.&lt;/li&gt;&lt;/ul&gt;For more information &lt;a href="http://www.15seconds.com/issue/031209.htm"&gt;Click Here&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-8117979491082853664?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/8117979491082853664/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=8117979491082853664' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/8117979491082853664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/8117979491082853664'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2008/02/understanding-xsd-schema.html' title='Understanding XSD Schema'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-2023236671804352007</id><published>2008-01-25T11:06:00.001+05:30</published><updated>2008-01-25T11:06:15.115+05:30</updated><title type='text'>Different Options for Importing Data into SQL Server</title><content type='html'>&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;In addition to using the Import / Export wizards and/or DTS or SSIS to move data into SQL Server there are also a few other options for doing this that are built into SQL Server.&amp;nbsp; Some these other options include &lt;b&gt;bcp&lt;/b&gt;,&lt;b&gt; BULK INSERT&lt;/b&gt;, &lt;b&gt;OPENROWSET&lt;/b&gt; as well as others.&amp;nbsp; The following examples show you some of these different options for importing data and how you can use some of these inline with your T-SQL code as well as others that can be run from the command line.&lt;br&gt;&lt;br&gt;&lt;b&gt;BCP&lt;br&gt;&lt;/b&gt;&lt;/font&gt;&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;This is one of the options that is mostly widely used.&amp;nbsp; One reason for this is that it has been around for awhile, so DBAs have come quite familiar with this command.&amp;nbsp; This command allows you to both import and export data, but is primarily used for text data formats.&amp;nbsp; In addition, this command is generally run from a Windows command prompt, but could also be called from a stored procedure by using xp_cmdshell or called from a DTS or SSIS package.&lt;/font&gt; &lt;p&gt;&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;Here is a simple command for importing data from file C:\ImportData.txt into table dbo.ImportTest.&lt;/font&gt;&lt;/p&gt; &lt;p style="margin-left: 40px;"&gt;&lt;font color="#0000ff" face="Courier New" size="2"&gt;bcp dbo.ImportTest in &amp;#39;C:\ImportData.txt&amp;#39; -T -SserverName\instanceName&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;&lt;b&gt;BULK INSERT&lt;/b&gt;&lt;br&gt; This command is a T-SQL command that allows you to import data directly from within SQL Server by using T-SQL.&amp;nbsp; This command imports data from file C:\ImportData.txt into table dbo.ImportTest.&lt;/font&gt;&lt;/p&gt;&lt;p style="margin-left: 40px;"&gt;&lt;font color="#0000ff" face="Courier New" size="2"&gt;BULK INSERT dbo.ImportTest &lt;br&gt;FROM &amp;#39;C:\ImportData.txt&amp;#39; &lt;br&gt;WITH ( FIELDTERMINATOR =&amp;#39;,&amp;#39;, FIRSTROW = 2 )&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;&lt;font color="#000000"&gt;&lt;font size="2"&gt;&lt;font face="Verdana, Geneva, Arial, Helvetica, sans-serif"&gt;OPENROWSET&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;br&gt;&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;This command is a T-SQL command that allows you to query data from other data sources directly from within SQL Server.&amp;nbsp; By using this command along with an INSERT INTO command we can load data from the specified data source into a SQL Server table.&lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;This command will pull in all data from worksheet [Sheet1$]. By using the INSERT INTO command you can insert the query results into table dbo.ImportTest.&lt;/font&gt;&lt;/p&gt; &lt;div style="margin-left: 40px;"&gt;&lt;font color="#0000ff" face="Courier New" size="2"&gt;INSERT INTO dbo.ImportTest &lt;/font&gt;&lt;br&gt;&lt;font color="#0000ff" face="Courier New" size="2"&gt;SELECT * FROM OPENROWSET(&amp;#39;Microsoft.Jet.OLEDB.4.0&amp;#39;, &lt;/font&gt;&lt;br&gt; &lt;font color="#0000ff" face="Courier New" size="2"&gt;&amp;#39;Excel 8.0;Database=C:\ImportData.xls&amp;#39;, [Sheet1$])&lt;/font&gt;&lt;/div&gt; &lt;p&gt;&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;Here is another example where data is pulled from worksheet [Sheet1$] by using a SELECT * FROM command. Again, by using the INSERT INTO command you can insert the query results into table dbo.ImportTest.&amp;nbsp;&amp;nbsp; The query can be any valid SQL query, so you can filter the columns and rows by using this option.&lt;/font&gt;&lt;/p&gt; &lt;p style="margin-left: 40px;"&gt;&lt;font color="#0000ff" face="Courier New" size="2"&gt;INSERT INTO dbo.ImportTest &lt;br&gt;SELECT * FROM OPENROWSET(&amp;#39;Microsoft.Jet.OLEDB.4.0&amp;#39;, &lt;br&gt;&amp;#39;Excel 8.0;Database=C:\ImportData.xls&amp;#39;, &amp;#39;SELECT * FROM [Sheet1$]&amp;#39;)&lt;/font&gt;&lt;/p&gt;    &lt;b&gt;OPENDATASOURCE&lt;br&gt;&lt;/b&gt;&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;This command is a T-SQL command that allows you to query data from other data sources directly from within SQL Server. This is similar to the OPENROWSET command.&lt;br&gt;&lt;/font&gt;&lt;div style="margin-left: 40px;"&gt;&lt;font color="#0000ff" face="Courier New" size="2"&gt;INSERT INTO dbo.ImportTest &lt;/font&gt;&lt;br&gt;&lt;font color="#0000ff" face="Courier New" size="2"&gt;SELECT * FROM OPENDATASOURCE(&amp;#39;Microsoft.Jet.OLEDB.4.0&amp;#39;, &lt;/font&gt;&lt;br&gt; &lt;font color="#0000ff" face="Courier New" size="2"&gt;&amp;#39;Data Source=C:\ImportData.xls;Extended Properties=Excel 8.0&amp;#39;)...[Sheet1$]&lt;/font&gt;&lt;br&gt;&lt;/div&gt;&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;&lt;b&gt;&lt;br&gt; OPENQUERY&lt;br&gt;&lt;/b&gt;&lt;/font&gt;&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;Another option is OPENQUERY.&amp;nbsp; This is another command that allows you to issue a T-SQL command to select data and again with the INSERT INTO option we can load data into our table.&amp;nbsp; There are two steps with this process, first a linked server is setup and then second the query is issued using the OPENQUERY command.&amp;nbsp; This option allow you to filter the columns and rows by the query that is issued against your linked data source.&lt;br&gt;&lt;/font&gt;&lt;div style="margin-left: 40px;"&gt;&lt;font color="#0000ff" face="Courier New" size="2"&gt;EXEC sp_addlinkedserver &amp;#39;ImportData&amp;#39;, &lt;/font&gt;&lt;br&gt;&lt;font color="#0000ff" face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;Jet 4.0&amp;#39;, &amp;#39;Microsoft.Jet.OLEDB.4.0&amp;#39;, &lt;/font&gt;&lt;br&gt; &lt;font color="#0000ff" face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;C:\ImportData.xls&amp;#39;, &lt;/font&gt;&lt;br&gt;&lt;font color="#0000ff" face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;NULL, &lt;/font&gt;&lt;br&gt;&lt;font color="#0000ff" face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;Excel 8.0&amp;#39; &lt;/font&gt;&lt;br&gt; &lt;font color="#0000ff" face="Courier New" size="2"&gt;GO&lt;/font&gt;&lt;/div&gt;  &lt;p style="margin-left: 40px;"&gt;&lt;font color="#0000ff" face="Courier New" size="2"&gt;INSERT INTO dbo.ImportTest &lt;br&gt;SELECT * &lt;br&gt;FROM OPENQUERY(ImportData, &amp;#39;SELECT * FROM [Sheet1$]&amp;#39;) &lt;br&gt;&lt;/font&gt;&lt;/p&gt;&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;&lt;b&gt;Linked Server&lt;br&gt; &lt;/b&gt;&lt;/font&gt;&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;Here is yet another option with setting up a linked server and then issuing a straight SQL statement against the linked server.&amp;nbsp; This again has two steps, first the linked server is setup and secondly a SQL command is issued against the linked data source.&lt;br&gt;&lt;/font&gt;&lt;div style="margin-left: 40px;"&gt;&lt;font color="#0000ff" face="Courier New" size="2"&gt;EXEC sp_addlinkedserver &amp;#39;ImportData&amp;#39;, &lt;/font&gt;&lt;br&gt;&lt;font color="#0000ff" face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;Jet 4.0&amp;#39;, &amp;#39;Microsoft.Jet.OLEDB.4.0&amp;#39;, &lt;/font&gt;&lt;br&gt; &lt;font color="#0000ff" face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;C:\ImportData.xls&amp;#39;, &lt;/font&gt;&lt;br&gt;&lt;font color="#0000ff" face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;NULL, &lt;/font&gt;&lt;br&gt;&lt;font color="#0000ff" face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;Excel 8.0&amp;#39; &lt;/font&gt;&lt;br&gt; &lt;font color="#0000ff" face="Courier New" size="2"&gt;GO&lt;/font&gt;&lt;/div&gt;  &lt;p style="margin-left: 40px;"&gt;&lt;font color="#0000ff" face="Courier New" size="2"&gt;INSERT INTO dbo.ImportTest &lt;br&gt;SELECT * FROM ImportData...Sheet1$&lt;/font&gt;&lt;/p&gt;&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;&lt;br&gt; &lt;/font&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-2023236671804352007?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/2023236671804352007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=2023236671804352007' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/2023236671804352007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/2023236671804352007'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2008/01/different-options-for-importing-data.html' title='Different Options for Importing Data into SQL Server'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-6465645656324179782</id><published>2008-01-25T10:47:00.001+05:30</published><updated>2008-01-25T10:47:18.195+05:30</updated><title type='text'>Export data from SQL Server to Excel</title><content type='html'>&lt;div style="text-align: left;"&gt;&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;&lt;font face="Arial" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exporting data from SQL Server to Excel can be achieved in a variety of ways.&amp;nbsp; Some of these options include &lt;b&gt;Data Transformation Services&lt;/b&gt; (DTS), S&lt;b&gt;QL Server Integration Services&lt;/b&gt; (SSIS) and &lt;b&gt;Bulk Copy&lt;/b&gt; (BCP).&amp;nbsp; Data Transformation Services (SQL Server 2000) and SQL Server Integration Services (SQL Server 2005) offers a GUI where widgets can be dragged and dropped Each option has advantages and disadvantages, but all can do the job.&amp;nbsp; It is just a matter of your comfort level with the tools and the best solution to meet the need. &lt;/font&gt;&lt;/font&gt;&lt;br&gt;&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;&lt;font face="Arial" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Another option that is available directly via the T-SQL language is the &lt;b&gt;OPENROWSET &lt;/b&gt;command (SQL Server 2000 and SQL Server 2005).&amp;nbsp; This command can be called directly in any stored procedure, script or SQL Server Job from T-SQL..&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;&lt;font face="Arial" size="2"&gt;Below is a simple example of writing out the Job name and date to Sheet1 of an Excel spreadsheet in either SQL Server 2005 or 2000.&lt;br&gt;&lt;/font&gt;&lt;/font&gt;&lt;div style="margin-left: 40px;"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font face="Arial"&gt;INSERT&lt;/font&gt;&lt;/font&gt;&lt;font face="Arial"&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;INTO&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;OPENROWSET&lt;/font&gt;&lt;font color="#808080" size="2"&gt;(&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&amp;#39;Microsoft.Jet.OLEDB.4.0&amp;#39;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;br&gt; &lt;font face="Arial"&gt;&lt;font color="#ff0000" size="2"&gt;&amp;#39;Excel 8.0;Database=C:\testing.xls;&amp;#39;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;br&gt;&lt;font face="Arial"&gt;&lt;font color="#ff0000" size="2"&gt;&amp;#39;SELECT Name, Date FROM [Sheet1$]&amp;#39;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;)&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;br&gt; &lt;font face="Arial"&gt;&lt;font color="#0000ff" size="2"&gt;SELECT&lt;/font&gt;&lt;font size="2"&gt; [Name]&lt;/font&gt;&lt;font color="#808080" size="2"&gt;,&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff00ff" size="2"&gt;GETDATE&lt;/font&gt;&lt;font color="#808080" size="2"&gt;()&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;FROM&lt;/font&gt;&lt;font size="2"&gt; msdb&lt;/font&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;font size="2"&gt;dbo&lt;/font&gt;&lt;font color="#808080" size="2"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Arial"&gt;sysjobs&lt;/font&gt;&lt;/font&gt;&lt;br&gt; &lt;font size="2"&gt;&lt;font face="Arial"&gt;GO&lt;/font&gt;&lt;/font&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-6465645656324179782?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/6465645656324179782/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=6465645656324179782' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/6465645656324179782'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/6465645656324179782'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2008/01/export-data-from-sql-server-to-excel.html' title='Export data from SQL Server to Excel'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-907655096691807175</id><published>2008-01-24T19:00:00.001+05:30</published><updated>2008-01-24T19:00:57.245+05:30</updated><title type='text'>Dynamic SQL</title><content type='html'>&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;SQL Server offers a few ways of running a dynamically built SQL statement.&amp;nbsp; These ways are: &lt;/font&gt; &lt;ol&gt;&lt;font style="font-size: 10pt; color: rgb(0, 0, 0); font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;" color="#000000" face="Verdana, Geneva, Arial, Helvetica, sans-serif" size="2"&gt;&lt;li&gt;Writing a query with parameters  &lt;/li&gt;&lt;li&gt;Using &lt;b&gt;EXEC&lt;/b&gt;  &lt;/li&gt;&lt;li&gt;Using &lt;b&gt;sp_executesql&lt;/b&gt;&lt;/li&gt;&lt;/font&gt;&lt;/ol&gt;For more information see: &lt;a href="http://www.mssqltips.com/tip.asp?tip=1160"&gt;http://www.mssqltips.com/tip.asp?tip=1160&lt;/a&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-907655096691807175?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/907655096691807175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=907655096691807175' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/907655096691807175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/907655096691807175'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2008/01/dynamic-sql.html' title='Dynamic SQL'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-626070376475532325</id><published>2008-01-24T16:11:00.001+05:30</published><updated>2008-01-24T16:11:51.467+05:30</updated><title type='text'>Factory Class for SQL and OLEDB Data Providers</title><content type='html'>&lt;h4&gt;Introduction&lt;/h4&gt;  While developing a real life &lt;font style="color: blue ! important; font-family: Verdana; font-weight: 400; font-size: 13.3333px; position: static;" color="blue"&gt;&lt;span class="kLink" style="color: blue ! important; font-family: Verdana; font-weight: 400; font-size: 13.3333px; position: static;"&gt; software &lt;/span&gt;&lt;span class="kLink" style="color: blue ! important; font-family: Verdana; font-weight: 400; font-size: 13.3333px; position: static;"&gt;project&lt;/span&gt;&lt;/font&gt; you need to take in to account many things. One of these things is the choice of database. Most of the times your client will have predefined database (e.g. SQL Server or Oracle). However, some times situation arises such that your database is not fixed at development time. For example if you are developing a product then you will not be knowing the database of your prospective clients in advance. Similarly, if your client demands for database independence (may be because he is migrating his database) then also the database is not fixed. The common solution can be to develop two different sets of data access components - one for SQL server and another for Oracle. However, this will increate your maintenance and version tracking. .NET provides an easy way to tackle this problem. All the data access classes i.e. classes from System.Data.SQLClient and System.Data.OleDb namespaces actually implement certain interfaces from System.Data namespace. In order to make your &lt;font style="color: blue ! important; font-family: Verdana; font-weight: 400; font-size: 13.3333px; position: static;" color="blue"&gt;&lt;span class="kLink" style="color: blue ! important; font-family: Verdana; font-weight: 400; font-size: 13.3333px; position: static;"&gt; data &lt;/span&gt;&lt;span class="kLink" style="color: blue ! important; font-family: Verdana; font-weight: 400; font-size: 13.3333px; position: static;"&gt;access &lt;/span&gt;&lt;span class="kLink" style="color: blue ! important; font-family: Verdana; font-weight: 400; font-size: 13.3333px; position: static;"&gt; layer&lt;/span&gt;&lt;/font&gt; components independent of any database you can code against these interfaces rather than actual classes. In this article we will develop a factory class that returns objects from appropriate namespace based on the data provider type you supply. We will also see how to code your data access layer against these interfaces. &lt;h4&gt;System.Data Interfaces&lt;/h4&gt;  All the .NET providers (&lt;a id="KonaLink3" target="_new" class="kLink" style="text-decoration: underline ! important; position: static;" href="http://www.dotnetbips.com/articles/98d14066-96f7-4edb-8772-c36a90d3cd76.aspx#"&gt; &lt;font style="color: blue ! important; font-family: Verdana; font-weight: 400; font-size: 13.3333px; position: static;" color="blue"&gt;&lt;span class="kLink" style="color: blue ! important; font-family: Verdana; font-weight: 400; font-size: 13.3333px; position: static;"&gt; SQL&lt;/span&gt;&lt;/font&gt;&lt;/a&gt; and OleDB) implement certain set of interfaces found in System.Data namespace. Following is the list of some of these interfaces: &lt;ul&gt;&lt;li&gt;IDbConnection &lt;/li&gt;&lt;li&gt;IDbCommand &lt;/li&gt;&lt;li&gt;IDbDataAdapter &lt;/li&gt;&lt;li&gt;IDataParameter &lt;/li&gt;&lt;/ul&gt;  You will easily be able to identify the mapping between the interfaces and actual classes.  &lt;h4&gt;Developing a factory class&lt;/h4&gt;We will develop a factory class that will simply return you objects of specified data provider. For example if you specify that your data provider is SQL server, you will be returned a SQLConnection object where as if you specify that your data provider is any OLEDB compatible database then a OleDbConnection will be returned. Following is the complete code for the class. &lt;pre&gt;using System;&lt;br&gt;using System.Data;&lt;br&gt;using System.Data.SqlClient;&lt;br&gt;using System.Data.OleDb;&lt;br&gt;&lt;br&gt;namespace DALFactory&lt;br&gt;{&lt;br&gt;public class DALObjects&lt;br&gt;{&lt;br&gt;&lt;br&gt;public static IDbConnection&lt;br&gt;GetConnection(DataProviderType type) &lt;br&gt;{&lt;br&gt;if(type==DataProviderType.SQL)&lt;br&gt;{&lt;br&gt;		return new SqlConnection();&lt;br&gt;	}&lt;br&gt;	else&lt;br&gt;	{&lt;br&gt;		return new OleDbConnection();&lt;br&gt;	}&lt;br&gt;}&lt;br&gt;&lt;br&gt;public static IDbCommand&lt;br&gt;GetCommand(DataProviderType type)&lt;br&gt;{&lt;br&gt; 	if(type==DataProviderType.SQL)&lt;br&gt;	{&lt;br&gt;		return new SqlCommand();&lt;br&gt;	}&lt;br&gt;	else&lt;br&gt;	{&lt;br&gt;		return new OleDbCommand();&lt;br&gt;	}&lt;br&gt;}&lt;br&gt;&lt;br&gt;public static IDbDataAdapter&lt;br&gt;GetDataAdapter(DataProviderType type)&lt;br&gt;{&lt;br&gt;	if(type== DataProviderType.SQL)&lt;br&gt;	{&lt;br&gt;		return new SqlDataAdapter();&lt;br&gt;	}&lt;br&gt;	else&lt;br&gt;	{&lt;br&gt;		return new OleDbDataAdapter();&lt;br&gt;	}&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;br&gt;public static IDataParameter&lt;br&gt;GetParameter(DataProviderType type)&lt;br&gt;{&lt;br&gt;	if(type== DataProviderType.SQL)&lt;br&gt;	{&lt;br&gt;		return new SqlParameter();&lt;br&gt;	}&lt;br&gt;	else&lt;br&gt;	{&lt;br&gt;		return new OleDbParameter();&lt;br&gt;	}&lt;br&gt;}&lt;br&gt;}&lt;br&gt;&lt;br&gt;public enum DataProviderType&lt;br&gt;{&lt;br&gt;	SQL=0,OLEDB=1&lt;br&gt;}&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;/pre&gt;As you will notice we are returning objects that can be instantiated on their own. That is why we have not included DataReader here. Note that we have created all the methods as static. This way we can easily make use of our methods without creating class instance. Also, note that we will be using DataProviderType enum in our code that indicates which namespaces to use. Now that your have your factory class ready let us see how to use it. &lt;h4&gt;Coding against System.Data interfaces&lt;/h4&gt;As mentioned earlier in this section we will see how to use the factory class in our code. Typically when you develop a data access class your code looks like this: &lt;pre&gt;OleDbConnection cnn;&lt;br&gt;OleDbDataAdapter cmd;&lt;br&gt;OleDbDataReader dr;&lt;br&gt;&lt;br&gt;cnn = New OleDbConnection(connectionstring);&lt;br&gt;cmd = New OleDbDataAdapter(sqlquery,cnn);&lt;br&gt;&lt;br&gt;dr=cmd.ExecuteReader();&lt;br&gt;&lt;/pre&gt;Now, since we need to make our class database independent we will not explicitly declare objects from OleDb or SqlClient namespaces. Instead we will code as follows: &lt;pre&gt;IDbConnection cnn=&lt;br&gt;DALObjects.GetConnection(DataProviderType.OLEDB);&lt;br&gt;cnn.Open();&lt;br&gt;IDbCommand cmd=&lt;br&gt;DALObjects.GetCommand(DataProviderType.OLEDB);&lt;br&gt;cmd.ConnectionString=&amp;quot;some_sql&amp;quot;;&lt;br&gt;cmd.Connection=cnn ;&lt;br&gt;IDataReader dr=cmd.ExecuteReader();&lt;br&gt;&lt;/pre&gt;Here, we have avoided using explicit classes of specific data provider. Note that since you are using interfaces here you will not be able to invoke methods and properties specific to a particular provider. For example, if you want to use IDbTransaction interface then you can not call Save() method which is specific to SQL Server. However, what we achieve is database independence. Now, in above example the data provider type parameter can be stored in some external XML file that can be easily changed after installation at client&amp;#39;s place. &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-626070376475532325?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/626070376475532325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=626070376475532325' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/626070376475532325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/626070376475532325'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2008/01/factory-class-for-sql-and-oledb-data.html' title='Factory Class for SQL and OLEDB Data Providers'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-7347499878067941272</id><published>2008-01-10T21:27:00.000+05:30</published><updated>2008-01-10T22:30:48.402+05:30</updated><title type='text'>What is CRM?</title><content type='html'>    &lt;p&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CRM&lt;/b&gt; stands for &lt;b&gt;Customer Relationship Management&lt;/b&gt;. It is a process or methodology used to learn more about customers&amp;#39; needs and behaviors in order to develop stronger relationships with them. There are many technological components to CRM, but thinking about CRM in primarily technological terms is a mistake. The more useful way to think about CRM is as a process that will help bring together lots of pieces of information about customers, sales, marketing effectiveness, responsiveness and market trends. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;CRM&lt;/b&gt; helps businesses use technology and human resources to gain insight into the behavior of customers and the value of those customers. &lt;/p&gt;  &lt;p&gt;Using CRM, a business can: &lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Provide better customer      service &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Increase customer revenues &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Discover new customers &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Cross sell/Up Sell products      more effectively &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Help sales staff close deals      faster &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Make call centers more      efficient &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Simplify marketing and sales      processes &lt;/li&gt;&lt;/ul&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-7347499878067941272?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/7347499878067941272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=7347499878067941272' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/7347499878067941272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/7347499878067941272'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2008/01/what-is-crm.html' title='What is CRM?'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-4889933281249355751</id><published>2007-12-22T10:45:00.001+05:30</published><updated>2007-12-22T10:45:58.173+05:30</updated><title type='text'>How To: Compress ViewState in ASP.NET 2.0</title><content type='html'>&lt;span class="gmail_quote"&gt;&lt;br&gt;&lt;/span&gt; &lt;div&gt; &lt;h1&gt;&lt;font size="2"&gt;&lt;font size="4"&gt;ViewState Compression with System.IO.Compression&lt;/font&gt; &lt;/font&gt;&lt;/h1&gt;&lt;/div&gt; &lt;p align="justify"&gt;ViewState is the built-in structure for automatically retaining values between multiple requests for the same page in &lt;a href="http://ASP.NET"&gt;ASP.NET&lt;/a&gt;. In other words, ViewState technology saves/restores page state between&amp;nbsp;postbacks. On the other hand, this technology comes with an overhead that affects performance especially during page load since the state data is&amp;nbsp;maintained in a hidden field.  &lt;/p&gt; &lt;p&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;__VIEWSTATE&amp;quot; id=&amp;quot;__VIEWSTATE&amp;quot; value=&amp;quot;/wEPDwUJLTMzMTY4NDI5ZGRrYY+UdQNeb33gRiGcw2LoiMHduA==&amp;quot; /&amp;gt; &lt;/p&gt; &lt;h2&gt;Reducing ViewState Size&lt;/h2&gt; &lt;p align="justify"&gt;We can completely disable viewstate by setting EnableViewState to false in the page directive but you need extra programming effort&amp;nbsp;for you to take care of the&amp;nbsp;page state.&amp;nbsp;It is a good idea to disable ViewState for the controls that do not actually need it such as Literals and Labels by setting EnableViewState to false. But this do not entirely solve the problem.&amp;nbsp;  &lt;/p&gt; &lt;h2&gt;Compressing ViewState&lt;/h2&gt; &lt;p align="justify"&gt;&lt;a href="http://ASP.NET"&gt;ASP.NET&lt;/a&gt; 2.0 comes with the System.IO.Compression namespace, which contains classes with functionality to compress/decompress streams. In &lt;a href="http://ASP.NET"&gt;ASP.NET&lt;/a&gt;  1.1, developers must use third party compression tools such as ICSharpCode.SharpZipLib to compress viewstate. &lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;Compressing/Decompressing using GZipStream&lt;/u&gt;&lt;/strong&gt; &lt;/p&gt; &lt;p align="justify"&gt;The following class contains two methods for&amp;nbsp;compressing and decompressing a stream.&amp;nbsp;&amp;nbsp; &lt;/p&gt; &lt;p&gt;using System;&lt;br&gt;using System.Data;&lt;br&gt;using System.Configuration;&lt;br&gt;using System.IO;&lt;br&gt;using System.IO.Compression;&lt;br&gt;&lt;br&gt;public static class CompressViewState&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static byte[] Compress(byte[] data) &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MemoryStream output = new MemoryStream();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GZipStream gzip = new GZipStream(output,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CompressionMode.Compress, true);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gzip.Write(data, 0, data.Length); &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gzip.Close();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return output.ToArray();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static byte[] Decompress(byte[] data)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MemoryStream input = new MemoryStream();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input.Write(data, 0,  data.Length);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input.Position = 0;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GZipStream gzip = new GZipStream(input,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CompressionMode.Decompress, true);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MemoryStream output = new MemoryStream();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; byte[] buff = new byte[64]; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int read = -1;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; read = gzip.Read(buff, 0, buff.Length);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (read &amp;gt; 0)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output.Write(buff, 0, read);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; read = gzip.Read(buff, 0, buff.Length);&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gzip.Close();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return output.ToArray();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;}&amp;nbsp; &lt;/p&gt; &lt;p&gt;You need to save this class in a .cs file in the App_Code directory. &lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;Utilizing the CompressViewState Class&lt;/u&gt;&lt;/strong&gt; &lt;/p&gt; &lt;p&gt;In order to compress the ViewState of a web page, you have to override the two methods &lt;strong&gt;LoadPageStateFromPersistenceMedium&lt;/strong&gt; and &lt;strong&gt;SavePageStateToPersistenceMedium&lt;/strong&gt;. &lt;/p&gt; &lt;p&gt;The folowing code creates a BasePage class which inherits from System.Web.UI.Page, and web pages using the following Base Page class as the base class utilizes ViewState compression. The BasePage class adds an additional hidden field __COMPRESSEDVIEWSTATE, to store the compressed ViewState.  &lt;/p&gt; &lt;p&gt;using System;&lt;br&gt;using System.IO;&lt;br&gt;using System.IO.Compression;&lt;br&gt;using System.Collections;&lt;br&gt;using System.ComponentModel;&lt;br&gt;using System.Web.UI;&lt;br&gt;using System.Configuration;&lt;br&gt;using System.Threading;&lt;br&gt;using  System.Globalization;&lt;br&gt;using System.Text; &lt;br&gt;&lt;br&gt;public abstract class BasePage : System.Web.UI.Page&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private ObjectStateFormatter _formatter = &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new ObjectStateFormatter(); &lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; protected override void &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SavePageStateToPersistenceMedium(object viewState)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MemoryStream ms = new MemoryStream();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _formatter.Serialize(ms, viewState);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; byte[] viewStateArray = ms.ToArray();&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ClientScript.RegisterHiddenField(&amp;quot;__COMPRESSEDVIEWSTATE&amp;quot;,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Convert.ToBase64String(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CompressViewState.Compress(viewStateArray)));&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; protected override object&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LoadPageStateFromPersistenceMedium()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string vsString = Request.Form[&amp;quot;__COMPRESSEDVIEWSTATE&amp;quot;];&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; byte[] bytes = Convert.FromBase64String(vsString);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bytes = CompressViewState.Decompress (bytes);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return _formatter.Deserialize(&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Convert.ToBase64String(bytes));&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;} &lt;/p&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-4889933281249355751?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/4889933281249355751/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=4889933281249355751' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/4889933281249355751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/4889933281249355751'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2007/12/how-to-compress-viewstate-in-aspnet-20.html' title='How To: Compress ViewState in ASP.NET 2.0'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-8036105200511810705</id><published>2007-12-21T20:18:00.001+05:30</published><updated>2007-12-21T20:27:19.452+05:30</updated><title type='text'>Show and Hide ModalPopupExtender from JavaScript</title><content type='html'>&lt;div class="gmail_quote"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt; Assign a BehaviourID to the ModalPopupExtender using the BehaviourID attribute.  &lt;/span&gt;       &lt;div style="text-align: left;"&gt;                &lt;i&gt;BehaviorID ="ModalBehaviour1"&lt;/i&gt; &lt;/div&gt;&lt;p  style="font-family:times new roman,serif;"&gt;&lt;span style="font-size:85%;"&gt; Use the $find method to get a handle to the Modal Popup Behaviour .  &lt;/span&gt;&lt;/p&gt;&lt;i&gt;                 $find ("ModalBehaviour1").&lt;/i&gt; &lt;p  style="font-family:times new roman,serif;"&gt;&lt;span style="font-size:85%;"&gt; Call your hide and show methods on the acquired handle.  &lt;/span&gt;&lt;/p&gt;&lt;p  style="font-family:times new roman,serif;"&gt;&lt;span style="font-size:85%;"&gt;The Javascript would look like this.  &lt;/span&gt;&lt;/p&gt;&lt;p  style="font-family:times new roman,serif;"&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;              &amp;lt;script language="javascript"&amp;gt;&lt;br /&gt;&lt;/p&gt;&lt;blockquote  style="font-family:times new roman,serif;"&gt;&lt;pre&gt;   &lt;span style="font-size:85%;"&gt; function ShowModalPopup()&lt;br /&gt; {&lt;br /&gt;     $find("ModalBehaviour1").show();&lt;br /&gt; }&lt;br /&gt; function HideModalPopup()&lt;br /&gt; {&lt;br /&gt;     $find("ModalBehaviour1").hide();&lt;br /&gt; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/script &lt;span style="font-size:85%;"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-8036105200511810705?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/8036105200511810705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=8036105200511810705' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/8036105200511810705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/8036105200511810705'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2007/12/show-and-hide-modalpopupextender-from.html' title='Show and Hide ModalPopupExtender from JavaScript'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-7940213240661780328</id><published>2007-11-19T10:23:00.000+05:30</published><updated>2007-11-19T10:24:44.835+05:30</updated><title type='text'>Message Box in ASP.NET</title><content type='html'>&lt;span style="font-size:85%;"&gt;public  void ShowMessageBox(string message)&lt;br /&gt;    {&lt;br /&gt;        Page currentPage = (Page)HttpContext.Current.Handler;&lt;br /&gt;        if (currentPage != null)&lt;br /&gt;        {&lt;br /&gt;            ScriptManager manager = ScriptManager.GetCurrent(currentPage);&lt;br /&gt;&lt;br /&gt;            string _msg = "alert('" + message + "');";&lt;br /&gt;            if (manager != null &amp;amp;&amp;amp; manager.IsInAsyncPostBack)&lt;br /&gt;            {&lt;br /&gt;                ScriptManager.RegisterClientScriptBlock(currentPage, currentPage.GetType(), "msg", _msg, true);&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                currentPage.ClientScript.RegisterStartupScript(currentPage.GetType(), "msg", _msg, true);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-7940213240661780328?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/7940213240661780328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=7940213240661780328' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/7940213240661780328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/7940213240661780328'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2007/11/message-box-in-aspnet.html' title='Message Box in ASP.NET'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-4102461332022014822</id><published>2007-10-27T17:03:00.001+05:30</published><updated>2007-12-05T23:59:10.713+05:30</updated><title type='text'>Sending Emails with Dynamic Content</title><content type='html'>&lt;span style="font-size:85%;"&gt;I want the message of the email to like&lt;br /&gt;&lt;/span&gt;&lt;div style="MARGIN-LEFT: 40px;font-family:arial;" &gt;&lt;span style="font-size:85%;"&gt;&lt;span &gt;&lt;span style="FONT-STYLE: italic"&gt;Hi &amp;lt;yourfriendname&amp;gt;,&lt;/span&gt; &lt;span style="FONT-STYLE: italic"&gt;Thank you for sending this email. See you soon.&lt;/span&gt; &lt;span style="FONT-STYLE: italic"&gt;Good Bye,&lt;/span&gt; &lt;span style="FONT-STYLE: italic"&gt;&amp;lt;yourname&amp;gt;&lt;/span&gt; &lt;span style="FONT-STYLE: italic"&gt;&amp;lt;dateyousendthisemail&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span &gt;Code :&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="MARGIN-LEFT: 40px;font-family:arial;" &gt;&lt;span style="font-size:85%;"&gt;&lt;span &gt;&lt;span style="FONT-STYLE: italic"&gt;try&lt;/span&gt; &lt;span style="FONT-STYLE: italic"&gt;{&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-STYLE: italic"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;StreamReader sr=new StreamReader("MyContent.htm");&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="FONT-STYLE: italic"&gt;sr = File.OpenText("MyContent.htm");&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-STYLE: italic"&gt;string result = sr.ReadToEnd();&lt;/span&gt; &lt;span style="FONT-STYLE: italic"&gt;sr.Close();&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span &gt;&lt;span style="FONT-STYLE: italic"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="FONT-STYLE: italic"&gt;catch(Exception ex)&lt;/span&gt; &lt;span style="FONT-STYLE: italic"&gt;{&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-STYLE: italic"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Response.Write(ex.Message);&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span &gt;&lt;span style="FONT-STYLE: italic"&gt;return;&lt;br /&gt;&lt;/span&gt;&lt;span style="FONT-STYLE: italic"&gt;}&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-STYLE: italic"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;string MessageBody=result.Replace("&amp;lt;YourFriendName&amp;gt;", txtFriendName.Text);&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;span style="FONT-STYLE: italic"&gt;MessageBody=MessageBody.Replace("&amp;lt;YourName&amp;gt;", txtMyName.Text);&lt;/span&gt; &lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span &gt;&lt;span style="FONT-STYLE: italic"&gt;MessageBody= MessageBody.Replace("&amp;lt;DateYouSendThisEmail&amp;gt;",&lt;br /&gt;DateTime.Today.ToString());&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-STYLE: italic"&gt;MailMessage mail = new MailMessage();&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-STYLE: italic"&gt;mail.Body = MessageBody;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-STYLE: italic"&gt;mail.BodyFormat = MailFormat.Html;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-STYLE: italic"&gt;mail.From = "YOUR EMAIL ID";&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-STYLE: italic"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;mail.To = "YOUR FRIEND'S EMAIL ID";&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;span style="FONT-STYLE: italic"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;mail.Subject = "Dynamic Content Email From "+ txtMyName.Text;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;span style="FONT-STYLE: italic"&gt;SmtpMail.SmtpServer = "your email server";&lt;/span&gt; &lt;span style="FONT-STYLE: italic"&gt;SmtpMail.Send(mail);&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;a style="FONT-FAMILY: arial" href="http://www.msnspecials.in/windowslive/" target="_new"&gt;&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-4102461332022014822?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/4102461332022014822/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=4102461332022014822' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/4102461332022014822'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/4102461332022014822'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2007/10/sending-emails-with-dynamic-content.html' title='Sending Emails with Dynamic Content'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-5224186798474874159</id><published>2007-10-25T16:22:00.001+05:30</published><updated>2007-10-25T16:32:51.959+05:30</updated><title type='text'>How to use AJAX</title><content type='html'>&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;            &lt;?xml:namespace prefix = o /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;?xml:namespace prefix = st1 /&gt;&lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;&lt;b&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;AJAX&lt;/span&gt;&lt;/b&gt;&lt;/st1:place&gt;&lt;/st1:city&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 13.5pt; TEXT-INDENT: -13.5pt"&gt;&lt;span style="font-size:85%;"&gt;&lt;st1:place st="on"&gt;&lt;st1:city st="on"&gt;&lt;span style="font-family:Arial;"&gt;AJAX&lt;/span&gt;&lt;/st1:city&gt;&lt;/st1:place&gt;&lt;span style="font-family:Arial;"&gt; stands for &lt;b&gt;Asynchronous JavaScript And XML.&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 13.5pt; TEXT-INDENT: -13.5pt"&gt;&lt;span style="font-size:85%;"&gt;&lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;&lt;span style="font-family:Arial;"&gt;AJAX&lt;/span&gt;&lt;/st1:place&gt;&lt;/st1:city&gt;&lt;span style="font-family:Arial;"&gt; is a type of programming made popular in 2005 by Google (with Google Suggest).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 13.5pt; TEXT-INDENT: -13.5pt"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Symbol;"&gt;·&lt;span style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;&lt;span style="font-family:Arial;"&gt;AJAX&lt;/span&gt;&lt;/st1:place&gt;&lt;/st1:city&gt;&lt;span style="font-family:Arial;"&gt; is not a new programming language, but a new way to use existing standards.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 13.5pt; TEXT-INDENT: -13.5pt"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Symbol;"&gt;·     &lt;span style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;With &lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;AJAX&lt;/st1:place&gt;&lt;/st1:city&gt; you can create better, faster, and more user-friendly web applications.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 13.5pt; TEXT-INDENT: -13.5pt"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Symbol;"&gt;·&lt;span style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal"&gt;     &lt;/span&gt;&lt;/span&gt;&lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;&lt;span style="font-family:Arial;"&gt;AJAX&lt;/span&gt;&lt;/st1:place&gt;&lt;/st1:city&gt;&lt;span style="font-family:Arial;"&gt; is based on JavaScript and HTTP requests.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 13.5pt; TEXT-INDENT: -13.5pt"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Symbol;"&gt;·&lt;span style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;With &lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;AJAX&lt;/st1:place&gt;&lt;/st1:city&gt;, your JavaScript communicates directly with the server, through the JavaScript&lt;b&gt; XMLHttpRequest &lt;/b&gt;object&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;e.g&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 4.5pt; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;function ajaxFunction()  {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  var xmlHttp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  try&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 45pt; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    // Firefox, Opera 8.0+, Safari&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 45pt; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    xmlHttp=new XMLHttpRequest();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  catch (e)  {    // Internet Explorer&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    try {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;                     xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;      }  catch (e)  {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 45pt; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;      try     {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 45pt; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;                        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 45pt; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;        }   catch (e)      {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 76.5pt; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;        alert("Your browser does not support &lt;st1:place st="on"&gt;&lt;st1:city st="on"&gt;AJAX&lt;/st1:city&gt;&lt;/st1:place&gt;!");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 76.5pt; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;        return false;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 45pt; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;        }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;      }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 4.5pt; TEXT-INDENT: -4.5pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;/script&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Note:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 13.5pt; TEXT-INDENT: -13.5pt"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Symbol;"&gt;·&lt;span style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal"&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;nternet Explorer uses an &lt;b&gt;ActiveXObject&lt;/b&gt;, while other browsers uses the built-in JavaScript object called &lt;b&gt;XMLHttpRequest.&lt;i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 13.5pt; TEXT-INDENT: -13.5pt"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Symbol;"&gt;·&lt;span style="FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal"&gt;     &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;create the object with &lt;i&gt;XMLHttp=new &lt;/i&gt;&lt;b&gt;XMLHttpRequest()&lt;/b&gt;. This is for the Firefox, Opera, and Safari browsers.&lt;b&gt;&lt;i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 13.5pt; TEXT-INDENT: -13.5pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;If that fails, try xmlHttp=new &lt;b&gt;ActiveXObject("Msxml2.XMLHTTP")&lt;/b&gt; which is for Internet Explorer 6.0+, if that also fails, try xmlHttp=new&lt;b&gt; ActiveXObject("Microsoft.XMLHTTP")&lt;/b&gt; which is for Internet Explorer 5.5+&lt;b&gt;&lt;i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The onreadystatechange Property&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;After a request to the server, we need a function that can receive the data that is returned by the server.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The &lt;i&gt;onreadystatechange&lt;/i&gt; property stores the function that will process the response from a server. The following code defines an empty function and sets the &lt;i&gt;onreadystatechange&lt;/i&gt; property at the same time:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlHttp.onreadystatechange=function()  {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  // We are going to write some code here&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The &lt;i&gt;readyState&lt;/i&gt; Property&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The &lt;i&gt;readyState&lt;/i&gt; property holds the status of the server's response. Each time the readyState changes, the onreadystatechange function will be executed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Here are the possible values for the readyState property:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;State    Description&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;0          The request is not initialized&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;1          The request has been set up&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;2          The request has been sent&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;3          The request is in process&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;4          The request is complete&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;We are going to add an If statement to the onreadystatechange function to test if our response is complete (this means that we can get our data):&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlHttp.onreadystatechange=function()  {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  if(xmlHttp.readyState==4)    {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;            // Get the data from the server's response&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The responseText Property&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The data sent back from the server can be retrieved with the &lt;b&gt;responseText&lt;/b&gt; property.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;In our code, we will set the value of our "time" input field equal to responseText:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlHttp.onreadystatechange=function()  {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  if(xmlHttp.readyState==4)    {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;              document.myForm.time.value=xmlHttp.responseText;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  }&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;AJAX&lt;/span&gt;&lt;/b&gt;&lt;/st1:place&gt;&lt;/st1:city&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt; - Sending a Request to the Server&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;To send off a request to the server, we use the &lt;i&gt;open() &lt;/i&gt;method and the &lt;i&gt;send() &lt;/i&gt;method.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The &lt;i&gt;open()&lt;/i&gt; method takes three arguments. The first argument defines which method to use when sending the request (GET or POST). The second argument specifies the URL of the server-side script. The third argument specifies that the request should be handled asynchronously. The &lt;i&gt;send() &lt;/i&gt;method sends the request off to the server. If we assume that the HTML and ASP file are in the same directory, the code would be:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlHttp.open("GET","time.asp",true);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlHttp.send(null);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Now we must decide when the &lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;AJAX&lt;/st1:place&gt;&lt;/st1:city&gt; function should be executed. We will let the function run "behind the scenes" when the user types something in the username text field:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;form name="myForm"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Name: &amp;lt;input type="text"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;onkeyup="ajaxFunction();" name="username" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Time: &amp;lt;input type="text" name="time" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;/form&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Our updated AJAX-ready "testAjax.htm" file now looks like this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;html&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;body&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;function ajaxFunction()  {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  var xmlHttp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  try    {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    // Firefox, Opera 8.0+, Safari&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    xmlHttp=new XMLHttpRequest();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    }  catch (e)    {    // Internet Explorer&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    try      {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in; TEXT-INDENT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;      } catch (e)    {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;      try    {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;             xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;        }  catch (e) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 2in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;        alert("Your browser does not support &lt;st1:place st="on"&gt;&lt;st1:city st="on"&gt;AJAX&lt;/st1:city&gt;&lt;/st1:place&gt;!");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 2in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;        return false;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;        }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;      }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    xmlHttp.onreadystatechange=function()  {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;      if(xmlHttp.readyState==4)      {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;                 document.myForm.time.value=xmlHttp.responseText;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;        }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;      }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    xmlHttp.open("GET","time.asp",true);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    xmlHttp.send(null);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;/script&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;form name="myForm"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Name: &amp;lt;input type="text"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;onkeyup="ajaxFunction();" name="username" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Time: &amp;lt;input type="text" name="time" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;/form&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;/body&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;/html&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;AJAX&lt;/span&gt;&lt;/b&gt;&lt;/st1:place&gt;&lt;/st1:city&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt; - The Server-Side ASP Script&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Now we are going to create the script that displays the current server time.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The &lt;i&gt;responseText&lt;/i&gt; property (explained in the previous chapter) will store the data returned from the server. Here we want to send back the current time. The code in "time.asp" looks like this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;%&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;response.expires=-1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;response.write(time)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;%&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;Note: &lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Arial;"&gt;The Expires property sets how long (in minutes) a page will be cached on a browser before it expires. If a user returns to the same page before it expires, the cached version is displayed. &lt;i&gt;Response.Expires=-1 &lt;/i&gt;indicates that the page will never be cached.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;Example Explained - The HTML Form&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The form above has the following HTML code:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;form&amp;gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;First Name:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;input type="text" id="txt1"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;onkeyup="showHint(this.value)"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;/form&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;p&amp;gt;Suggestions: &amp;lt;span id="txtHint"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;As you can see it is just a simple HTML form with an input field called "txt1".&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;An event attribute for the input field defines a function to be triggered by the &lt;i&gt;onkeyup&lt;/i&gt; event.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The paragraph below the form contains a span called "txtHint". The span is used as a placeholder for data retrieved from the web server.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;When the user inputs data, a function called "showHint()" is executed. The execution of the function is triggered by the "onkeyup" event. In other words: Each time the user moves his finger away from a keyboard key inside the input field, the function showHint is called.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;Example Explained - The showHint() Function&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The showHint() function is a very simple JavaScript function placed in the &amp;lt;head&amp;gt; section of the HTML page.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The function contains the following code:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;function showHint(str) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;if (str.length==0)  { &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;            document.getElementById("txtHint").innerHTML="";&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in; TEXT-INDENT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;return;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlHttp=GetXmlHttpObject()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;if (xmlHttp==null)  {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  alert ("Your browser does not support &lt;st1:place st="on"&gt;&lt;st1:city st="on"&gt;AJAX&lt;/st1:city&gt;&lt;/st1:place&gt;!");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  return;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt; } &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;var url="gethint.asp";&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;url=url+"?q="+str;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;url=url+"&amp;amp;sid="+Math.random();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlHttp.onreadystatechange=stateChanged;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlHttp.open("GET",url,true);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlHttp.send(null);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The function executes every time a character is entered in the input field.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;If there is some input in the text field (str.length &amp;gt; 0) the function executes the following:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    * Defines the url (filename) to send to the server&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    * Adds a parameter (q) to the url with the content of the input field&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    * Adds a random number to prevent the server from using a cached file&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    * Creates an XMLHTTP object, and tells the object to execute a function called stateChanged when a change is triggered&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    * Opens the XMLHTTP object with the given url.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    * Sends an HTTP request to the server&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;If the input field is empty, the function simply clears the content of the txtHint placeholder.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Example Explained - The GetXmlHttpObject() Function&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The example above calls a function called GetXmlHttpObject().&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The purpose of the function is to solve the problem of creating different XMLHTTP objects for different browsers. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The function is listed below:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;function GetXmlHttpObject(){&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  var xmlHttp=null;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  try    {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    // Firefox, Opera 8.0+, Safari&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    xmlHttp=new XMLHttpRequest();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    }  catch (e)    {    // Internet Explorer&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    try      {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;             xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;      }  catch (e)    {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;             xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;      }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  return xmlHttp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;Example Explained - The stateChanged() Function&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The stateChanged() function contains the following code:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;function stateChanged(){ &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;if (xmlHttp.readyState==4) { &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;            document.getElementById("txtHint").innerHTML=xmlHttp.responseText;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The stateChanged() function executes every time the state of the XMLHTTP object changes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;AJAX&lt;/span&gt;&lt;/b&gt;&lt;/st1:place&gt;&lt;/st1:city&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt; ResponseXML Example&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;While responseText returns the HTTP response as a string, responseXML returns the response as XML.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The ResponseXML property returns an XML document object, which can be examined and parsed using W3C DOM node tree methods and properties.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;&lt;b&gt;&lt;u&gt;&lt;span style="font-family:Arial;"&gt;AJAX&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/st1:place&gt;&lt;/st1:city&gt;&lt;b&gt;&lt;u&gt;&lt;span style="font-family:Arial;"&gt; Example Explained&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The example above contains an HTML form, several &amp;lt;span&amp;gt; elements to hold the returned data, and a link to a JavaScript:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;html&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;head&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;script src="selectcustomer_xml.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;/head&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;body&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;form action=""&amp;gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Select a Customer:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;select name="customers" onchange="showCustomer(this.value)"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;option value="ALFKI"&amp;gt;Alfreds Futterkiste&amp;lt;/option&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;option value="NORTS "&amp;gt;North/South&amp;lt;/option&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;option value="WOLZA"&amp;gt;Wolski Zajazd&amp;lt;/option&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;/select&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;/form&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;b&amp;gt;&amp;lt;span id="companyname"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;span id="contactname"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;span id="address"&amp;gt;&amp;lt;/span&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;span id="city"&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;span id="country"&amp;gt;&amp;lt;/span&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The example above contains an HTML form with a drop down box called "customers".&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;When the user selects a customer in the dropdown box, a function called "showCustomer()" is executed. The execution of the function is triggered by the "onchange" event. In other words: Each time the user change the value in the drop down box, the function showCustomer() is called.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;The &lt;st1:place st="on"&gt;&lt;st1:city st="on"&gt;AJAX&lt;/st1:city&gt;&lt;/st1:place&gt; JavaScript&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Arial;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;This is the JavaScript code stored in the file "selectcustomer_xml.js":&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;var xmlHttp&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;function showCustomer(str) { &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 27pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlHttp=GetXmlHttpObject();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 27pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;if (xmlHttp==null)  {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 27pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  alert ("Your browser does not support &lt;st1:place st="on"&gt;&lt;st1:city st="on"&gt;AJAX&lt;/st1:city&gt;&lt;/st1:place&gt;!");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 27pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  return;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 27pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 27pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;var url="getcustomer_xml.asp";&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 27pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;url=url+"?q="+str;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 27pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;url=url+"&amp;amp;sid="+Math.random();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 27pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlHttp.onreadystatechange=stateChanged;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 27pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlHttp.open("GET",url,true);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 27pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlHttp.send(null);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;function stateChanged(){ &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in; TEXT-INDENT: -9pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;if (xmlHttp.readyState==4) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 45pt; TEXT-INDENT: -9pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;var xmlDoc=xmlHttp.responseXML.documentElement;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 45pt; TEXT-INDENT: -9pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;document.getElementById("companyname").innerHTML=&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 45pt; TEXT-INDENT: -9pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlDoc.getElementsByTagName("compname")[0].childNodes[0].nodeValue;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 45pt; TEXT-INDENT: -9pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;document.getElementById("contactname").innerHTML=&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 45pt; TEXT-INDENT: -9pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlDoc.getElementsByTagName("contname")[0].childNodes[0].nodeValue;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 45pt; TEXT-INDENT: -9pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;document.getElementById("address").innerHTML=&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 45pt; TEXT-INDENT: -9pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlDoc.getElementsByTagName("address")[0].childNodes[0].nodeValue;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 45pt; TEXT-INDENT: -9pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;document.getElementById("city").innerHTML=&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 45pt; TEXT-INDENT: -9pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlDoc.getElementsByTagName("city")[0].childNodes[0].nodeValue;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 45pt; TEXT-INDENT: -9pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;document.getElementById("country").innerHTML=&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 45pt; TEXT-INDENT: -9pt"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;xmlDoc.getElementsByTagName("country")[0].childNodes[0].nodeValue;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;        }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;function GetXmlHttpObject(){&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in; TEXT-INDENT: -0.25in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;var xmlHttp=null;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in; TEXT-INDENT: -0.25in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;try  {  // Firefox, Opera 8.0+, Safari&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;            xmlHttp=new XMLHttpRequest();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;      }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;catch (e)  {  // Internet Explorer&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  try    {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;       xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    }  catch (e)    {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;          xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;    }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;  }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;return xmlHttp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The showCustomer() and GetXmlHttpObject() functions above are the same as in previous chapters. The stateChanged() function is also used earlier in this tutorial, however; this time we return the result as an XML document (with responseXML) and uses the DOM to extract the values we want to be displayed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The &lt;st1:city st="on"&gt;&lt;st1:place st="on"&gt;AJAX&lt;/st1:place&gt;&lt;/st1:city&gt; Server Page&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The server page called by the JavaScript, is a simple ASP file called "getcustomer_xml.asp".&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The page is written in VBScript for an Internet Information Server (IIS). It could easily be rewritten in PHP, or some other server language. Look at a corresponding example in PHP.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;The code runs an SQL query against a database and returns the result as an XML document:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;%&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;response.expires=-1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;response.contenttype="text/xml"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;sql="SELECT * FROM CUSTOMERS "&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;sql=sql &amp;amp; " WHERE CUSTOMERID='" &amp;amp; request.querystring("q") &amp;amp; "'"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;on error resume next&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;set conn=Server.CreateObject("ADODB.Connection")&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;conn.Provider="Microsoft.Jet.OLEDB.4.0"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;conn.Open(Server.Mappath("/db/northwind.mdb"))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;set rs=Server.CreateObject("ADODB.recordset")&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;rs.Open sql, conn&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;if err &amp;lt;&amp;gt; 0 then&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;response.write(err.description)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;set rs=nothing&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;set conn=nothing&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;response.write("&amp;lt;?xml version='1.0' encoding='ISO-8859-1'?&amp;gt;")&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;response.write("&amp;lt;company&amp;gt;")&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;response.write("&amp;lt;compname&amp;gt;" &amp;amp;rs.fields("companyname")&amp;amp; "&amp;lt;/compname&amp;gt;")&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;response.write("&amp;lt;contname&amp;gt;" &amp;amp;rs.fields("contactname")&amp;amp; "&amp;lt;/contname&amp;gt;")&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;response.write("&amp;lt;address&amp;gt;" &amp;amp;rs.fields("address")&amp;amp; "&amp;lt;/address&amp;gt;")&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;response.write("&amp;lt;city&amp;gt;" &amp;amp;rs.fields("city")&amp;amp; "&amp;lt;/city&amp;gt;")&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;response.write("&amp;lt;country&amp;gt;" &amp;amp;rs.fields("country")&amp;amp; "&amp;lt;/country&amp;gt;")&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;response.write("&amp;lt;/company&amp;gt;")&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;end if&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;on error goto 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;%&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;i&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;Notice the second line in the ASP code above: response.contenttype="text/xml". The ContentType property sets the HTTP content type for the response object. The default value for this property is "text/html". This time we want the content type to be XML.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-5224186798474874159?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/5224186798474874159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=5224186798474874159' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/5224186798474874159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/5224186798474874159'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2007/10/how-to-use-ajax.html' title='How to use AJAX'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-5657023105374933847</id><published>2007-08-21T18:02:00.000+05:30</published><updated>2007-08-21T18:03:51.253+05:30</updated><title type='text'>What is Business Intelligence?</title><content type='html'>&lt;strong&gt;Business intelligence &lt;/strong&gt;(&lt;strong&gt;BI&lt;/strong&gt;) is a business management term, which refers to applications and technologies that are used to gather, provide access to, and analyze data and information about company operations. Business intelligence systems can help companies have a more comprehensive knowledge of the factors affecting their business, such as metrics on sales, production, internal operations, and they can help companies to make better business decisions&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-5657023105374933847?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/5657023105374933847/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=5657023105374933847' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/5657023105374933847'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/5657023105374933847'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2007/08/what-is-business-intelligence.html' title='What is Business Intelligence?'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-1098952823513884418</id><published>2007-08-21T17:55:00.000+05:30</published><updated>2007-08-21T18:01:17.939+05:30</updated><title type='text'>Sql Sever 2005 Overview</title><content type='html'>&lt;strong&gt;Database Engine&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The Database Engine is the core service for storing, processing, and securing data. The Database Engine provides controlled access and rapid transaction processing to meet the requirements of the most demanding data consuming applications within your enterprise.&lt;br /&gt;&lt;br /&gt;Use the Database Engine to create relational databases for online transaction processing or online analytical processing data. This includes creating tables for storing data, and database objects such as indexes, views, and stored procedures for viewing, managing, and securing data. You can use SQL Server Management Studio to manage the database objects, and SQL Server Profiler for capturing server events.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Analysis Services&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Analysis Services is the core service for supporting rapid analysis of business data, delivering online analytical processing (OLAP) and data mining functionality in business intelligence applications.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;OLAP&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;Analysis Services allows you to design, create, and manage multidimensional structures that contain detail and aggregated data from multiple data sources, such as relational databases, in a single unified logical model supported by built-in calculations. Analysis Services provides fast, intuitive, top-down analysis of large quantities of data built on this unified data model, which can be delivered to users in multiple languages and currencies. Analysis Services works with data warehouses, data marts, production databases and operational data stores, supporting analysis of both historical and real time data.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;Data Mining&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;Analysis Services contains the features and tools you need to create complex data mining solutions. &lt;br /&gt;&lt;br /&gt;A set of industry-standard data mining algorithms.&lt;br /&gt;&lt;br /&gt;The Data Mining Designer, which you can use to create, manage, explore, and create predictions from mining models.&lt;br /&gt;&lt;br /&gt;The DMX language, which you can use to manage mining models and to create complex prediction queries.&lt;br /&gt;&lt;br /&gt;You can use a combination of these features and tools to discover trends and patterns that exist in your data, and then use the trends and patterns to make intelligent decisions about difficult business problems.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Integration Services&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;SQL Server 2005 Integration Services (SSIS) is the extract, transform, and load (ETL) component of SQL Server 2005. It replaces the earlier SQL Server ETL component, Data Transformation Services (DTS).&lt;br /&gt;&lt;br /&gt;Integration Services is a platform for building enterprise-level data integration and data transformations solutions. You use Integration Services to solve complex business problems by copying or downloading files, sending e-mail messages in response to events, updating data warehouses, cleaning and mining data, and managing SQL Server objects and data. The packages can work alone or in concert with other packages to address complex business needs. Integration Services can extract and transform data from a wide variety of sources such as XML data files, flat files, and relational data sources, and then load the data into one or more destinations.&lt;br /&gt;&lt;br /&gt;Integration Services includes a rich set of built-in tasks and transformations; tools for constructing packages; and the Integration Services service for running and managing packages. You can use the graphical Integration Services tools to create solutions without writing a single line of code; or you can program the extensive Integration Services object model to create packages programmatically and code custom tasks and other package objects.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Replication&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Replication is a set of technologies for copying and distributing data and database objects from one database to another, and then synchronizing between databases to maintain consistency. Using replication, you can distribute data to different locations and to remote or mobile users over local and wide area networks, dial-up connections, wireless connections, and the Internet. SQL Server provides three types of replication, each with different capabilities: transactional replication, merge replication, and snapshot replication.&lt;br /&gt;&lt;br /&gt;Transactional replication is typically used in server-to-server scenarios that require high throughput, including: improving scalability and availability; data warehousing and reporting; integrating data from multiple sites; integrating heterogeneous data; and offloading batch processing. Merge replication is primarily designed for mobile applications or distributed server applications that have possible data conflicts. Common scenarios include: exchanging data with mobile users; consumer point of sale (POS) applications; and integration of data from multiple sites. Snapshot replication is used to provide the initial data set for transactional and merge replication; it can also be used when complete refreshes of data are appropriate. With these three types of replication, SQL Server provides a powerful and flexible system for synchronizing data across your enterprise.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Reporting Services&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;SQL Server 2005 Reporting Services (SSRS) is a server-based reporting platform that provides comprehensive data reporting from relational and multidimensional data sources. Reporting Services includes processing components, a complete set of tools that you can use to create and manage reports, and an application programming interface (API) that allows developers to integrate or extend data and report processing in custom applications. The reports that you build can be based on relational or multidimensional data from SQL Server, Analysis Services, Oracle, or any Microsoft .NET Framework data provider, such as ODBC or OLE DB.&lt;br /&gt;&lt;br /&gt;With Reporting Services, you can create interactive, tabular, or free-form reports that retrieve data at scheduled intervals or on-demand when the user opens a report. Reporting Services also enables users to create ad hoc reports based on predefined models, and to interactively explore data within the model. All reports can be rendered in both desktop and Web-oriented formats. You can choose from a variety of viewing formats to render reports on demand in preferred formats for data manipulation or printing.&lt;br /&gt;&lt;br /&gt;Reporting Services is a server-based solution, and thus provides a way to centralize report storage and management, provide secure access to reports, models, and folders, control how reports are processed and distributed, and standardize how reports are used in your business.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Notification Services&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;SQL Server 2005 Notification Services is a platform for developing applications that generate and send notifications, and it is also an engine that runs those applications. You can use Notification Services to generate and send timely, personalized messages to thousands or even millions of subscribers, and deliver the messages to a wide variety of applications and devices.&lt;br /&gt;&lt;br /&gt;The Notification Services platform enables the development of rich notification applications. Subscriptions, which express subscribers' interest in specific information (called events), can be evaluated based on the arrival of events or based on a schedule. The event data itself can originate from within the database, from other databases, or from external sources. Notifications, which result from the matching of events and subscriptions, can be richly formatted before being sent to the subscriber.&lt;br /&gt;&lt;br /&gt;The Notification Services engine works in concert with the SQL Server Database Engine. The Database Engine stores the application data and performs the matching between events and subscriptions. The Notification Services engine controls the flow and processing of data, and can be scaled-out across multiple computers. This can improve the performance of very large and demanding applications.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Full-Text Search&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;SQL Server contains the functionality you need to issue full-text queries against plain character-based data in SQL Server tables. Full-text queries could include words and phrases or multiple forms of a word or phrase. Full-Text Search allows fast and flexible indexing for keyword-based query of text data stored in a Microsoft SQL Server database. In SQL Server 2005, Full-Text Search delivers enterprise-level search functionality.&lt;br /&gt;&lt;br /&gt;Use Full-Text Search to search for plain, character-based data, in multiple fields in multiple tables at the same time. The performance benefit of using Full-Text Search can be best realized when querying against a large amount of unstructured text data. For example, a Transact-SQL LIKE query against millions of rows of text data can take minutes to return; whereas a full-text query may take only seconds or less against the same data, depending on the number of rows that are returned. You can build full-text indexes on data stored in a char, varchar or nvarchar column or formatted binary data, such as Microsoft Word documents, stored in a varbinary(max) or image column. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Service Broker&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;SQL Server 2005 Service Broker provides the SQL Server Database Engine native support for messaging and queuing applications. This makes it easier for developers to create sophisticated applications that use the Database Engine components to communicate between disparate databases. Developers can use Service Broker to easily build distributed and reliable applications.&lt;br /&gt;&lt;br /&gt;Application developers who use Service Broker can distribute data workloads across several databases without programming complicated communication and messaging internals. This reduces development and test work because Service Broker handles the communication paths within the context of a conversation. It also improves performance. For example, front-end databases supporting Web sites can record information and send process intensive tasks to queue in back-end databases. Service Broker ensures that all tasks are managed in the context of transactions to ensure reliability and technical consistency.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-1098952823513884418?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/1098952823513884418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=1098952823513884418' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/1098952823513884418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/1098952823513884418'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2007/08/sql-sever-2005-overview.html' title='Sql Sever 2005 Overview'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-3890359935292499706</id><published>2007-08-18T10:56:00.000+05:30</published><updated>2007-08-18T10:59:01.121+05:30</updated><title type='text'>How to Insert Values into an Identity Column in SQL Server</title><content type='html'>&lt;span style="font-weight:bold;"&gt;SET IDENTITY_INSERT&lt;/span&gt; IdentityTable &lt;span style="font-weight:bold;"&gt;ON&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;INSERT&lt;/span&gt; IdentityTable(TheIdentity, TheValue)&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;VALUES &lt;/span&gt;(10, 'Row Ten')&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;SET IDENTITY_INSERT&lt;/span&gt; IdentityTable &lt;span style="font-weight:bold;"&gt;OFF&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;INSERT&lt;/span&gt; IdentityTable(TheValue)&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;VALUES &lt;/span&gt;('Should be 11')&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;SELECT&lt;/span&gt; * &lt;span style="font-weight:bold;"&gt;FROM&lt;/span&gt; IdentityTable&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;(1 row(s) affected)&lt;br /&gt;&lt;br /&gt;(1 row(s) affected)&lt;br /&gt;TheIdentity TheValue&lt;br /&gt;----------- --------------------&lt;br /&gt;         10 Row Ten&lt;br /&gt;         11 Should be 11&lt;br /&gt;&lt;br /&gt;(2 row(s) affected)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-3890359935292499706?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/3890359935292499706/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=3890359935292499706' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/3890359935292499706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/3890359935292499706'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2007/08/how-to-insert-values-into-identity.html' title='How to Insert Values into an Identity Column in SQL Server'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-6790487835448622149</id><published>2007-08-18T10:36:00.000+05:30</published><updated>2007-08-18T10:40:55.483+05:30</updated><title type='text'>SQL Server: How to run a stored procedure at SQL Server start-up</title><content type='html'>This is acctually quite simple. There is 'startup' option that you can set to the procedure.&lt;br /&gt;&lt;br /&gt;There are a few limitations though:&lt;br /&gt;&lt;br /&gt; - your stored pricedure must reside in the [master] database&lt;br /&gt;&lt;br /&gt; - it's owner must be dbo&lt;br /&gt;&lt;br /&gt; - it musn't have any input or output parameters&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Here is some sample code: &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;USE&lt;/span&gt; master;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;GO&lt;/span&gt;&lt;br /&gt;-- first set the server to show advanced options&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;EXEC&lt;/span&gt; sp_configure 'show advanced option', '1';&lt;br /&gt;RECONFIGURE&lt;br /&gt;-- then set the scan for startup procs to 1&lt;br /&gt;EXEC sp_configure 'scan for startup procs', '1';&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;RECONFIGURE&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;IF&lt;/span&gt; OBJECT_ID('spTest') &lt;span style="font-weight:bold;"&gt;IS NOT NULL&lt;/span&gt;&lt;br /&gt;    &lt;span style="font-weight:bold;"&gt;DROP PROC&lt;/span&gt; spTest&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;GO&lt;/span&gt;&lt;br /&gt;-- crate a test stored procedure&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;CREATE PROC spTest&lt;br /&gt;AS&lt;/span&gt;&lt;br /&gt;-- just create a sample database&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;EXEC&lt;/span&gt;('CREATE database db1')&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;GO&lt;/span&gt;&lt;br /&gt;-- set it to run at sql server start-up&lt;br /&gt;exec sp_procoption N'spTest', 'startup', 'on'&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Note that each stored procedure run at start up takes up one worker thread until finished. So if you want to run multiple sprocs at runtime&lt;br /&gt;&lt;br /&gt;and parallelism doesn't matter create one sproc that executes all others.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-6790487835448622149?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/6790487835448622149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=6790487835448622149' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/6790487835448622149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/6790487835448622149'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2007/08/sql-server-how-to-run-stored-procedure.html' title='SQL Server: How to run a stored procedure at SQL Server start-up'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-1640892105100356684</id><published>2007-08-11T11:21:00.000+05:30</published><updated>2007-08-11T11:26:48.638+05:30</updated><title type='text'>Database Mail</title><content type='html'>The SQL Mail problems, that we faced in SQL Server 7.0 and 2000, are no more. SQL Server 2005 supports and uses SMTP email now and there is no longer a need to MAPI client to send email. In SQL Server 2005, the mail feature is called Database Mail. In this article, I am going to demonstrate step-by-step, with illustrations, how to configure Database Mail and send email from SQL Server.&lt;br /&gt;&lt;br /&gt;Database Mail has four components.&lt;br /&gt;&lt;br /&gt;1.     Configuration Component&lt;br /&gt;&lt;br /&gt;Configuration component has two sub components. One is the Database Mail account, which contains information such as the SMTP server login, Email account, Login and password for SMTP mail. &lt;br /&gt;&lt;br /&gt;The Second sub component is Database Mail Profile. Mail profile can be Public, meaning members of DatabaseMailUserRole in MSDB database can send email. For private profile, a set of users should be defined.&lt;br /&gt;&lt;br /&gt;2.     Messaging Component&lt;br /&gt;&lt;br /&gt;Messaging component is basically all of the objects related to sending email stored in the MSDB database.&lt;br /&gt;&lt;br /&gt;3.     Database Mail Executable&lt;br /&gt;&lt;br /&gt;Database Mail uses the DatabaseMail90.exe executable to send email.&lt;br /&gt;&lt;br /&gt;4.     Logging and Auditing component&lt;br /&gt;&lt;br /&gt;Database Mail stores the log information on MSDB database and it can be queried using sysmail_event_log.&lt;br /&gt;&lt;br /&gt;Step 1&lt;br /&gt;&lt;br /&gt;Before setting up the Database Mail profile and accounts, we have to enable the Database Mail feature on the server. This can be done in two ways. The first method is to use Transact SQL to enable Database Mail. The second method is to use a GUI.&lt;br /&gt;&lt;br /&gt;In the SQL Server Management Studio, execute the following statement.&lt;br /&gt;&lt;br /&gt;use master&lt;br /&gt;go&lt;br /&gt;sp_configure 'show advanced options',1&lt;br /&gt;go&lt;br /&gt;reconfigure with override&lt;br /&gt;go&lt;br /&gt;sp_configure 'Database Mail XPs',1&lt;br /&gt;--go&lt;br /&gt;--sp_configure 'SQL Mail XPs',0&lt;br /&gt;go&lt;br /&gt;reconfigure &lt;br /&gt;go&lt;br /&gt;&lt;br /&gt;Step 2&lt;br /&gt;&lt;br /&gt;The Configuration Component Database account can be enabled by using the sysmail_add_account procedure. In this article, we are going create the account, "MyMailAccount," using mail.optonline.net as the mail server and &lt;br /&gt;&lt;br /&gt;makclaire@optimumonline.net as the e-mail account.&lt;br /&gt;&lt;br /&gt;Please execute the statement below.&lt;br /&gt;&lt;br /&gt;EXECUTE msdb.dbo.sysmail_add_account_sp&lt;br /&gt;    @account_name = 'MyMailAccount',&lt;br /&gt;    @description = 'Mail account for Database Mail',&lt;br /&gt;    @email_address = 'makclaire@optonline.net',&lt;br /&gt;    @display_name = 'MyAccount',&lt;br /&gt; @username='makclaire@optonline.net',&lt;br /&gt; @password='abc123',&lt;br /&gt;    @mailserver_name = 'mail.optonline.net'&lt;br /&gt;&lt;br /&gt;Step 3&lt;br /&gt;&lt;br /&gt;The second sub component of the configuration requires us to create a Mail profile.&lt;br /&gt;&lt;br /&gt;In this article, we are going to create "MyMailProfile" using the sysmail_add_profile procedure to create a Database Mail profile.&lt;br /&gt;&lt;br /&gt;Please execute the statement below.&lt;br /&gt;&lt;br /&gt;EXECUTE msdb.dbo.sysmail_add_profile_sp&lt;br /&gt;       @profile_name = 'MyMailProfile',&lt;br /&gt;       @description = 'Profile used for database mail'&lt;br /&gt;&lt;br /&gt;Step 4&lt;br /&gt;&lt;br /&gt;Now execute the sysmail_add_profileaccount procedure, to add the Database Mail account we created in step 2, to the Database Mail profile you created in step 3.&lt;br /&gt;&lt;br /&gt;Please execute the statement below.&lt;br /&gt;&lt;br /&gt;EXECUTE msdb.dbo.sysmail_add_profileaccount_sp&lt;br /&gt;    @profile_name = 'MyMailProfile',&lt;br /&gt;    @account_name = 'MyMailAccount',&lt;br /&gt;    @sequence_number = 1&lt;br /&gt;&lt;br /&gt;Step 5&lt;br /&gt;&lt;br /&gt;Use the sysmail_add_principalprofile procedure to grant the Database Mail profile access to the msdb public database role and to make the profile the default Database Mail profile.&lt;br /&gt;&lt;br /&gt;Please execute the statement below.&lt;br /&gt;&lt;br /&gt;EXECUTE msdb.dbo.sysmail_add_principalprofile_sp&lt;br /&gt;    @profile_name = 'MyMailProfile',&lt;br /&gt;    @principal_name = 'public',&lt;br /&gt;    @is_default = 1 ;&lt;br /&gt;&lt;br /&gt;Step 6&lt;br /&gt;&lt;br /&gt;Now let us send a test email from SQL Server. &lt;br /&gt;&lt;br /&gt;Please execute the statement below.&lt;br /&gt;&lt;br /&gt;declare @body1 varchar(100)&lt;br /&gt;set @body1 = 'Server :'+@@servername+ ' My First Database Email '&lt;br /&gt;EXEC msdb.dbo.sp_send_dbmail @recipients='mak_999@yahoo.com',&lt;br /&gt;    @subject = 'My Mail Test',&lt;br /&gt;    @body = @body1,&lt;br /&gt;    @body_format = 'HTML' ;&lt;br /&gt;&lt;br /&gt;You will get the message&lt;br /&gt;   &lt;span style="font-style:italic;"&gt;Mail queued&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-1640892105100356684?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/1640892105100356684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=1640892105100356684' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/1640892105100356684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/1640892105100356684'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2007/08/sql-mail-problems-that-we-faced-in-sql.html' title='Database Mail'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-7045079773778478578</id><published>2007-08-11T10:57:00.000+05:30</published><updated>2007-08-11T11:00:19.866+05:30</updated><title type='text'>Sending Mail in ASP.NET 2.0</title><content type='html'>&lt;p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"&gt;&lt;span style="font-size: 10pt; color: teal; font-family: 'Courier New';"&gt;MailMessage&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt; message = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: teal;"&gt;MailMessage&lt;/span&gt;();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt;message.From = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: teal;"&gt;MailAddress&lt;/span&gt;(&lt;span style="color: maroon;"&gt;"sender@foo.bar.com"&lt;/span&gt;);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt;message.To.Add(&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: teal;"&gt;MailAddress&lt;/span&gt;(&lt;span style="color: maroon;"&gt;"recipient1@foo.bar.com"&lt;/span&gt;));&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt;message.To.Add(&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: teal;"&gt;MailAddress&lt;/span&gt;(&lt;span style="color: maroon;"&gt;"recipient2@foo.bar.com"&lt;/span&gt;));&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt;message.To.Add(&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: teal;"&gt;MailAddress&lt;/span&gt;(&lt;span style="color: maroon;"&gt;"recipient3@foo.bar.com"&lt;/span&gt;));&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt;message.CC.Add(&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: teal;"&gt;MailAddress&lt;/span&gt;(&lt;span style="color: maroon;"&gt;"carboncopy@foo.bar.com"&lt;/span&gt;));&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt;message.Subject = &lt;span style="color: maroon;"&gt;"This is my subject"&lt;/span&gt;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt;message.Body = &lt;span style="color: maroon;"&gt;"This is the content"&lt;/span&gt;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"&gt;&lt;span style="font-size: 10pt; color: teal; font-family: 'Courier New';"&gt;SmtpClient&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt; client = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: teal;"&gt;SmtpClient&lt;/span&gt;();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt;client.Send(message);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;span style="font-family:Times New Roman;font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size:85%;"&gt;System.Net.Mail  reads SMTP configuration data out of the standard .NET configuration system (so  for ASP.NET applications you’d configure this in your application’s web.config  file).&lt;span style=""&gt;  &lt;/span&gt;Here is an example of how to  configure it:&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;span style="font-family:Times New Roman;font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: 'Courier New';"&gt;system.net&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;     &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: 'Courier New';"&gt;mailSettings&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;       &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: 'Courier New';"&gt;smtp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; color: red; font-family: 'Courier New';"&gt;from&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt;"&lt;span style="color: blue;"&gt;test@foo.com&lt;/span&gt;"&lt;span style="color: blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;         &lt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: 'Courier New';"&gt;network&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; color: red; font-family: 'Courier New';"&gt;host&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;=&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt;"&lt;span style="color: blue;"&gt;smtpserver1&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;port&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;25&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;userName&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;username&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;password&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;secret&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;defaultCredentials&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;true&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;       &lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: 'Courier New';"&gt;smtp&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;     &lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: 'Courier New';"&gt;mailSettings&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/&lt;/span&gt;&lt;span style="font-size: 10pt; color: maroon; font-family: 'Courier New';"&gt;system.net&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue; font-family: 'Courier New';"&gt;&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size:85%;"&gt;Hope this  helps,&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold;"&gt;Ganesh&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-7045079773778478578?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/7045079773778478578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=7045079773778478578' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/7045079773778478578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/7045079773778478578'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2007/08/sending-mail-in-aspnet-20.html' title='Sending Mail in ASP.NET 2.0'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9116576033881093520.post-7032421111185980369</id><published>2007-08-11T10:49:00.000+05:30</published><updated>2007-08-11T10:52:40.803+05:30</updated><title type='text'>ASP.Net 2.0: Export GridView to Excel</title><content type='html'>&lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;" nxqnl="0" iyrzx="0"&gt;&lt;span&gt;The  code to do the Excel Export is very straightforward. You can also export to  different application type by changing the content-disposition and  ContentType. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; font-style: italic;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;" nxqnl="0" iyrzx="0"&gt;&lt;span&gt;string&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;" nxqnl="0" iyrzx="0"&gt;&lt;span&gt; attachment = &lt;span style="color: maroon;" nxqnl="0" iyrzx="0"&gt;"attachment; filename=Contacts.xls"&lt;/span&gt;;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; font-style: italic;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;" nxqnl="0" iyrzx="0"&gt;&lt;span&gt;Response.ClearContent();&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-style: italic;font-size:85%;" &gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; font-style: italic;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;" nxqnl="2" iyrzx="0"&gt;&lt;span&gt;Response.AddHeader(&lt;span style="color: maroon;" nxqnl="0" iyrzx="0"&gt;"content-disposition"&lt;/span&gt;, attachment);&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-style: italic;font-size:85%;" &gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; font-style: italic;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;" nxqnl="0" iyrzx="0"&gt;&lt;span&gt;Response.ContentType = &lt;span style="color: maroon;" nxqnl="0" iyrzx="0"&gt;"application/ms-excel"&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-style: italic;font-size:85%;" &gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; font-style: italic;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 10pt; color: teal; font-family: Verdana;" nxqnl="0" iyrzx="0"&gt;&lt;span&gt;StringWriter&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;" nxqnl="4" iyrzx="0"&gt;&lt;span&gt; sw = &lt;span style="color: blue;" nxqnl="0" iyrzx="0"&gt;new&lt;/span&gt; &lt;span style="color: teal;" nxqnl="0" iyrzx="0"&gt;StringWriter&lt;/span&gt;();&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; font-style: italic;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 10pt; color: teal; font-family: Verdana;" nxqnl="0" iyrzx="0"&gt;&lt;span&gt;HtmlTextWriter&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;" nxqnl="4" iyrzx="0"&gt;&lt;span&gt; htw = &lt;span style="color: blue;" nxqnl="0" iyrzx="0"&gt;new&lt;/span&gt; &lt;span style="color: teal;" nxqnl="0" iyrzx="0"&gt;HtmlTextWriter&lt;/span&gt;(sw);&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; font-style: italic;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;" nxqnl="0" iyrzx="0"&gt;&lt;span&gt;GridView1.RenderControl(htw);&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-style: italic;font-size:85%;" &gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; font-style: italic;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;" nxqnl="0" iyrzx="0"&gt;&lt;span&gt;Response.Write(sw.ToString());&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-style: italic;font-size:85%;" &gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-style: italic;font-size:85%;" &gt;&lt;span style="font-size: 10pt; font-family: Verdana;" nxqnl="0" iyrzx="0"&gt;&lt;span&gt;Response.End();&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span&gt;&lt;span style="font-style: italic;font-size:85%;" &gt; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;" nxqnl="0" iyrzx="0"&gt;&lt;span&gt;If  you run the code as above, it will result in an HttpException as follows:  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="background: rgb(153, 153, 153) none repeat scroll 0% 50%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: Verdana;" nxqnl="0" iyrzx="0"&gt;&lt;span&gt;Control 'GridView1' of type 'GridView' must be placed inside  a form tag with runat=&lt;a class="kLink" oncontextmenu="return false;" id="KonaLink1" onmouseover="adlinkMouseOver(event,this,1);" style="position: static; text-decoration: underline ! important;" onclick="adlinkMouseClick(event,this,1);" onmouseout="adlinkMouseOut(event,this,1);" href="http://www.c-sharpcorner.com/UploadFile/DipalChoksi/exportxl_asp2_dc11032006003657AM/exportxl_asp2_dc.aspx#" target="_top"&gt;&lt;span style="font-weight: 400; font-size: 10pt; color: green ! important; font-family: Verdana; position: static;color:green;" &gt;&lt;span class="kLink" style="font-weight: 400; font-size: 10pt; color: green ! important; font-family: Verdana; position: relative;"&gt;server&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;."&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: 10pt; font-family: Verdana;" nxqnl="0" iyrzx="0"&gt;&lt;span&gt;To  avoid this error, add the following code:  &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; font-style: italic;"&gt;&lt;span style="font-size: 10pt; color: blue; font-family: Verdana;" nxqnl="0" iyrzx="0"&gt;&lt;span&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;" nxqnl="6" iyrzx="0"&gt;&lt;span&gt; &lt;span style="color: blue;" nxqnl="0" iyrzx="0"&gt;override&lt;/span&gt; &lt;span style="color: blue;" nxqnl="0" iyrzx="0"&gt;void&lt;/span&gt; VerifyRenderingInServerForm(&lt;span style="color: teal;" nxqnl="0" iyrzx="0"&gt;Control&lt;/span&gt; control)&lt;u1:p&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; font-style: italic;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;" nxqnl="0" iyrzx="0"&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;u1:p style="font-style: italic;"&gt;&lt;/u1:p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; font-style: italic;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;u1:p&gt;&lt;span&gt; &lt;/span&gt;&lt;/u1:p&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-size: 10pt; font-family: Verdana; font-style: italic;" nxqnl="0" iyrzx="0"&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: Verdana;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9116576033881093520-7032421111185980369?l=ganeshpawade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ganeshpawade.blogspot.com/feeds/7032421111185980369/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9116576033881093520&amp;postID=7032421111185980369' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/7032421111185980369'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9116576033881093520/posts/default/7032421111185980369'/><link rel='alternate' type='text/html' href='http://ganeshpawade.blogspot.com/2007/08/aspnet-20-export-gridview-to-excel.html' title='ASP.Net 2.0: Export GridView to Excel'/><author><name>Ganesh</name><uri>http://www.blogger.com/profile/18338370261743080117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
