<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Ranjan's Weblog</title>
	<atom:link href="http://ranjanaspnet.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ranjanaspnet.wordpress.com</link>
	<description>Asp.Net weblog on WordPress.com</description>
	<lastBuildDate>Mon, 12 Nov 2007 10:28:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='ranjanaspnet.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Ranjan's Weblog</title>
		<link>http://ranjanaspnet.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ranjanaspnet.wordpress.com/osd.xml" title="Ranjan&#039;s Weblog" />
	<atom:link rel='hub' href='http://ranjanaspnet.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Inserting record in table with generating new id for primary key field using single query</title>
		<link>http://ranjanaspnet.wordpress.com/2007/11/12/inserting-record-in-table-with-generating-new-id-for-primary-key-field-using-single-query/</link>
		<comments>http://ranjanaspnet.wordpress.com/2007/11/12/inserting-record-in-table-with-generating-new-id-for-primary-key-field-using-single-query/#comments</comments>
		<pubDate>Mon, 12 Nov 2007 10:21:32 +0000</pubDate>
		<dc:creator>ranjanaspnet</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://ranjanaspnet.wordpress.com/2007/11/12/inserting-record-in-table-with-generating-new-id-for-primary-key-field-using-single-query/</guid>
		<description><![CDATA[Query to Insert new record in table with generating new id in key column If no records exist then new id is 1 else new id is greater then 1 of maximum id. Example : Inserting new product in product_master : - Note : Assuming that productid is of type int. Insert into product_master (productid,product_name,created_date) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=18&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><em>Query to Insert new record in table with generating new id in key column<br />
If no records exist then new id is 1 else new id is greater then 1 of maximum id.</em></p>
<p>Example :</p>
<p>Inserting new product in product_master : -</p>
<p>Note : Assuming that productid is of type int.</p>
<p>Insert into product_master (productid,product_name,created_date)<br />
select (select isnull(max(productid)+1,1) from product_master),&#8217;CPU&#8217;,getdate()</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ranjanaspnet.wordpress.com/18/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ranjanaspnet.wordpress.com/18/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjanaspnet.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjanaspnet.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjanaspnet.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjanaspnet.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjanaspnet.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjanaspnet.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjanaspnet.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjanaspnet.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjanaspnet.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjanaspnet.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjanaspnet.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjanaspnet.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjanaspnet.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjanaspnet.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=18&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjanaspnet.wordpress.com/2007/11/12/inserting-record-in-table-with-generating-new-id-for-primary-key-field-using-single-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/613d9954a93c3e79c03fb1f9bc448a8c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">ranjan</media:title>
		</media:content>
	</item>
		<item>
		<title>Basic of Ajax</title>
		<link>http://ranjanaspnet.wordpress.com/2007/11/07/basic-of-ajax/</link>
		<comments>http://ranjanaspnet.wordpress.com/2007/11/07/basic-of-ajax/#comments</comments>
		<pubDate>Wed, 07 Nov 2007 08:06:31 +0000</pubDate>
		<dc:creator>ranjanaspnet</dc:creator>
				<category><![CDATA[Ajax]]></category>

		<guid isPermaLink="false">http://ranjanaspnet.wordpress.com/2007/11/07/basic-of-ajax/</guid>
		<description><![CDATA[Article Contents: Introduction How to make an HTTP request and handle the response? Advantages &#38; Disadvantages of Using Ajax Where to Use &#38; Where Not to Use Ajax? Conclusion   Introduction   Ajax is the shorthand notation for Asynchronous JavaScript and XML. It is a web development technique that is used for developing interactive web [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=17&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<table border="0" width="100%" cellPadding="0" style="width:100%;" class="MsoNormalTable">
<tr>
<td vAlign="top" style="background-color:transparent;border:#d4d0c8;padding:0.75pt;"><strong><span style="font-size:10pt;font-family:Verdana;">Article Contents</span></strong><span style="font-size:10pt;font-family:Verdana;">: </span></p>
<ul>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;"><a href="http://aspalliance.com/1395_Basics_of_Ajax.all#Page1#Page1"><span style="color:#900b09;">Introduction </span></a></span></li>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;"><a href="http://aspalliance.com/1395_Basics_of_Ajax.all#Page2#Page2"><span style="color:#900b09;">How to make an HTTP request and handle the response? </span></a></span></li>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;"><a href="http://aspalliance.com/1395_Basics_of_Ajax.all#Page3#Page3"><span style="color:#900b09;">Advantages &amp; Disadvantages of Using Ajax </span></a></span></li>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;"><a href="http://aspalliance.com/1395_Basics_of_Ajax.all#Page4#Page4"><span style="color:#900b09;">Where to Use &amp; Where Not to Use Ajax? </span></a></span></li>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;"><a href="http://aspalliance.com/1395_Basics_of_Ajax.all#Page5#Page5"><span style="color:#900b09;">Conclusion </span></a></span></li>
</ul>
<p><span style="font-size:10pt;font-family:Verdana;"> </span></td>
</tr>
<tr>
<td vAlign="top" style="background-color:transparent;border:#d4d0c8;padding:0.75pt;">
<p align="center" style="text-align:center;margin:0;" class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;"><br />
<hr SIZE="2" noShade="true" width="100%" align="center" /></span></p>
<p><span style="font-size:10pt;font-family:Verdana;"></span></td>
</tr>
<tr>
<td vAlign="top" style="background-color:transparent;border:#d4d0c8;padding:0.75pt;"><span><strong><span style="font-size:8pt;color:#cc0000;font-family:Verdana;">Introduction</span></strong></span></td>
</tr>
<tr>
<td vAlign="top" style="background-color:transparent;border:#d4d0c8;padding:0.75pt;"><span style="font-size:10pt;font-family:Verdana;"> </span></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3"><font face="Times New Roman">Ajax is the shorthand notation for Asynchronous JavaScript and XML. It is a web development technique that is used for developing interactive web applications. Ajax develops interactive web application by sending a small amount of data to the server behind the scenes. The advantage of this is that the entire page is not reloaded every time when the user makes some changes in the input. It may seem that Ajax is some new technology. But that is not true. It is a new way of combining old technologies and representing them in a new way.</font></font></p>
<p><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">XHTML and CSS &#8211; for presentation</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">Document Object Model (DOM) &#8211; for dynamic display and interaction</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">XML and XSLT &#8211; for data interchange and manipulation</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">XMLHttpRequest &#8211; for asynchronous data retrieval</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">Java Script &#8211; for binding everything together</span></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">Before going deep into Ajax, let us discuss some basics of web applications. When a person sits down to develop an application, he has two choices before him.</font></p>
<p><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">Desktop application </span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">Web application </span></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">Desktop applications normally come on a CD or are sometimes downloaded from some web site and are installed completely on the computer. Desktop application may use Internet sometimes to download some updates, but the code which is responsible for running those applications reside on the desktop only. On the other hand, Web applications run on a Web server which is present somewhere else and a person accesses those applications with the help of his browser.</font></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">Desktop applications are pretty fast since they do not require any Internet connection to run and they have great user interfaces. They are also incredibly dynamic. A person can pull up menus and sub-menus and can do many more things without waiting for anything. And this feature is almost opposite to what happens in a web application. No doubt that the services provided by Web applications can never be provided by any desktop application, but it is also true that the user has to wait for everything in a Web application. Since Web applications use an Internet connection they are normally slower that desktop applications. A user has to wait to get a response back from the server, for the web page to get refreshed, etc.</font></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">Now coming down to our topic, normally what happens in most of the classical web application is that any user request sends a HTTP request to a web server. The server does some processing to give back the response and then returns an HTML page to the user. But every time the user submits the page to the server, the server responds with a totally new page which makes the application run slower and is less user-friendly. An Ajax application eliminates this disadvantage by incorporating a middle layer between the user and the server. That intermediate layer is the Ajax engine.</font></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">Actually, what happens here is that instead of loading a web page, at the start of the session the browser loads the Ajax engine. The Ajax engine is written in JavaScript and is usually placed in a hidden frame. This engine is responsible for communicating with the server and the user; i.e. it acts as the link between the server and user machine. The Ajax engine allows asynchronous interaction of the user with the application, independent of communication with the server. So here, the user does not have to keep waiting for the response from the server. In Ajax every user action that would create any HTTP request takes the form of a JavaScript call to the Ajax engine. Any user request that can be fulfilled by the engine is done by the engine itself without bothering the server. But any user request which requires the server interference, the engine makes those requests asynchronously, usually using XML, without stopping the user interaction with the application.</font></p>
</td>
</tr>
<tr>
<td vAlign="top" style="background-color:transparent;border:#d4d0c8;padding:0.75pt;"><span><strong><span style="font-size:8pt;color:#cc0000;font-family:Verdana;">How to make an HTTP request and handle the response?</span></strong></span></td>
</tr>
<tr>
<td vAlign="top" style="background-color:transparent;border:#d4d0c8;padding:0.75pt;"><span style="font-size:10pt;font-family:Verdana;"> </span></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">In order to make an HTTP request to the server using JavaScript, an instance of a class that provides this functionality is required. Such a class was originally introduced in Internet Explorer as an ActiveX object and is called XMLHTTP. Then Mozilla, Safari and other browsers also followed and started implementing an XMLHttpRequest class that supports the methods and properties supported by Microsoft&#8217;s original ActiveX object.</font></p>
<p><strong><span style="font-size:10pt;color:#ce0000;font-family:Verdana;">Create a new XMLHttpRequest</span></strong><strong><u><span style="font-size:10pt;font-family:Verdana;">Listing 1</span></u></strong><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">&lt;</span><span style="font-size:8.5pt;color:maroon;font-family:'Courier New';">script</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">language</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">=&#8221;javascript&#8221;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">type</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">=&#8221;text/javascript&#8221;&gt;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">  var XMLHttp=new xmlHttpRequest();</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">&lt;/</span><span style="font-size:8.5pt;color:maroon;font-family:'Courier New';">script</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">&gt;</span><span style="font-size:10pt;font-family:'Courier New';"></span></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">This is the object which handles all the server communication.</font></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">In normal Web applications the users fill out form fields and then click a Submit button. Then, the entire form is sent to the server which passes it on to some script. When the script has finished its work, it sends back a completely new page as the response. But during the time the script or program on the server is processing and returning a new form, users have to wait the entire time.</font></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">But in the case of Ajax, it puts the Javascript technology and the XMLHttpRequest object between the user&#8217;s Web form and the server. When users fill out forms, the data, rather than being directly sent to the server, is sent to a Javascript code. Thus, here Javascript code catches the form data and sends a request to the server.</font></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">In order to create a cross-browser instance (object) of the required class we need to write the code.</font></p>
<p><strong><u><span style="font-size:10pt;font-family:Verdana;">Listing 2</span></u></strong><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">if</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> (window.xmlHttpRequest)</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">{</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">  </span><span style="font-size:8.5pt;color:green;font-family:'Courier New';">// for Mozilla, Safari, etc.</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">  XMLHttp </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">=</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">new</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> xmlHttpRequest();</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">}</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">elseif(window.ActiveXObject)</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">{</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">  </span><span style="font-size:8.5pt;color:green;font-family:'Courier New';">// for Internet Explorer</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">  XMLHttp </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">=</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">new</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> ActiveXObject(</span><span style="font-size:8.5pt;background:#e4e4e4;color:#666666;font-family:'Courier New';">&#8220;Microsoft.XMLHTTP&#8221;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">);</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">}</span><span style="font-size:10pt;font-family:'Courier New';"></span></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">Microsoft&#8217;s browser (Internet Explorer) uses the MSXML parser for handling XML. MSXML has two different versions, so we need to write code that handles both cases. Thus the code goes as shown below.</font></p>
<p><strong><u><span style="font-size:10pt;font-family:Verdana;">Listing 3</span></u></strong><span style="font-size:8.5pt;color:black;font-family:'Courier New';">var XMLHttp </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">=</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">false</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">;</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">try</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">{</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">  XMLHttp </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">=</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">new</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> ActiveXObject(</span><span style="font-size:8.5pt;background:#e4e4e4;color:#666666;font-family:'Courier New';">&#8220;Msxml2.XMLHTTP&#8221;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">);</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">}</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">catch</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> (e)</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">{</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">  </span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">try</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">  {</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">    XMLHttp </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">=</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">new</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> ActiveXObject(</span><span style="font-size:8.5pt;background:#e4e4e4;color:#666666;font-family:'Courier New';">&#8220;Microsoft.XMLHTTP&#8221;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">);</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">  }</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">}</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">if</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> (XMLHttp == </span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">false</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">)</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">{</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">  XMLHttp </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">=</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">new</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> XMLHttpRequest();</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">}</span><span style="font-size:10pt;font-family:'Courier New';"></span></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">The above code tries to create the object in one version of MSXML. If XMLHttp still has its value as false, it tries to create the object in the standard way.</font></p>
<p><strong><span style="font-size:10pt;color:#ce0000;font-family:Verdana;">Making a Request</span></strong></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">First of all, a JavaScript method is required, which the web page can call. Then we need to do the following.</font></p>
<p><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">Get the required data from the Web form</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">Build the URL for connecting</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">Open a connection to the server</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">Write a function that the server can run when it is done with its work</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">Send the request</span></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">For this the required coding.</font></p>
<p><strong><u><span style="font-size:10pt;font-family:Verdana;">Listing 4</span></u></strong><span style="font-size:8.5pt;color:black;font-family:'Courier New';">function getData() {</span><span style="font-size:8.5pt;color:green;font-family:'Courier New';">// Get the data in the name field from the web form</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">var name </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">=</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> document.getElementById(</span><span style="font-size:8.5pt;background:#e4e4e4;color:#666666;font-family:'Courier New';">&#8220;name&#8221;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">).value;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:green;font-family:'Courier New';">// Proceed only if there is value for the field</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">if</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> ((name == </span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">null</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">) || (name == </span><span style="font-size:8.5pt;background:#e4e4e4;color:#666666;font-family:'Courier New';">&#8220;&#8221;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">)) </span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">return</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:green;font-family:'Courier New';">// Build the URL to connect to</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">var url </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">=</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;background:#e4e4e4;color:#666666;font-family:'Courier New';">&#8220;/scripts/getAnswer.php?name=&#8221;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">+</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> escape(name);</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:green;font-family:'Courier New';">// Setup a function for the server to run when it&#8217;s done</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">XMLHttp.onreadystatechange </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">=</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> showSuggestion;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:green;font-family:'Courier New';">// Open a connection to the server</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">XMLHttp.open(</span><span style="font-size:8.5pt;background:#e4e4e4;color:#666666;font-family:'Courier New';">&#8220;GET&#8221;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">, url, </span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">true</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">);</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:green;font-family:'Courier New';">// Send the request</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">XMLHttp.send(</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">null</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">);</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">}</span><span style="font-size:10pt;font-family:'Courier New';"></span></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">The first part of the code is simple JavaScript used to catch the form data. Then the code sets a PHP script as the destination for connecting to. First, the URL is specified and then the value of the name field is appended to it. Then the onreadystatechange property has been used to inform the HTTP request object about the JavaScript function to run after getting the response from the server. This function handles further processing of the response sent by the server. To make the actual request, a person needs to call the open() and send() methods of the HTTP request class. The first parameter of the open() function is the request method which can be GET,POST,HEAD or any other method supported by the person&#8217;s browser. The second parameter is the URL of the page the person requests. The third parameter sets whether the request is asynchronous or not. If TRUE, the execution of the JavaScript function will continue while the response of the server has not yet arrived and if set to false, it will wait for the server response which destroys the very meaning of Ajax i.e. asynchronous data retrieval. Finally, send() is called with a value of null. Since the data to be sent to the server (the value of the name field) has already been added in the request URL, it is not required to send anything in the request. So this triggers the request and the server can do what it has been asked to do.</font></p>
<p><strong><span style="font-size:10pt;color:#ce0000;font-family:Verdana;">Handling the Response</span></strong></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">First, the function needs to check for the state of the request. If the state has the value of 4, it means that the full server response has already been received and it is OK to continue with the processing.</font></p>
<p><strong><u><span style="font-size:10pt;font-family:Verdana;">Listing 5</span></u></strong><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">if</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> (XMLHttp.readyState == 4)</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">{</span><span style="font-size:8.5pt;color:green;font-family:'Courier New';">// the response has been fully received</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">}</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">else</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">{</span><span style="font-size:8.5pt;color:green;font-family:'Courier New';">// still not ready with the response</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">}</span><span style="font-size:10pt;font-family:'Courier New';"></span></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">The full list of the &#8220;readystate&#8221; values is shown below:</font></p>
<p><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">0: The request is uninitialized (before open() is called).</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">1: The request is set up, but has not been sent yet (before send() is called).</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">2: The request was sent and is being processed at present.</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">3: The request is being processed; often some partial data is available, but the server has not finished with the response.</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">4: The response is complete and can be used.</span></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">The next thing to check is the status code of the HTTP server response. Here it is required to check only the &#8220;200&#8243; i.e. &#8220;OK&#8221; response.</font></p>
<p><strong><u><span style="font-size:10pt;font-family:Verdana;">Listing 6</span></u></strong><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">if</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> (XMLHttp .status == 200)</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">{</span><span style="font-size:8.5pt;color:green;font-family:'Courier New';">// you can move on</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">}</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">else</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">{</span><span style="font-size:8.5pt;color:green;font-family:'Courier New';">// there was a problem with the request,</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:green;font-family:'Courier New';">// (example-the response may be a 404 (i.e. Not Found)</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">}</span><span style="font-size:10pt;font-family:'Courier New';"></span></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">Now, after checking the state of the request and the HTTP status code of the response, a person needs to decide what to do with the server response. There are two options to access that data:</font></p>
<p><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">XMLHttp.responseText – will return the server response as a string of text </span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">XMLHttp.responseXML – will return the response as an XMLDocument object</span></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">The code is as shown:</font></p>
<p><strong><u><span style="font-size:10pt;font-family:Verdana;">Listing 7</span></u></strong><span style="font-size:8.5pt;color:black;font-family:'Courier New';">function showSuggestion()</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">{</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">  </span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">if</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> (XMLHttp.readyState == 4)</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">  {</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">    </span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">if</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> (XMLHttp.status == 200)</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">    {</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">      var response </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">=</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> XMLHttp.responseText;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">      document.getElementById(</span><span style="font-size:8.5pt;background:#e4e4e4;color:#666666;font-family:'Courier New';">&#8220;Suggestion&#8221;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">).value </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">=</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> response;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">    }</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">    </span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">else</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">    {</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">      alert(&#8216;There was a problem with the request.&#8217;);</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">    }</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">  }</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">}</span><span style="font-size:10pt;font-family:'Courier New';"></span></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">It waits for the server to call it with the proper ready state and status. Then it uses the data returned by the server (in this case, the suggestions for the data entered by the user) to set the value of another form field. The result is that the Suggestion field suddenly appears with the suggestions for the name field but without requiring the user to click a submit button.</font></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">Finally, here goes the HTML form.</font></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">In this form there is a text input for the user to enter data and another placeholder to show the suggestions.</font></p>
<p><strong><u><span style="font-size:10pt;font-family:Verdana;">Listing 8</span></u></strong><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">&lt;</span><span style="font-size:8.5pt;color:maroon;font-family:'Courier New';">form</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">&gt;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">&lt;</span><span style="font-size:8.5pt;color:maroon;font-family:'Courier New';">p</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">&gt;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">Name: </span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">&lt;</span><span style="font-size:8.5pt;color:maroon;font-family:'Courier New';">input</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">type</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">=&#8221;text&#8221;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">name</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">=&#8221;name&#8221;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">id</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">=&#8221;name&#8221;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">size</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">=&#8221;25&#8243;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">onChange</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">=&#8221;getData();&#8221;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">/&gt;&lt;/</span><span style="font-size:8.5pt;color:maroon;font-family:'Courier New';">p</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">&gt;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">&lt;</span><span style="font-size:8.5pt;color:maroon;font-family:'Courier New';">p</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">&gt;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';">Suggestion: </span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">&lt;</span><span style="font-size:8.5pt;color:maroon;font-family:'Courier New';">span</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"> </span><span style="font-size:8.5pt;color:red;font-family:'Courier New';">id</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">=&#8221;Suggestion&#8221;&gt;&lt;/</span><span style="font-size:8.5pt;color:maroon;font-family:'Courier New';">span</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">&gt;&lt;/</span><span style="font-size:8.5pt;color:maroon;font-family:'Courier New';">p</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">&gt;</span><span style="font-size:8.5pt;color:black;font-family:'Courier New';"></span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">&lt;/</span><span style="font-size:8.5pt;color:maroon;font-family:'Courier New';">form</span><span style="font-size:8.5pt;color:blue;font-family:'Courier New';">&gt;</span><span style="font-size:10pt;font-family:'Courier New';"></span></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">Here, span is used as a placeholder for data retrieved from the web server. When a user writes in a new value for name field, the getData() method is called up and the user is able to view the suggestions without having to click a button. This is what makes Ajax grab the attention of the developers.</font></p>
</td>
</tr>
<tr>
<td vAlign="top" style="background-color:transparent;border:#d4d0c8;padding:0.75pt;"><span><strong><span style="font-size:8pt;color:#cc0000;font-family:Verdana;">Advantages &amp; Disadvantages of Using Ajax</span></strong></span></td>
</tr>
<tr>
<td vAlign="top" style="background-color:transparent;border:#d4d0c8;padding:0.75pt;"><span style="font-size:10pt;font-family:Verdana;"> </span><strong><span style="font-size:10pt;color:#ce0000;font-family:Verdana;">Advantages</span></strong></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">Everything has its own merits and demerits, Ajax included.</font></p>
<p><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">The application seems to become more responsive and interactive as the user gets the response without clicking any buttons.</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">In classic web application, when the web server responds to the web browser with a new page, it may make use of multiple connection threads in order to speed up the process, but this happens for the content only (which is between &lt;body&gt; tags). The CSS as well as the script files present in the head section are transferred using only one connection thread which results in performance degradation. With Ajax, it is required to load only the basic script and CSS files. Rests are requested as content using multiple connections.</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">A big advantage is that the user is not required to keep on waiting and waiting.</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">One more important merit is traffic to and from the server is reduced a considerable amount.</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">If a section of a page encounters any error, other sections do not get affected and the data entered by the user is also not lost.</span><strong><span style="font-size:10pt;color:#ce0000;font-family:Verdana;">Disadvantages</span></strong><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">Ajax</span><span style="font-size:10pt;font-family:Verdana;"> application development may lead to increase in development time and cost.</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">The biggest concern is accessibility because all browsers do not completely support Javascript and xmlHttpRequest object. </span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">Using Ajax to asynchronously load bits of data into the existing page conflicts the way the users are used to viewing, navigating and creating bookmarks in a modern browser.</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">Another disadvantage lies in the xmlHttpRequest object itself because one can use it to access information from the host that served the “initial page” (due to security reasons).</span></td>
</tr>
<tr>
<td vAlign="top" style="background-color:transparent;border:#d4d0c8;padding:0.75pt;"><span><strong><span style="font-size:8pt;color:#cc0000;font-family:Verdana;">Where to Use &amp; Where Not to Use Ajax?</span></strong></span></td>
</tr>
<tr>
<td vAlign="top" style="background-color:transparent;border:#d4d0c8;padding:0.75pt;"><span style="font-size:10pt;font-family:Verdana;"> </span></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">Here is a list of a few areas where one should and where one should not use Ajax.</font></p>
<p><strong><span style="font-size:10pt;color:#ce0000;font-family:Verdana;">To be used when:</span></strong><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">The application involves heavy server requests, with multiple web forms that submit data to the server.</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">It is required to display large amount of data in sequence without refreshing the page.</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">Application response time and loading time is a matter of concern.</span><strong><span style="font-size:10pt;color:#ce0000;font-family:Verdana;">Not to be used when:</span></strong><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">Using plain, static HTML pages</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">Users do not interact with the application often.</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">Loading time and bandwidth usage is not a matter of concern.</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">The application is needed to be viewed in older browsers or over various versions of the browser.</span><span style="font-size:10pt;font-family:Symbol;">·</span><span style="font-size:7pt;"><font face="Times New Roman">         </font></span><span style="font-size:10pt;font-family:Verdana;">Time and cost constitute important factors for a project development.</span></td>
</tr>
<tr>
<td vAlign="top" style="background-color:transparent;border:#d4d0c8;padding:0.75pt;"><span><strong><span style="font-size:8pt;color:#cc0000;font-family:Verdana;">Conclusion</span></strong></span></td>
</tr>
<tr>
<td vAlign="top" style="background-color:transparent;border:#d4d0c8;padding:0.75pt;"><span style="font-size:10pt;font-family:Verdana;"> </span></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">Finally, I would like to conclude that by using Ajax, Internet applications can be made more responsive, more interactive and more user friendly, but at the same time Ajax has its own demerits. So before using it, sit back and think over whether by using Ajax in your applications you are getting rid of your problems or you are running into some other deeper problems.</font></p>
<p style="margin:0 0 6pt;" class="MsoNormal"><font size="3" face="Times New Roman">By Debjani Mallick</font></p>
</td>
</tr>
</table>
<p><font face="Times New Roman"> </font></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ranjanaspnet.wordpress.com/17/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ranjanaspnet.wordpress.com/17/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjanaspnet.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjanaspnet.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjanaspnet.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjanaspnet.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjanaspnet.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjanaspnet.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjanaspnet.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjanaspnet.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjanaspnet.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjanaspnet.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjanaspnet.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjanaspnet.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjanaspnet.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjanaspnet.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=17&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjanaspnet.wordpress.com/2007/11/07/basic-of-ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/613d9954a93c3e79c03fb1f9bc448a8c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">ranjan</media:title>
		</media:content>
	</item>
		<item>
		<title>Sql Invalid Cache</title>
		<link>http://ranjanaspnet.wordpress.com/2007/11/06/sql-invalid-cache/</link>
		<comments>http://ranjanaspnet.wordpress.com/2007/11/06/sql-invalid-cache/#comments</comments>
		<pubDate>Tue, 06 Nov 2007 04:44:43 +0000</pubDate>
		<dc:creator>ranjanaspnet</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://ranjanaspnet.wordpress.com/2007/11/06/sql-invalid-cache/</guid>
		<description><![CDATA[Introducing Cache Dependencies: As time passes, the data source may change in response to other actions. However, if your code uses caching, you may remain unaware of the changes and continue using out-of-date information from the cache. To help mitigate this problem, ASP.NET supports cache dependencies. Cache dependencies allow you to make a cached item [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=16&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2><span style="font-size:10pt;font-family:Verdana;">Introducing Cache Dependencies:</span><span style="font-family:Verdana;"></span></h2>
<p><span style="font-size:10pt;font-family:Verdana;">As time passes, the data source may change in response to other actions. However, if your code uses caching, you may remain unaware of the changes and continue using out-of-date information from the cache. To help mitigate this problem, ASP.NET supports cache dependencies. Cache dependencies allow you to make a cached item dependent on another resource so that when that resource changes the cached item is removed automatically. ASP.NET includes three types of dependencies:</span></p>
<ul>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;">Dependencies on other cache items. </span></li>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;">Dependencies on files or folders. </span></li>
<li class="MsoNormal"><span style="font-size:10pt;font-family:Verdana;">Dependencies on a database query. </span></li>
</ul>
<h2><span style="font-size:10pt;font-family:Verdana;">Introducing SQL Cache Notifications:</span><span style="font-family:Verdana;"></span></h2>
<p><span style="font-size:10pt;font-family:Verdana;">SQL cache dependencies are one of the most wonderful new features in ASP.NET 2.0, the ability to automatically invalidate a cached data object (such as a DataSet or Custom Data Type) when the related data is modified in the database. This feature is supported in both SQL Server 2005 and in SQL Server 2000, although the underlying plumbing is quite different.</span></p>
<h2><span style="font-size:10pt;font-family:Verdana;">Cache Notifications in SQL Server 2000:</span><span style="font-family:Verdana;"></span></h2>
<p><span style="font-size:10pt;font-family:Verdana;">Before you can use SQL Server cache invalidation, you need to enable notifications for the database. This task is performed with the <strong>aspnet_regsql.exe</strong> command-line utility, which is located in the c:\[WinDir]\Microsoft.NET\Framework\[Version] directory. To enable notifications, you need to use the <strong>-ed</strong> command-line switch. You also need to identify the server (use <strong>-E</strong> for a trusted connection and <strong>-S</strong> to choose a server other than the current computer) and the database (use <strong>-d</strong>). Here&#8217;s an example that enables notifications for the <strong>Northwind</strong> database on the current server:</p>
<p><strong><span style="background:silver;">aspnet_regsql -ed -E -d Northwind</span><br />
</strong><br />
After executing this command, a new table named <strong>SqlCacheTablesForChangeNotification</strong> is added to the database Northwind. The <strong>SqlCacheTablesForChangeNotification</strong> table has three columns: <em>tableName</em>, <em>notificationCreated</em>, and <em>changeId</em>. This table is used to track changes. Essentially, when a change takes place, a record is written into this table. The SQL Server polling queries this table. Also a set of stored procedures is added to the database as well. See the following table.</span></p>
<table border="1" width="100%" cellPadding="0" cellSpacing="0" style="background:silver;width:100%;border-collapse:collapse;border:medium none;" class="MsoNormalTable">
<tr>
<td vAlign="top" style="background:gray;border:gray 1pt inset;padding:0.75pt;"><strong><span style="font-size:10pt;font-family:Verdana;">Procedure Name</span></strong><span style="font-size:8pt;font-family:Verdana;"></span></td>
<td vAlign="top" style="border-right:gray 1pt inset;border-top:gray 1pt inset;background:gray;border-left:#d4d0c8;border-bottom:gray 1pt inset;padding:0.75pt;"><strong><span style="font-size:10pt;font-family:Verdana;">Description</span></strong><span style="font-size:8pt;font-family:Verdana;"></span></td>
</tr>
<tr>
<td vAlign="top" style="border-right:gray 1pt inset;border-top:#d4d0c8;border-left:gray 1pt inset;border-bottom:gray 1pt inset;background-color:transparent;padding:0.75pt;"><em><span style="font-size:10pt;font-family:Verdana;">AspNet_SqlCacheRegisterTableStoredProcedure</span></em><span style="font-size:8pt;font-family:Verdana;"></span></td>
<td vAlign="top" style="border-right:gray 1pt inset;border-top:#d4d0c8;border-left:#d4d0c8;border-bottom:gray 1pt inset;background-color:transparent;padding:0.75pt;"><span style="font-size:10pt;font-family:Verdana;">Sets a table up to support notifications. This process works by adding a notification trigger to the table, which will fire when any row is inserted, deleted, or updated.</span><span style="font-size:8pt;font-family:Verdana;"></span></td>
</tr>
<tr>
<td vAlign="top" style="border-right:gray 1pt inset;border-top:#d4d0c8;border-left:gray 1pt inset;border-bottom:gray 1pt inset;background-color:transparent;padding:0.75pt;"><em><span style="font-size:10pt;font-family:Verdana;">AspNet_SqlCacheUnRegisterTableStoredProcedure</span></em><span style="font-size:8pt;font-family:Verdana;"></span></td>
<td vAlign="top" style="border-right:gray 1pt inset;border-top:#d4d0c8;border-left:#d4d0c8;border-bottom:gray 1pt inset;background-color:transparent;padding:0.75pt;"><span style="font-size:10pt;font-family:Verdana;">Takes a registered table and removes the notification trigger so that notifications won&#8217;t be generated.</span><span style="font-size:8pt;font-family:Verdana;"></span></td>
</tr>
<tr>
<td vAlign="top" style="border-right:gray 1pt inset;border-top:#d4d0c8;border-left:gray 1pt inset;border-bottom:gray 1pt inset;background-color:transparent;padding:0.75pt;"><em><span style="font-size:10pt;font-family:Verdana;">AspNet_SqlCacheUpdateChangeIdStoredProcedure</span></em><span style="font-size:8pt;font-family:Verdana;"></span></td>
<td vAlign="top" style="border-right:gray 1pt inset;border-top:#d4d0c8;border-left:#d4d0c8;border-bottom:gray 1pt inset;background-color:transparent;padding:0.75pt;"><span style="font-size:10pt;font-family:Verdana;">The notification trigger calls this stored procedure to update the AspNet_SqlCacheTablesForChangeNotification table, thereby indicating that the table has changed.</span><span style="font-size:8pt;font-family:Verdana;"></span></td>
</tr>
<tr>
<td vAlign="top" style="border-right:gray 1pt inset;border-top:#d4d0c8;border-left:gray 1pt inset;border-bottom:gray 1pt inset;background-color:transparent;padding:0.75pt;"><em><span style="font-size:10pt;font-family:Verdana;">AspNet_SqlCacheQueryRegisteredTablesStoredProcedure</span></em><span style="font-size:8pt;font-family:Verdana;"></span></td>
<td vAlign="top" style="border-right:gray 1pt inset;border-top:#d4d0c8;border-left:#d4d0c8;border-bottom:gray 1pt inset;background-color:transparent;padding:0.75pt;"><span style="font-size:10pt;font-family:Verdana;">Extracts just the table names fromthe AspNet_SqlCacheTablesForChangeNotification table. Used to get a quick look at all the registered tables.</span><span style="font-size:8pt;font-family:Verdana;"></span></td>
</tr>
<tr>
<td vAlign="top" style="border-right:gray 1pt inset;border-top:#d4d0c8;border-left:gray 1pt inset;border-bottom:gray 1pt inset;background-color:transparent;padding:0.75pt;"><em><span style="font-size:10pt;font-family:Verdana;">AspNet_SqlCachePollingStoredProcedure</span></em><span style="font-size:8pt;font-family:Verdana;"></span></td>
<td vAlign="top" style="border-right:gray 1pt inset;border-top:#d4d0c8;border-left:#d4d0c8;border-bottom:gray 1pt inset;background-color:transparent;padding:0.75pt;"><span style="font-size:10pt;font-family:Verdana;">Gets the list of changes from the AspNet_SqlCacheTablesForChangeNotification table. Used to perform the polling.</span><span style="font-size:8pt;font-family:Verdana;"></span></td>
</tr>
</table>
<p><span style="font-size:10pt;font-family:Verdana;">After this, need to enable notification support <strong><u>for each individual table.</u></strong> You can do this manually using the <strong>AspNet_SqlCacheRegisterTableStoredProcedure</strong>, to that, open your query analyzer and select your Database you&#8217;ve enabled for SQL Cache Notification for example Northwind database and write the following command:</p>
<p><span style="color:blue;">exec</span> AspNet_SqlCacheRegisterTableStoredProcedure <span style="color:maroon;">&#8216;TableName&#8217;<br />
</span><br />
Or you can use aspnet_regsql, using the <strong>-et</strong> parameter to enable a able for sql cache dependency notifications and the <strong>-t</strong> parameter to name the table. Here&#8217;s an example that enables notifications for the Employees table:</p>
<p><strong><span style="background:silver;">aspnet_regsql -et -E -d Northwind -t Products<br />
</span></strong><br />
Both options generates the notification trigger for the Products table as the following:</p>
<p><span style="color:blue;">CREATE TRIGGER</span> dbo.[Products_AspNet_SqlCacheNotification_Trigger] <span style="color:blue;">ON</span> [Products]<br />
<span style="color:blue;">FOR INSERT, UPDATE, DELETE<br />
AS<br />
BEGIN</span><br />
<span style="color:blue;">SET NOCOUNT ON</span><br />
<span style="color:blue;">EXEC</span> dbo.AspNet_SqlCacheUpdateChangeIdStoredProcedure <span style="color:maroon;">N&#8217;Products&#8217;</span><br />
<span style="color:blue;">END</span></span><span style="font-size:10pt;font-family:Verdana;">So any record is inserted, deleted or updated in Products table will update <em>ChangeId<strong> </strong></em>field in <strong>AspNet_SqlCacheTablesForChangeNotification</strong> table.</span></p>
<h2><span style="font-size:10pt;font-family:Verdana;">How Notificaions Works:</span><span style="font-family:Verdana;"></span></h2>
<p><span style="font-size:10pt;font-family:Verdana;">The <strong>AspNet_SqlCacheTablesForChangeNotification</strong> contains a single record for every table you&#8217;re monitoring. When you make a change in the table (such as inserting ,deleting or updating a record), the <em>changeId</em> column is incremented by 1 -see <em>AspNet_SqlCacheUpdateChangeIdStoredProcedure</em> procedure-. ASP.NET queries this table repeatedly and keeps track of the most recent <em>changeId</em> values for every table. When this value changes in a subsequent read, ASP.NET knows that the table has changed.</span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ranjanaspnet.wordpress.com/16/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ranjanaspnet.wordpress.com/16/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjanaspnet.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjanaspnet.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjanaspnet.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjanaspnet.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjanaspnet.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjanaspnet.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjanaspnet.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjanaspnet.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjanaspnet.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjanaspnet.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjanaspnet.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjanaspnet.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjanaspnet.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjanaspnet.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=16&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjanaspnet.wordpress.com/2007/11/06/sql-invalid-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/613d9954a93c3e79c03fb1f9bc448a8c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">ranjan</media:title>
		</media:content>
	</item>
		<item>
		<title>Displaying time in format hh:mm:ss</title>
		<link>http://ranjanaspnet.wordpress.com/2007/11/05/displaying-time-in-format-hhmmss/</link>
		<comments>http://ranjanaspnet.wordpress.com/2007/11/05/displaying-time-in-format-hhmmss/#comments</comments>
		<pubDate>Mon, 05 Nov 2007 12:44:53 +0000</pubDate>
		<dc:creator>ranjanaspnet</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://ranjanaspnet.wordpress.com/2007/11/05/displaying-time-in-format-hhmmss/</guid>
		<description><![CDATA[Displaying time in format hh:mm:ss by using Convert() function Convert(varchar(8),InDateTime,108) as [In Time]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=15&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Displaying time in format hh:mm:ss by using Convert() function </p>
<p>Convert(varchar(8),InDateTime,108) as [In Time]</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ranjanaspnet.wordpress.com/15/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ranjanaspnet.wordpress.com/15/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjanaspnet.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjanaspnet.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjanaspnet.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjanaspnet.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjanaspnet.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjanaspnet.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjanaspnet.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjanaspnet.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjanaspnet.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjanaspnet.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjanaspnet.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjanaspnet.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjanaspnet.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjanaspnet.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=15&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjanaspnet.wordpress.com/2007/11/05/displaying-time-in-format-hhmmss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/613d9954a93c3e79c03fb1f9bc448a8c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">ranjan</media:title>
		</media:content>
	</item>
		<item>
		<title>Addding tow numbers using Web Services</title>
		<link>http://ranjanaspnet.wordpress.com/2007/11/02/addding-tow-numbers-using-web-services/</link>
		<comments>http://ranjanaspnet.wordpress.com/2007/11/02/addding-tow-numbers-using-web-services/#comments</comments>
		<pubDate>Fri, 02 Nov 2007 10:24:51 +0000</pubDate>
		<dc:creator>ranjanaspnet</dc:creator>
				<category><![CDATA[Web services]]></category>

		<guid isPermaLink="false">http://ranjanaspnet.wordpress.com/2007/11/02/addding-tow-numbers-using-web-services/</guid>
		<description><![CDATA[Addding tow numbers using Web Services Environment: .NET 1.0.3705, IIS 5.0 Introduction Visual Studio .NET makes .NET programming simple and accelerates the development process. It hides a lot of repetitive and configuration details from the user and improves productivity. However, sometimes you would like to program for .NET without using VS .NET; for example, you want to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=14&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><u><span style="font-size:9pt;color:black;font-family:Verdana;"></p>
<p style="margin:0;" class="MsoNormal"><font face="Verdana"><span class="bodycopy1"><strong><span style="font-size:9pt;color:#666666;">Addding tow numbers using Web Services </span></strong></span></font></p>
<p></span></u><u><span style="font-size:9pt;color:black;font-family:Verdana;">Environment:</span></u><span style="font-size:9pt;color:black;font-family:Verdana;"> .NET 1.0.3705, IIS 5.0</span></p>
<h3><span style="font-size:9pt;color:black;font-family:Verdana;">Introduction</span></h3>
<p><span style="font-size:9pt;color:black;font-family:Verdana;">Visual Studio .NET makes .NET programming simple and accelerates the development process. It hides a lot of repetitive and configuration details from the user and improves productivity. However, sometimes you would like to program for .NET without using VS .NET; for example, you want to learn .NET framework programming and do not have access to VS .NET or you want to know what is actually going on under the hood.</span><a name="more"></a><span style="font-size:9pt;color:black;font-family:Verdana;">Writing a Web Service in .NET using VS .NET very is easy. However, it is possible to write Web Services using the plain .NET SDK. I struggled a lot to write Web Services without VS .NET and tried to find help on the Net. There are a lot of examples available for writing Web Services using VS.NET, but you will rarely find any examples of writing Web Services using only the .NET SDK. This article is exactly for this purpose. It looks at Web Services development using the .NET SDK alone.</span><span><span style="font-size:9pt;color:black;font-family:Verdana;">We will write and publish a simple web Service. We will also write two Web Service consumers: one Web-based consumer (ASP.NET application) and another Windows application-based consumer. Let&#8217;s start writing our first Web Service.</span></span></p>
<h3><span><span style="font-size:9pt;color:black;font-family:Verdana;">Writing a Web Service</span></span></h3>
<p><span><span style="font-size:9pt;color:black;font-family:Verdana;">Following is our first Web Service; it exposes two methods (Add and SayHello) as Web Services to be used by applications. This is a standard template for a Web Service. .NET Web Services use the .asmx extension. Note that a method exposed as a Web Service has the WebMethod attribute. Save this file as FirstService.asmx in the IIS virtual directory (as explained in configuring IIS; for example, c:\MyWebSerces).</span></span></p>
<p style="background:#eeeeee;border:#999999 1pt solid;padding:7pt;">
<pre><font size="2"><span><strong><u><span style="color:black;font-family:Verdana;">FirstService.asmx</span></u></strong></span><span><span style="color:black;font-family:Verdana;"></span></span></font></pre>
<pre><font size="2"><span><span style="color:black;font-family:Verdana;"><span>  </span>&lt;%@ WebService language="C" </span></span><span><span class="codekeyword1"><span style="font-family:Verdana;"><font color="#0000ff">class</font></span></span></span><span><span style="color:black;font-family:Verdana;">="FirstService" %&gt;</span></span></font></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"> </font></span></span></pre>
<pre><font size="2"><span><span style="color:black;font-family:Verdana;"><span>  </span></span></span><span><span class="codekeyword1"><span style="font-family:Verdana;"><font color="#0000ff">using</font></span></span></span><span><span style="color:black;font-family:Verdana;"> System;</span></span></font></pre>
<pre><font size="2"><span><span style="color:black;font-family:Verdana;"><span>  </span></span></span><span><span class="codekeyword1"><span style="font-family:Verdana;"><font color="#0000ff">using</font></span></span></span><span><span style="color:black;font-family:Verdana;"> System.Web.Services;</span></span></font></pre>
<pre><font size="2"><span><span style="color:black;font-family:Verdana;"><span>  </span></span></span><span><span class="codekeyword1"><span style="font-family:Verdana;"><font color="#0000ff">using</font></span></span></span><span><span style="color:black;font-family:Verdana;"> System.Xml.Serialization;</span></span></font></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"> </font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>  </span>[WebService(Namespace="http://localhost/MyWebServices/")]</font></span></span></pre>
<pre><font size="2"><span><span style="color:black;font-family:Verdana;"><span>  </span></span></span><span><span class="codekeyword1"><span style="font-family:Verdana;"><font color="#0000ff">public</font></span></span></span><span><span style="color:black;font-family:Verdana;"> </span></span><span><span class="codekeyword1"><span style="font-family:Verdana;"><font color="#0000ff">class</font></span></span></span><span><span style="color:black;font-family:Verdana;"> FirstService : WebService</span></span></font></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>  </span>{</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>      </span>[WebMethod]</font></span></span></pre>
<pre><font size="2"><span><span style="color:black;font-family:Verdana;"><span>      </span></span></span><span><span class="codekeyword1"><span style="font-family:Verdana;"><font color="#0000ff">public</font></span></span></span><span><span style="color:black;font-family:Verdana;"> </span></span><span><span class="codekeyword1"><span style="font-family:Verdana;"><font color="#0000ff">int</font></span></span></span><span><span style="color:black;font-family:Verdana;"> Add(</span></span><span><span class="codekeyword1"><span style="font-family:Verdana;"><font color="#0000ff">int</font></span></span></span><span><span style="color:black;font-family:Verdana;"> a, </span></span><span><span class="codekeyword1"><span style="font-family:Verdana;"><font color="#0000ff">int</font></span></span></span><span><span style="color:black;font-family:Verdana;"> b)</span></span></font></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>      </span>{</font></span></span></pre>
<pre><font size="2"><span><span style="color:black;font-family:Verdana;"><span>          </span></span></span><span><span class="codekeyword1"><span style="font-family:Verdana;"><font color="#0000ff">return</font></span></span></span><span><span style="color:black;font-family:Verdana;"> a + b;</span></span></font></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>      </span>}</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"> </font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>      </span>[WebMethod]</font></span></span></pre>
<pre><font size="2"><span><span style="color:black;font-family:Verdana;"><span>      </span></span></span><span><span class="codekeyword1"><span style="font-family:Verdana;"><font color="#0000ff">public</font></span></span></span><span><span style="color:black;font-family:Verdana;"> String SayHello()</span></span></font></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>      </span>{</font></span></span></pre>
<pre><font size="2"><span><span style="color:black;font-family:Verdana;"><span>          </span></span></span><span><span class="codekeyword1"><span style="font-family:Verdana;"><font color="#0000ff">return</font></span></span></span><span><span style="color:black;font-family:Verdana;"> "Hello World";</span></span></font></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>      </span>}</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>  </span>}</font></span></span></pre>
<p><span><span style="font-size:9pt;color:black;font-family:Verdana;">To test a Web Service, it must be published. A Web Service can be published either on an intranet or the Internet. We will publish this Web Service on IIS running on a local machine. Let&#8217;s start with configuring the IIS.</span></span></p>
<ul>
<li class="MsoNormal"><span><span style="font-size:9pt;font-family:Verdana;">Open Start-&gt;Settings-&gt;Control Panel-&gt;Administrative tools-&gt;Internet Services Manager. </span></span></li>
<li class="MsoNormal"><span><span style="font-size:9pt;font-family:Verdana;">Expand and right-click on [Default Web Site]; select New -&gt;Virtual Directory. </span></span></li>
<li class="MsoNormal"><span><span style="font-size:9pt;font-family:Verdana;">The Virtual Directory Creation Wizard opens. Click Next. </span></span></li>
<li class="MsoNormal"><span><span style="font-size:9pt;font-family:Verdana;">The &#8220;Virtual Directory Alias&#8221; screen opens. Type the virtual directory name—for example, MyWebServices—and click Next. </span></span></li>
<li class="MsoNormal"><span><span style="font-size:9pt;font-family:Verdana;">The &#8220;Web Site Content Directory&#8221; screen opens. Here, enter the directory path name for the virtual directory—for example, c:\MyWebServices—and click Next. </span></span></li>
<li class="MsoNormal"><span><span style="font-size:9pt;font-family:Verdana;">The &#8220;Access Permission&#8221; screen opens. Change the settings as per your requirements. Let&#8217;s keep the default settings for this exercise. Click the Next button. It completes the IIS configuration. Click Finish to complete the configuration. </span></span></li>
</ul>
<p><span><span style="font-size:9pt;color:black;font-family:Verdana;">To test that IIS has been configured properly, copy an HTML file (for example, x.html) in the virtual directory (C:\MyWebServices) created above. Now, open Internet Explorer and type http://localhost/MyWebServices/x.html. It should open the x.html file. If it does not work, try replacing localhost with the IP address of your machine. If it still does not work, check whether IIS is running; you may need to reconfigure IIS and Virtual Directory.</span></span><span><span style="font-size:9pt;color:black;font-family:Verdana;">To test our Web Service, copy FirstService.asmx in the IIS virtual directory created above (C:\MyWebServices). Open the Web Service in Internet Explorer (http://localhost/MyWebServices/FirstService.asmx). It should open your Web Service page. The page should have links to two methods exposed as Web Services by our application. Congratulations; you have written your first Web Service!!!</span></span></p>
<h3><span><span style="font-size:9pt;color:black;font-family:Verdana;">Testing the Web Service</span></span></h3>
<p><span><span style="font-size:9pt;color:black;font-family:Verdana;">As we have just seen, writing Web Services is easy in the .NET Framework. Writing Web Service consumers is also easy in the .NET framework; however, it is a bit more involved. As said earlier, we will write two types of service consumers, one Web- and another Windows application-based consumer. Let&#8217;s write our first Web Service consumer.</span></span></p>
<h4><span><span style="font-size:9pt;color:black;font-family:Verdana;">Web-Based Service Consumer</span></span></h4>
<p><span><span style="font-size:9pt;color:black;font-family:Verdana;">Write a Web-based consumer as given below. Call it WebApp.aspx. Note that it is an ASP.NET application. Save this in the virtual directory of the Web Service (c:\MyWebServices\WebApp.axpx).</span></span><span><span style="font-size:9pt;color:black;font-family:Verdana;">This application has two text fields that are used to get numbers from the user to be added. It has one button, Execute, that, when clicked, gets the Add and SayHello Web Services.</span></span></p>
<p style="background:#eeeeee;border:#999999 1pt solid;padding:7pt;">
<pre><font size="2"><span><strong><u><span style="color:black;font-family:Verdana;">WebApp.axpx</span></u></strong></span><span><span style="color:black;font-family:Verdana;"></span></span></font></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>  </span>&lt;%@ Page Language="C#" %&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>  </span>&lt;script runat="server"&gt;</font></span></span></pre>
<pre><font size="2"><span><span style="color:black;font-family:Verdana;"><span>  </span>void runSrvice_Click(</span></span><span><span class="codekeyword1"><span style="font-family:Verdana;"><font color="#0000ff">Object</font></span></span></span><span><span style="color:black;font-family:Verdana;"> sender, EventArgs e)</span></span></font></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>  </span>{</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>      </span>FirstService mySvc = new FirstService();</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>      </span>Label1.Text = mySvc.SayHello();</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>      </span>Label2.Text = mySvc.Add(Int32.Parse(txtNum1.Text),</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>                    </span>Int32.Parse(txtNum2.Text)).ToString();</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>  </span>}</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>  </span>&lt;/script&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>  </span>&lt;html&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>  </span>&lt;head&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>  </span>&lt;/head&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>  </span>&lt;body&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>  </span>&lt;form runat="server"&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>    </span>&lt;p&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>        </span>&lt;em&gt;First Number to Add &lt;/em&gt;:</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>        </span>&lt;asp:TextBox id="txtNum1" runat="server"</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>             </span>Width="43px"&gt;4&lt;/asp:TextBox&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>    </span>&lt;/p&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>    </span>&lt;p&gt;</font></span></span></pre>
<pre><font size="2"><span><span style="color:black;font-family:Verdana;"><span>        </span>&lt;em&gt;</span></span><span><span class="codekeyword1"><span style="font-family:Verdana;"><font color="#0000ff">Second</font></span></span></span><span><span style="color:black;font-family:Verdana;"> Number </span></span><span><span class="codekeyword1"><span style="font-family:Verdana;"><font color="#0000ff">To</font></span></span></span><span><span style="color:black;font-family:Verdana;"> Add &lt;/em&gt;:</span></span></font></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>        </span>&lt;asp:TextBox id="txtNum2" runat="server"</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>             </span>Width="44px"&gt;5&lt;/asp:TextBox&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>    </span>&lt;/p&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>    </span>&lt;p&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>        </span>&lt;strong&gt;&lt;u&gt;Web Service Result -&lt;/u&gt;&lt;/strong&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>    </span>&lt;/p&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>    </span>&lt;p&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>        </span>&lt;em&gt;Hello world Service&lt;/em&gt; :</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>        </span>&lt;asp:Label id="Label1" runat="server"</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>             </span>Font-Underline="True"&gt;Label&lt;/asp:Label&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>    </span>&lt;/p&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>    </span>&lt;p&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>        </span>&lt;em&gt;Add Service&lt;/em&gt; :</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>        </span>&amp; &lt;asp:Label id="Label2" runat="server"</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>              </span><span> </span>Font-Underline="True"&gt;Label&lt;/asp:Label&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>    </span>&lt;/p&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>    </span>&lt;p align="left"&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>        </span>&lt;asp:Button id="runSrvice" onclick="runSrvice_Click"</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>             </span>runat="server" Text="Execute"&gt;&lt;/asp:Button&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>    </span>&lt;/p&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>  </span>&lt;/form&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>  </span>&lt;/body&gt;</font></span></span></pre>
<pre><span><span style="color:black;font-family:Verdana;"><font size="2"><span>  </span>&lt;/html&gt;</font></span></span></pre>
<p><span><span style="font-size:9pt;color:black;font-family:Verdana;">After the consumer is created, we need to create a proxy for the Web Service to be consumed. This work is done automatically by Visual Studio .NET for us when referencing a Web Service that has been added. Here are the steps to be followed:</span></span></p>
<ul>
<li class="MsoNormal"><span><span style="font-size:9pt;font-family:Verdana;">Create a proxy for the Web Service to be consumed. The proxy is created using the wsdl utility supplied with the .NET SDK. This utility extracts information from the Web Service and creates a proxy. Thus, the proxy created is valid only for a particular Web Service. If you need to consume other Web Services, you need to create a proxy for this service as well. VS .NET creates a proxy automatically for you when the reference for the Web Service is added. Create a proxy for the Web Service using the wsdl utility supplied with the .NET SDK. It will create FirstSevice.cs in the current directory. We need to compile it to create FirstService.dll (proxy) for the Web Service. </span></span></li>
</ul>
<p style="background:#eeeeee;margin-left:0.25in;margin-right:0;border:#999999 1pt solid;padding:7pt;">
<pre style="background:#eeeeee;margin-left:0.25in;text-indent:-0.25in;"><span><span style="font-size:10pt;color:black;font-family:Symbol;"><span>·<span style="font:7pt 'Times New Roman';">                </span></span></span><span style="color:black;font-family:Verdana;"><font size="2">c:&gt; WSDL http:</font></span></span><font size="2"><font color="#008000"><span><span class="codecomment1"><span style="font-family:Verdana;">//localhost/MyWebServices/</span></span></span><span><span style="color:black;font-family:Verdana;"></span></span></font></font></pre>
<pre style="background:#eeeeee;margin-left:0.25in;text-indent:-0.25in;"><span><span style="font-size:10pt;color:black;font-family:Symbol;"><span>·<span style="font:7pt 'Times New Roman';">                </span></span></span><span style="color:black;font-family:Verdana;"><font size="2"><span>                </span>FirstService.asmx?WSDL</font></span></span></pre>
<pre style="background:#eeeeee;margin-left:0.25in;text-indent:-0.25in;"><span><span style="font-size:10pt;color:black;font-family:Symbol;"><span>·<span style="font:7pt 'Times New Roman';">                </span></span></span><span style="color:black;font-family:Verdana;"><font size="2">c:&gt; csc /t:library FirstService.cs</font></span></span></pre>
<ul>
<li class="MsoNormal"><span><span style="font-size:9pt;font-family:Verdana;">Put the compiled proxy in the bin directory of the virtual directory of the Web Service (c:\MyWebServices\bin). IIS looks for the proxy in this directory. </span></span></li>
<li class="MsoNormal"><span><span style="font-size:9pt;font-family:Verdana;">Create the service consumer, which we have already done. Note that I have instantiated an object of the Web Service proxy in the consumer. This proxy takes care of interacting with the service. </span></span></li>
<li class="MsoNormal"><span><span style="font-size:9pt;font-family:Verdana;">Type the URL of the consumer in IE to test it (for example, http://localhost/MyWebServices/WebApp.aspx). </span></span></li>
</ul>
<p><span></span><span style="font-size:9pt;font-family:Verdana;">Now, the question arises: How can I be sure that my application is actually calling the Web Service? It is simple to test. Stop your Web server so that the Web Service cannot be contacted. Now, run the WinApp application. It will fire a run-time exception. Now, start the Web server again. It should work. </span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ranjanaspnet.wordpress.com/14/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ranjanaspnet.wordpress.com/14/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjanaspnet.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjanaspnet.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjanaspnet.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjanaspnet.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjanaspnet.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjanaspnet.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjanaspnet.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjanaspnet.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjanaspnet.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjanaspnet.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjanaspnet.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjanaspnet.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjanaspnet.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjanaspnet.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=14&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjanaspnet.wordpress.com/2007/11/02/addding-tow-numbers-using-web-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/613d9954a93c3e79c03fb1f9bc448a8c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">ranjan</media:title>
		</media:content>
	</item>
		<item>
		<title>Sending Mail using SmtpClient</title>
		<link>http://ranjanaspnet.wordpress.com/2007/10/29/sending-mail-using-smtpclient/</link>
		<comments>http://ranjanaspnet.wordpress.com/2007/10/29/sending-mail-using-smtpclient/#comments</comments>
		<pubDate>Mon, 29 Oct 2007 09:37:03 +0000</pubDate>
		<dc:creator>ranjanaspnet</dc:creator>
				<category><![CDATA[Dot Net]]></category>

		<guid isPermaLink="false">http://ranjanaspnet.wordpress.com/2007/10/29/sending-mail-using-smtpclient/</guid>
		<description><![CDATA[Imports System.Net.Mail Protected Sub btnRegister_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRegister.Click Dim smtpClient As New SmtpClient Dim message As New MailMessage Dim fromAddress As New MailAddress(host site mail address) Dim toAddress As New MailAddress(receiver mail address) Try &#8216;You can specify the host name or ipaddress of your server &#8216; Default in IIS [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=12&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Imports System.Net.Mail</p>
<p>Protected Sub btnRegister_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRegister.Click<br />
        Dim smtpClient As New SmtpClient<br />
        Dim message As New MailMessage</p>
<p>        Dim fromAddress As New MailAddress(host site mail address)<br />
        Dim toAddress As New MailAddress(receiver mail address)<br />
        Try<br />
            &#8216;You can specify the host name or ipaddress of your server<br />
            &#8216; Default in IIS will be localhost<br />
            smtpClient.Host = &#8220;localhost&#8221;</p>
<p>            &#8216;Default port will be 25<br />
            smtpClient.Port = 25</p>
<p>            &#8216;From address will be given as a MailAddress Object<br />
            message.From = fromAddress</p>
<p>            &#8216;To address collection of MailAddress<br />
            message.To.Add(toAddress)<br />
            message.Subject = &#8220;Feedback&#8221;</p>
<p>            &#8216;// CC and BCC optional<br />
            &#8216;// MailAddressCollection class is used to send the email to various users<br />
            &#8216;// You can specify Address as new MailAddress(&#8220;admin1@yoursite.com&#8221;)<br />
            message.CC.Add(&#8220;admin1@yoursite.com&#8221;);<br />
            message.CC.Add(&#8220;admin2@yoursite.com&#8221;);</p>
<p>            &#8216;// You can specify Address directly as string<br />
            message.Bcc.Add(new MailAddress(&#8220;admin3@yoursite.com&#8221;));<br />
            message.Bcc.Add(new MailAddress(&#8220;admin4@yoursite.com&#8221;));</p>
<p>            &#8216;Body can be Html or text format<br />
            &#8216;Specify true if it  is html message<br />
            message.IsBodyHtml = False</p>
<p>            &#8216;Message body content<br />
            message.Body = [message as string]</p>
<p>            &#8216;Send SMTP mail<br />
            smtpClient.Send(message)</p>
<p>            Response.Write(&#8220;alert(&#8216;Email successfully<br />
                                       sent.&#8217;);&#8221;)<br />
        Catch ex As Exception<br />
            Response.Write(&#8220;alert(&#8216;Email sent fail.&#8217;);&#8221;)<br />
        End Try<br />
    End Sub</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ranjanaspnet.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ranjanaspnet.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjanaspnet.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjanaspnet.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjanaspnet.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjanaspnet.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjanaspnet.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjanaspnet.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjanaspnet.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjanaspnet.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjanaspnet.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjanaspnet.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjanaspnet.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjanaspnet.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjanaspnet.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjanaspnet.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=12&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjanaspnet.wordpress.com/2007/10/29/sending-mail-using-smtpclient/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/613d9954a93c3e79c03fb1f9bc448a8c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">ranjan</media:title>
		</media:content>
	</item>
		<item>
		<title>Use of Date time</title>
		<link>http://ranjanaspnet.wordpress.com/2007/10/26/use-of-date-time/</link>
		<comments>http://ranjanaspnet.wordpress.com/2007/10/26/use-of-date-time/#comments</comments>
		<pubDate>Fri, 26 Oct 2007 12:43:35 +0000</pubDate>
		<dc:creator>ranjanaspnet</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://ranjanaspnet.wordpress.com/2007/10/26/use-of-date-time/</guid>
		<description><![CDATA[To display date in format : dd/mm/yyyy convert(varchar(12),[field name],103) To get records between two dates use following syntax in where condition. Note : 1) Assuming that field type is varchar in database table. 2) From date &#38; to date variables are in date format. Convert(datetime,Convert(varchar(12),[field name])) between Convert(datetime,[from date variable] ) and Convert(datetime,[to date variable])<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=10&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To display date in format : dd/mm/yyyy </p>
<p>convert(varchar(12),[field name],103)</p>
<p>To get records between two dates use following syntax in where condition.<br />
   Note : 1) Assuming that field type is varchar in database table.<br />
              2) From date &amp; to date variables are in date format.		</p>
<p>Convert(datetime,Convert(varchar(12),[field name])) between Convert(datetime,[from date variable] ) and Convert(datetime,[to date variable])</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ranjanaspnet.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ranjanaspnet.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjanaspnet.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjanaspnet.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjanaspnet.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjanaspnet.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjanaspnet.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjanaspnet.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjanaspnet.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjanaspnet.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjanaspnet.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjanaspnet.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjanaspnet.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjanaspnet.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjanaspnet.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjanaspnet.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=10&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjanaspnet.wordpress.com/2007/10/26/use-of-date-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/613d9954a93c3e79c03fb1f9bc448a8c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">ranjan</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Cursor – Basic syntax</title>
		<link>http://ranjanaspnet.wordpress.com/2007/10/26/using-cursor-%e2%80%93-basic-syntax/</link>
		<comments>http://ranjanaspnet.wordpress.com/2007/10/26/using-cursor-%e2%80%93-basic-syntax/#comments</comments>
		<pubDate>Fri, 26 Oct 2007 12:29:54 +0000</pubDate>
		<dc:creator>ranjanaspnet</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://ranjanaspnet.wordpress.com/2007/10/26/using-cursor-%e2%80%93-basic-syntax/</guid>
		<description><![CDATA[Using Cursor – Basic syntax DECLARE [cursor name] CURSOR FOR [SELECT query ] OPEN [cursor name] [DECLARE variables] FETCH NEXT FROM [cursor name] INTO [variable list] WHILE(@@FETCH_STATUS -1) BEGIN IF(@@FETCH_STATUS -2) BEGIN [Insert/Update statements] END FETCH NEXT FROM [cursor name] TO[variable list] END CLOSE [cursor name] DEALLOCATE [cursor name]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=9&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Using Cursor – Basic syntax</p>
<p>DECLARE [cursor name] CURSOR<br />
FOR</p>
<p> 	[SELECT query ]</p>
<p>OPEN [cursor name]</p>
<p>[DECLARE variables]</p>
<p>FETCH NEXT FROM [cursor name] INTO [variable list]</p>
<p>WHILE(@@FETCH_STATUS  -1)<br />
	BEGIN<br />
		IF(@@FETCH_STATUS -2)<br />
			BEGIN<br />
[Insert/Update statements]<br />
			END<br />
			FETCH NEXT FROM  [cursor name] TO[variable list]<br />
	END<br />
CLOSE [cursor name]<br />
DEALLOCATE [cursor name]</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ranjanaspnet.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ranjanaspnet.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjanaspnet.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjanaspnet.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjanaspnet.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjanaspnet.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjanaspnet.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjanaspnet.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjanaspnet.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjanaspnet.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjanaspnet.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjanaspnet.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjanaspnet.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjanaspnet.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjanaspnet.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjanaspnet.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=9&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjanaspnet.wordpress.com/2007/10/26/using-cursor-%e2%80%93-basic-syntax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/613d9954a93c3e79c03fb1f9bc448a8c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">ranjan</media:title>
		</media:content>
	</item>
		<item>
		<title>Use File Upload control with read only text box.</title>
		<link>http://ranjanaspnet.wordpress.com/2007/10/24/use-file-upload-control-with-read-only-text-box/</link>
		<comments>http://ranjanaspnet.wordpress.com/2007/10/24/use-file-upload-control-with-read-only-text-box/#comments</comments>
		<pubDate>Wed, 24 Oct 2007 12:44:28 +0000</pubDate>
		<dc:creator>ranjanaspnet</dc:creator>
				<category><![CDATA[Dot Net]]></category>

		<guid isPermaLink="false">http://ranjanaspnet.wordpress.com/2007/10/24/use-file-upload-control-with-read-only-text-box/</guid>
		<description><![CDATA[Query : File Upload Control read only so that no one can edit file upload text box. User can select files only with Browse button. Solution : Use javascript for this purpose &#60;input id=&#8221;File1&#8243; type=&#8221;file&#8221; onkeypress=&#8221;javascript: return false;&#8221; /&#62;  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=8&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Query :<br />
File Upload Control read only so that no one can<br />
edit file upload text box.<br />
User can select files only with Browse button.</p>
<p>Solution :<br />
Use javascript for this purpose</p>
<p>&lt;input id=&#8221;File1&#8243; type=&#8221;file&#8221; onkeypress=&#8221;javascript: return false;&#8221; /&gt;<br />
 </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ranjanaspnet.wordpress.com/8/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ranjanaspnet.wordpress.com/8/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjanaspnet.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjanaspnet.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjanaspnet.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjanaspnet.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjanaspnet.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjanaspnet.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjanaspnet.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjanaspnet.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjanaspnet.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjanaspnet.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjanaspnet.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjanaspnet.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjanaspnet.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjanaspnet.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=8&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjanaspnet.wordpress.com/2007/10/24/use-file-upload-control-with-read-only-text-box/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/613d9954a93c3e79c03fb1f9bc448a8c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">ranjan</media:title>
		</media:content>
	</item>
		<item>
		<title>Calling Crystal report viewer in dot net</title>
		<link>http://ranjanaspnet.wordpress.com/2007/10/23/calling-crystal-report-viewer-in-dot-net/</link>
		<comments>http://ranjanaspnet.wordpress.com/2007/10/23/calling-crystal-report-viewer-in-dot-net/#comments</comments>
		<pubDate>Tue, 23 Oct 2007 12:57:20 +0000</pubDate>
		<dc:creator>ranjanaspnet</dc:creator>
				<category><![CDATA[Dot Net]]></category>

		<guid isPermaLink="false">http://ranjanaspnet.wordpress.com/2007/10/23/calling-crystal-report-viewer-in-dot-net/</guid>
		<description><![CDATA[Using Crystal report in dot net Imports CrystalDecisions.Shared Imports CrystalDecisions.CrystalReports.Engine Dim intCounter As Integer Dim intCounter1 As Integer &#8216;Crystal Report&#8217;s report document object Dim objReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument &#8216;object of table Log on info of Crystal report Dim ConInfo As New CrystalDecisions.Shared.TableLogOnInfo &#8216;Sub report object of crystal report. Dim mySubReportObject As CrystalDecisions.CrystalReports.Engine.SubreportObject &#8216;Sub report document [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=7&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Using Crystal report in dot net</p>
<p>Imports CrystalDecisions.Shared<br />
Imports CrystalDecisions.CrystalReports.Engine</p>
<p>Dim intCounter As Integer<br />
Dim intCounter1 As Integer</p>
<p>&#8216;Crystal Report&#8217;s report document object<br />
Dim objReport As New  CrystalDecisions.CrystalReports.Engine.ReportDocument</p>
<p>&#8216;object of table Log on info of Crystal report<br />
Dim ConInfo As New CrystalDecisions.Shared.TableLogOnInfo</p>
<p>&#8216;Sub report object of crystal report.<br />
Dim mySubReportObject As CrystalDecisions.CrystalReports.Engine.SubreportObject</p>
<p>&#8216;Sub report document of crystal report.<br />
Dim mySubRepDoc As New CrystalDecisions.CrystalReports.Engine.ReportDocument</p>
<p>Dim index As Integer</p>
<p>&#8216;Load the report<br />
objReport.Load()</p>
<p>&#8216;Set the connection information<br />
ConInfo.ConnectionInfo.UserID =<br />
ConInfo.ConnectionInfo.Password =<br />
ConInfo.ConnectionInfo.ServerName =<br />
ConInfo.ConnectionInfo.DatabaseName = </p>
<p>For intCounter = 0 To objReport.Database.Tables.Count &#8211; 1<br />
                objReport.Database.Tables(intCounter).ApplyLogOnInfo(ConInfo)<br />
Next</p>
<p>&#8216; Loop through each section on the report then look<br />
&#8216; through each object in the section<br />
&#8216; if the object is a subreport, then apply logon info<br />
&#8216; on each table of that sub report</p>
<p>For index = 0 to objReport.ReportDefinition.Sections.Count &#8211; 1<br />
      For intCounter = 0 To  _<br />
           objReport.ReportDefinition.Sections(index).ReportObjects.Count &#8211; 1<br />
              With objReport.ReportDefinition.Sections(index)<br />
                    If .ReportObjects(intCounter).Kind =   _<br />
                            CrystalDecisions.Shared.ReportObjectKind.SubreportObject Then<br />
                            mySubReportObject = CType(.ReportObjects(intCounter), _<br />
                            CrystalDecisions.CrystalReports.Engine.SubreportObject)<br />
                            mySubRepDoc = _<br />
                             mySubReportObject.OpenSubreport(mySubReportObject.SubreportName)<br />
                            For intCounter1 = 0 To mySubRepDoc.Database.Tables.Count &#8211; 1<br />
                                mySubRepDoc.Database.Tables(intCounter1).ApplyLogOnInfo( _<br />
                                                                                   ConInfo)<br />
                                mySubRepDoc.Database.Tables(intCounter1).ApplyLogOnInfo( _<br />
                                                                       ConInfo)<br />
                            Next<br />
                        End If<br />
                    End With<br />
                Next<br />
            Next</p>
<p>&#8216;If there is a selection formula<br />
If sSelectionFormula.Length &gt; 0 Then<br />
         objReport.RecordSelectionFormula = sSelectionFormula<br />
End If</p>
<p>‘Formula fields in string with key-value pair.<br />
‘Key-value separated by comma and forumlas are seperated by |<br />
If sFormulas.Trim()  &#8220;&#8221; Then<br />
   Dim sFormulaWithValues() As String = Split(sFormulas, &#8220;|&#8221;)<br />
   Dim i As Integer<br />
   For i = 0 To UBound(sFormulaWithValues)<br />
        Dim sFormulaValue() As String = Split(sFormulaWithValues(i), &#8220;,&#8221;)<br />
        objReport.DataDefinition.FormulaFields(sFormulaValue(0)).Text = sFormulaValue(1)<br />
   Next i<br />
End If</p>
<p>&#8216;Report file name<br />
sFileName = AppDomain.CurrentDomain.BaseDirectory &amp; &#8220;reports\&#8221; &amp; sFileName</p>
<p>CrystalReportViewer1.ReportSource = objReport<br />
CrystalReportViewer1.RefreshReport()<br />
CrystalReportViewer1.DataBind()<br />
‘Toolbar<br />
CrystalReportViewer1.DisplayToolbar = True<br />
‘Group tree<br />
CrystalReportViewer1.DisplayGroupTree = False</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ranjanaspnet.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ranjanaspnet.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ranjanaspnet.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ranjanaspnet.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ranjanaspnet.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ranjanaspnet.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ranjanaspnet.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ranjanaspnet.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ranjanaspnet.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ranjanaspnet.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ranjanaspnet.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ranjanaspnet.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ranjanaspnet.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ranjanaspnet.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ranjanaspnet.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ranjanaspnet.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ranjanaspnet.wordpress.com&amp;blog=1962970&amp;post=7&amp;subd=ranjanaspnet&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ranjanaspnet.wordpress.com/2007/10/23/calling-crystal-report-viewer-in-dot-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/613d9954a93c3e79c03fb1f9bc448a8c?s=96&#38;d=identicon" medium="image">
			<media:title type="html">ranjan</media:title>
		</media:content>
	</item>
	</channel>
</rss>
