tag:blogger.com,1999:blog-3527496470100925672024-03-12T20:44:37.874-07:00Padmika's BlogMusings of a developerAnonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.comBlogger22125tag:blogger.com,1999:blog-352749647010092567.post-67078338607224927382016-03-06T18:59:00.002-08:002016-03-06T18:59:48.899-08:00"Cannot get Mail" The user name or password for imap.gmail.com is incorrect iOSFor iOS if you are using Apple configurator to setup gmail make sure you follow these steps.<div>
<br /></div>
<div>
<a href="https://discussions.apple.com/message/26827218#26827218">https://discussions.apple.com/message/26827218#26827218</a></div>
<div>
<br /></div>
<div>
If you followed the steps above and still getting the incorrect username or password error make sure you have IMAP enabled on your gmail account.</div>
<div>
<br /></div>
<div>
Still if the issue persists then in your google/gmail security settings make sure you have enabled the <span style="background-color: yellow; font-weight: bold;">Allow less secure apps</span><span style="background-color: white;"> flag.</span></div>
<div>
<span style="background-color: white;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://discussions.apple.com/servlet/JiveServlet/downloadImage/2-28816863-610362/1561-900/Screenshot+2015-08-30+15.23.29.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="184" src="https://discussions.apple.com/servlet/JiveServlet/downloadImage/2-28816863-610362/1561-900/Screenshot+2015-08-30+15.23.29.jpg" width="320" /></a></div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-34964287194392305022016-01-19T19:46:00.000-08:002016-12-02T19:00:22.673-08:00The this keyword in javascript explainedthis keyword in Javascript is a source for confusion. The confusion is mostly due to the fact that the 'this' keyword is used differently in other languages compared to Javascript.<br />
<br />
I was also confused of this (Well I still am sometimes) as I was coming from a C# background where the 'this' keyword meant the current instance of that class.<br />
<br />
I hope the following will help someone to avoid the 'this' confusion altogether in Javascript.<br />
<br />
Let's take an example,<br />
<br />
<br />
<span style="background-color: #fce5cd;">function bar()</span><br />
<span style="background-color: #fce5cd;">{</span><br />
<span style="background-color: #fce5cd;"> console.log(this.age);</span><br />
<span style="background-color: #fce5cd;">}</span><br />
<br />
<code class="prettyprint lang-html"><br /></code>
So what will be the value of 'this'?<br />
<br />
Is it an object or is it referring to the function it self?<br />
<br />
What if I told you that you cannot answer this question at all at compile time.<br />
<br />
The trick is that the value of 'this' would depend on how the function is called.<br />
<br />
e.g 1, (Run this on the browser JS console)<br />
<br />
<span style="background-color: #fce5cd;">bar();</span><br />
<br />
The output would be undefined.<br />
<br />
So what was the 'this' object in the above example ? It was the global object (aka window object in the browser)<br />
<br />
So naturally the window object did not have a property named 'age' thus the undefined output.<br />
<br />
An easy way to think of this is who is calling the bar() function, if its no one then 'this' is going to be the global object.<br />
<br />
<br />
e.g 2,<br />
<br />
<span style="background-color: #fce5cd;">var x = { age : 10 , foo : bar };</span><br />
<span style="background-color: #fce5cd;"><br /></span>
<span style="background-color: #fce5cd;">x.foo();</span><br />
<br />
The above code will actually call the bar function as foo is pointing to bar.<br />
<br />
The output will be 10<br />
<br />
So in this example bar is being called by x and thus the 'this' object is the x object.<br />
<br />
<br />
e.g 3,<br />
<span style="background-color: #fce5cd;">var y = { age : 15 };</span><br />
<span style="background-color: #fce5cd;">bar.call(y);</span><br />
<br />
The output will be 15<br />
<br />
This is because the call() function explicitly sets the this object to the first argument passed into the call function.<br />
<br />
<br />
e.g 4,<br />
<br />
<span style="background-color: #fce5cd;">var z = new bar();</span><br />
<br />
Now the 'this' object will be a brand new object and it will also get assigned to z.<br />
This is because of the nature of the 'new' keyword in Javascript.<br />
<br />
So the bottom line is the 'this' keyword will depend on how its containing function is called and look to the left of the function call site to determine 'this'<br />
<br />
<br />
Hope this helps.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-52260161743398741792015-09-28T19:42:00.000-07:002015-09-28T19:43:13.158-07:00ASP.NET Concurrent Ajax Requests and slow performanceWhile working on a client project I came across an interesting issue. That is when concurrent Ajax requests (originating from Jquery ajax) came in the asp.net web service (A set of aspx web methods in this case) were performing ridiculously slow. The methods it self were executing pretty fast. It turned out that when you have "<span style="background-color: #eeeeee; color: #222222; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; font-size: 13px; line-height: 16.9px; white-space: pre-wrap;">[WebMethod(EnableSession = true)]</span>" the requests are processed sequentially with in the same session.<br />
<br />
The fix is to make the session read only, that is if your web methods are not modifying the session.<br />
<br />
If any other page methods are modifying the session then the best approach is to move your web methods to a different aspx file and make the session read only for that page. Below given is the page directive for doing that,<br />
<br />
<span style="background-color: white; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13.6px; line-height: 14.96px; white-space: pre;"><% @Page EnableSessionState="ReadOnly" %></span><br />
<br />
Hope this helps.Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-39139572270244435502014-11-17T10:21:00.001-08:002014-11-17T10:21:34.626-08:00cassandra vs rdbms data modelIf you are coming from a relational database world like me then the initial terminology used in cassandra will be a bit confusing.<br />
I'll state some keywords which are used in cassandra and try to draw parallels of them to the relational world.<br />
<br />
<b>Note: These parallels are just for ease of understanding and actually does not equal to each other at all.</b><br />
<br />
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div align="center" class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center;">
<b>Cassandra
keyword<o:p></o:p></b></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div align="center" class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center;">
<b>RDBMS
keyword<o:p></o:p></b></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div align="center" class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center;">
Keyspace<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div align="center" class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center;">
Database<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div align="center" class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center;">
Column family<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div align="center" class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center;">
Table<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div align="center" class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center;">
Column<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div align="center" class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center;">
Table Column<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div align="center" class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center;">
Row<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div align="center" class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center;">
Table row<o:p></o:p></div>
</td>
</tr>
</tbody></table>
<br />
The outermost element of Cassandra is a cluster which can be one or more nodes set up as a ring which appears as a single instance to the end user.<br />
<br />
A cluster usually contains one or more keyspaces (Databases).<br />
<br />
A keyspace contains one or more column families (Tables)<br />
<br />
A column family contains one or more rows. (Slightly different from a Table which would contain columns )<br />
<br />
A row contains one or more columns.<br />
<br />
The biggest difference is that the number and type of columns in rows can differ from one another thus making the Cassandra column family much more flexible compared with the rigid table structure in the rdbms world.<br />
<br />
In other words each row in a column family can have its own schema. This is an extremely useful option for storing dynamic dataAnonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-63348781018181193252014-08-03T10:14:00.000-07:002014-08-03T10:14:16.465-07:00Cannot read remote side has closed Thrift Cassandra C#I was seeing this error ("Cannot read remote side has closed") while trying to get Thrift API to work with Cassandra using Csharp. For the life of me I couldn't figure out what was wrong as even though the error is saying something like "Hey I think your Thrift server is down". That was not the case because I was connecting to My Cassandra server using other client libraries that was using Thrift under the hood. Eventually I figured out the error, the offending line was transport.Open(); When I replaced it with cassandraClient.InputProtocol.Transport.Open(); The error went away.
<br />
<br />
Here is the full snippet,<br />
<br />
<pre class="prettyprint"> TSocket socket = null;
TTransport transport = null;
socket = new TSocket("localhost", 9160);
transport = new TFramedTransport(socket);
TProtocol protocol = new TBinaryProtocol(transport);
CassandraClient cassandraClient = new CassandraClient(protocol);
cassandraClient.InputProtocol.Transport.Open();
string s = cassandraClient.describe_cluster_name();
List<ksdef> keyspaces = cassandraClient.describe_keyspaces();
</pre>
Hope this will help another poor soul.Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-67870577798711468222014-06-26T11:22:00.000-07:002014-06-26T11:22:07.392-07:00SQL GROUP BY ExampleThe GROUP BY clause causes data in a table (or any data source) to be divided into groups based on the expressions (or conditions) given in the GROUP BY clause. Seems confusing? Probably.. Let's see what it means,<br />
<br />
Say you have Column1, Column 2..etc on your table.<br />
<br />
Now you say GROUP BY Column1 , what this does is it divides your table's data based on Column1. So all data which has Column1='Apple' will be in one group, then all data which has Column1='Orange' will be in another group.<br />
<br />
Again if you had GROUP BY Column1, Column2 then your data will be divided into groups of Column1 + Column2 combinations . If Column2 had values of Green and Red in different rows then one group would be based on Apple+Red another group Apple+Green. So you get the point.<br />
<br />
So in a nutshell,<br />
<br />
<span style="background-color: white;"><span style="color: blue;">GROUP BY creates groups for output rows, according to unique combination of values specified in the GROUP BY clause</span></span><br />
<br />
But why would you need to divide them into groups? So we can operate on those groups.<br />
<br />
I'll use AdventureWorks database as an example.<br />
<br />
Download it here,<br />
<a href=https://msftdbprodsamples.codeplex.com/releases/view/93587>https://msftdbprodsamples.codeplex.com/releases/view/93587</a><br />
<br />
<br />
<pre class="prettyprint">
SELECT SalesPersonID, YEAR(OrderDate) AS OrderYear,<br />
COUNT(CustomerID) AS All_Customers<br />
FROM Sales.SalesOrderHeader<br />
GROUP BY SalesPersonID, YEAR(OrderDate);<br />
</pre>
<br />
The above query will return all unique combinations of SalesPersonID + YEAR(OrderDate) and display all customers each of those combinations.<br />
<br />
In other words this means you are seeing all customers for a particular Sales Person in a given year.<br />
<br />
Point to note:<br />
<br />
<pre class="prettyprint">
SELECT DISTINCT SalesPersonID ,YEAR(OrderDate) AS OrderYear<br />
FROM Sales.SalesOrderHeader<br />
</pre>
<br />
and<br />
<br />
<pre class="prettyprint">
SELECT SalesPersonID ,YEAR(OrderDate) AS OrderYear<br />
FROM Sales.SalesOrderHeader<br />
GROUP BY SalesPersonID, YEAR(OrderDate);<br />
</pre>
<br />
Will give you the same results.<br />
<br />Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-37537441310332491502014-05-24T02:15:00.001-07:002014-05-24T02:15:25.170-07:00ASP.Net Webforms Inline tags and code blocksThere are many elements inside a webforms (.aspx) page. To somebody beginning asp.net webforms these may seem quite similar and be confusing at first. (Well it was for me when I started learning asp.net webforms)<br />
So hopefully this might help another soul.<br />
<br />
Elements of a asp.net page (Inline tags and code blocks) can be listed as follows,<br />
<br />
<h3>
1. Directives</h3>
These come in many flavors like Page directives,<br />
ex : <span class="pun" style="color: #666600; font-size: 12px; margin: 0px; padding: 0px;"><%@</span><span class="pln" style="font-size: 12px; margin: 0px; padding: 0px;"> </span><span class="typ" style="color: #7f0055; font-size: 12px; margin: 0px; padding: 0px;">Page</span><span class="pln" style="font-size: 12px; margin: 0px; padding: 0px;"> </span><span class="typ" style="color: #7f0055; font-size: 12px; margin: 0px; padding: 0px;">Language</span><span class="pun" style="color: #666600; font-size: 12px; margin: 0px; padding: 0px;">=</span><span class="str" style="color: #008800; font-size: 12px; margin: 0px; padding: 0px;">"C#"</span><span class="pln" style="font-size: 12px; margin: 0px; padding: 0px;"> </span><span class="typ" style="color: #7f0055; font-size: 12px; margin: 0px; padding: 0px;">AutoEventWireup</span><span class="pun" style="color: #666600; font-size: 12px; margin: 0px; padding: 0px;">=</span><span class="str" style="color: #008800; font-size: 12px; margin: 0px; padding: 0px;">"true"</span><span class="str" style="font-size: 12px; margin: 0px; padding: 0px;"> </span><span class="typ" style="color: #7f0055; font-size: 12px; margin: 0px; padding: 0px;">CodeFile</span><span class="pun" style="color: #666600; font-size: 12px; margin: 0px; padding: 0px;">=</span><span class="str" style="color: #008800; font-size: 12px; margin: 0px; padding: 0px;">"Default.aspx.cs"</span><span class="pln" style="font-size: 12px; margin: 0px; padding: 0px;"> </span><span class="pln" style="font-size: 12px; margin: 0px; padding: 0px;"> </span><span class="typ" style="color: #7f0055; font-size: 12px; margin: 0px; padding: 0px;">Trace</span><span class="pun" style="color: #666600; font-size: 12px; margin: 0px; padding: 0px;">=</span><span class="str" style="color: #008800; font-size: 12px; margin: 0px; padding: 0px;">"true"</span><span class="pln" style="font-size: 12px; margin: 0px; padding: 0px;"> %></span><br />
<div>
<br /></div>
<div>
or Import directives,</div>
<div>
ex : <span class="pun" style="color: #666600; font-size: 12px; margin: 0px; padding: 0px;"><%@</span><span class="pln" style="font-size: 12px; margin: 0px; padding: 0px;"> </span><span class="kwd" style="color: #000088; font-size: 12px; margin: 0px; padding: 0px;">namespace</span><span class="pun" style="color: #666600; font-size: 12px; margin: 0px; padding: 0px;">=</span><span class="str" style="color: #008800; font-size: 12px; margin: 0px; padding: 0px;">"System.Drawing"</span><span class="pln" style="font-size: 12px; margin: 0px; padding: 0px;"> %></span></div>
<div>
<br /></div>
<div>
There are many more directives other than these two.</div>
<div>
<br /></div>
<div>
<h3>
2. ASP.Net expressions</h3>
</div>
<div>
This is expression builder syntax, typically used to get values from web.config</div>
<div>
ex: <span style="color: maroon; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 17.804800033569336px; white-space: inherit;"><%$ ConnectionStrings:AdventureWorks2008 %></span> </div>
<div>
<br /></div>
<div>
<h3>
3. User Controls</h3>
</div>
<div>
These are references to user created controls which are similar to web controls that enhances reusability </div>
<div>
ex: <span class="code-keyword" style="border: 0px; color: blue; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; margin: 0px; padding: 0px; white-space: pre-wrap;"><</span><span class="code-leadattribute" style="border: 0px; color: maroon; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; margin: 0px; padding: 0px; white-space: pre-wrap;">PH:MainMenu</span><span style="background-color: #fbedbb; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; white-space: pre-wrap;"> </span><span class="code-attribute" style="border: 0px; color: red; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; margin: 0px; padding: 0px; white-space: pre-wrap;">Title</span><span class="code-keyword" style="border: 0px; color: blue; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; margin: 0px; padding: 0px; white-space: pre-wrap;">="Menu</span><span class="code-keyword" style="border: 0px; color: blue; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; margin: 0px; padding: 0px; white-space: pre-wrap;"> Control"</span><span style="background-color: #fbedbb; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; white-space: pre-wrap;"> </span><span class="code-attribute" style="border: 0px; color: red; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; margin: 0px; padding: 0px; white-space: pre-wrap;">id</span><span class="code-keyword" style="border: 0px; color: blue; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; margin: 0px; padding: 0px; white-space: pre-wrap;">="mainmenu</span><span class="code-keyword" style="border: 0px; color: blue; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; margin: 0px; padding: 0px; white-space: pre-wrap;">"</span><span style="background-color: #fbedbb; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; white-space: pre-wrap;"> </span><span class="code-attribute" style="border: 0px; color: red; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; margin: 0px; padding: 0px; white-space: pre-wrap;">runat</span><span class="code-keyword" style="border: 0px; color: blue; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; margin: 0px; padding: 0px; white-space: pre-wrap;">="</span><span class="code-keyword" style="border: 0px; color: blue; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; margin: 0px; padding: 0px; white-space: pre-wrap;">server"</span><span style="background-color: #fbedbb; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; white-space: pre-wrap;"> </span><span class="code-keyword" style="border: 0px; color: blue; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; margin: 0px; padding: 0px; white-space: pre-wrap;">/</span><span class="code-keyword" style="border: 0px; color: blue; font-family: Consolas, 'Courier New', Courier, mono; font-size: 9pt; margin: 0px; padding: 0px; white-space: pre-wrap;">></span></div>
<div>
<br /></div>
<div>
<h3>
4. Render blocks</h3>
</div>
<div>
Used for outputting elements like variables</div>
<div>
ex: If you have a variable named age then,</div>
<div>
<code class="prettyprint">
<span style="background-color: #f0f0f0; color: #333333; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 13px; font-style: italic; line-height: 17.549999237060547px;"><%= age %></span>
</code></div>
<div>
will output the value of age</div>
<div>
<br /></div>
<div>
<h3>
5. Code blocks</h3>
</div>
<div>
These are similar to javascript tags just that these run on the server,</div>
<div>
<code class="prettyprint"><script runat="Server" language="c#" > ....some server side code here .... </script> </code></div>
<div>
<br /></div>
<div>
<h3>
6. Server Controls</h3>
</div>
<div>
These are the controls we drag and drop from the designer (Labels, Buttons etc)</div>
<div>
ex: <code class="prettyprint"><asp:Label id="myLabel" runat="Server" /></code></div>
<div>
<br /></div>
<div>
<h3>
7. Data binding controls</h3>
Used for biniding expressions such as Eval or Bind, these are typically used with data controls like Gridview<br />
ex :<code class="prettyprint"> <span style="background-color: yellow; font-family: Tahoma, Arial, Helvetica; font-size: 13px;"><%</span><span style="background-color: white; font-family: Tahoma, Arial, Helvetica; font-size: 13px;"># Eval("DBFieldName") </span><span style="background-color: yellow; font-family: Tahoma, Arial, Helvetica; font-size: 13px;">%></span><br />
<br />
</code></div>
Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-19729725094473465452014-03-25T09:00:00.003-07:002014-03-25T09:01:08.961-07:00DataContract vs Serializable WCFWhen applied to a class Serializable attribute serializes everything inside of it including private fields thus the developer has no control as what to expose.<br />
<span style="background-color: white; color: #545454; font-family: arial, sans-serif; font-size: x-small; line-height: 18.200000762939453px;"><br /></span>
When DataContract attribute is applied to a class it will serialize only the elements decorated with DataMember attribute thus the developer will have more control. Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-58932177827183543212014-03-25T08:25:00.000-07:002014-03-25T08:28:32.042-07:00ServiceContract Name property WCFThis property can give your contract a name which is different from the actual interface name. So this way if you decide to change the interface name of a already running WCF service your client wont break.<br />
<br />
Ex:<br />
<br />
<pre class="prettyprint"> [ServiceContract(Name="IGoodbyeService")]
public interface IHelloService
{
[OperationContract]
string GetMessage(string name);
}
</pre>
<br />
Now the contract name would be IGoodbyeService rather than IHelloService.<br />
<br />
To verify in the WSDL generated check the porttype property it should be IGoodbyeService<br />
<br />
<b>Note: Same can be done for OperationContract as well </b><br />
<br />Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-36296717189899369822014-03-24T10:11:00.001-07:002014-03-24T10:11:05.716-07:00Basic Elements of WCF Appconfig All config items should be inside ,<br />
<br />
<system.serviceModel><br />
<br />
This is the WCF namespace provided by Microsoft.<br />
<br />
Inside the <system.serviceModel> element you have the <services> element. This is where you configure all your services.<br />
For each service you have a <service> element inside <services> element.<br />
A particular service can be exposed using more than one endpoint. (Ex: http , net.tcp etc)<br />
So for each endpoint in a service you configure a <endpoint> element.<br />
An endpoint element will have three essential things,<br />
<br />
<ol>
<li>address</li>
<li>binding</li>
<li>contract </li>
</ol>
<div>
Here is a sample config (not complete) to get an idea.</div>
<div>
<br /></div>
<div>
The service name is HelloService (class and namespace both are HelloService) and has two endpoints (http and net.tcp) for the service.</div>
<div>
<br /></div>
<br />
<pre class="prettyprint"><div>
<?xml version="1.0" encoding="utf-8" ?></div>
<div>
<div>
<configuration></div>
<div>
<system.serviceModel></div>
<div>
<services></div>
<div>
<service name="HelloService.HelloService"></div>
<div>
<endpoint address="HelloService" binding="basicHttpBinding" contract="HelloService.IHelloService"></div>
<div>
</endpoint></div>
<div>
<endpoint address="HelloService" binding="netTcpBinding" contract="HelloService.IHelloService"></div>
<div>
</endpoint></div>
<div>
</service></div>
<div>
</services></div>
<div>
</system.serviceModel></div>
<div>
</configuration></div>
</div>
</pre>
Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-852856200462528642014-03-22T07:31:00.003-07:002014-03-22T07:31:45.348-07:00system.web vs system.webserverI have not worked in IIS6 and mostly I have worked on IIS 7+ and this came up when I was following a very old article (2003) ASP.Net article.<br />
<br />
Anyway system.web is IIS6 and classic mode.<br />
system.webserver is IIS7+ and integrated mode.<br />
<br />
One scenario you might come across is when adding httpmodules to your ASP.Net project. If you want backward compatibility then you should add the module section to both system.web section (which is there by default for all ASP.Net projects ) and to system.webserver.<br />
<br />
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 17.804800033569336px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;"><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><system.web></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><httpModules></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"></httpModules></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"></system.web></span></code></pre>
<br />
And<br />
<br />
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 17.804800033569336px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;"><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><system.webServer></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><modules></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"></modules></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"></system.webServer></span></code></pre>
<br />
<br />Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-65851140974514163582014-03-09T07:31:00.001-07:002014-03-09T07:32:25.754-07:00SQL JOIN Example<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Joins can be quite
perplexing initially hopefully this simple example will help. <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Joins are used to
combine data from multiple tables (usually two tables)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">There are three types of
joins,<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">1. INNER<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">2. OUTER - FULL, LEFT,
RIGHT<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">3. CROSS<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">For all examples I'll be
using the below given tables and use the Name field as the condition.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">
Table1<o:p></o:p></span></div>
<table border="0" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="border-collapse: collapse; mso-padding-alt: 0in 0in 0in 0in; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Id1<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Name1<o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">1<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Padmika<o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">2<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Dissanayake<o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">3<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Sukitha<o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">4<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Pahan<o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">
Table2<o:p></o:p></span></div>
<table border="0" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="border-collapse: collapse; mso-padding-alt: 0in 0in 0in 0in; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Id2<o:p></o:p></span></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Name2<o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">1<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Fernando<o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">2<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Malaka<o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">3<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Padmika<o:p></o:p></span></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">4<o:p></o:p></span></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 239.4pt;" valign="top" width="319"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Times New Roman","serif"; font-size: 12.0pt; mso-fareast-font-family: "Times New Roman";">Sukitha<o:p></o:p></span></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">1. INNER JOIN<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Returns</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"> only the set of records
that match the Name field in both Table 1 and Table2<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div style="background: #F7FAFB; border: solid #E3EDF3 1.0pt; mso-border-alt: solid #E3EDF3 .75pt; mso-element: para-border-div; padding: 8.0pt 8.0pt 8.0pt 8.0pt;">
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 20.4pt; margin: 19.2pt 0in; padding: 0in;">
<span style="color: #3a4145; font-family: "Courier New"; mso-fareast-font-family: "Times New Roman";">SELECT * FROM Table1<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 20.4pt; margin: 19.2pt 0in; padding: 0in;">
<b><span style="color: #3a4145; font-family: "Courier New"; mso-fareast-font-family: "Times New Roman";">INNER JOIN</span></b><span style="color: #3a4145; font-family: "Courier New"; mso-fareast-font-family: "Times New Roman";"> Table2<o:p></o:p></span></div>
<div class="MsoNormal" style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 20.4pt; margin: 19.2pt 0in; padding: 0in;">
<span style="color: #3a4145; font-family: "Courier New"; mso-fareast-font-family: "Times New Roman";">ON Table1.Name1 =
Table2.Name2<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Result,<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Id1<o:p></o:p></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Name1<o:p></o:p></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Id2<o:p></o:p></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Name2<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
1<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Padmika<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
3<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Padmika<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
3<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Sukitha<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
4<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Sukitha<o:p></o:p></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">* This gets executed in
the following manner, first get the first record from Table 1 get its name
field compare it to Table 2 first record name field if it’s a match return it,
now compare with Table2 second record name field… etc.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">You will see that only the
records that have a common name is returned<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">This is similar to the
intersection of two sets (Table1 and Table2) based on Name. <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">2. OUTER JOIN<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">2.1 FULL OUTER JOIN<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Returns all records in
Table 1 and Table 2, with matching records from both sides where available. If
there is no match, the missing side will contain null.</span><o:p></o:p></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div style="background: #F7FAFB; border: solid #E3EDF3 1.0pt; mso-border-alt: solid #E3EDF3 .75pt; mso-element: para-border-div; padding: 8.0pt 8.0pt 8.0pt 8.0pt;">
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 20.4pt; margin: 19.2pt 0in; padding: 0in;"><span style="color: #3a4145; font-size: 11.0pt;">SELECT * FROM Table1<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 20.4pt; margin: 19.2pt 0in; padding: 0in;"><b><span style="color: #3a4145; font-size: 11.0pt;">FULL OUTER JOIN</span></b><span style="color: #3a4145; font-size: 11.0pt;"> Table2<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 20.4pt; margin: 19.2pt 0in; padding: 0in;"><span style="color: #3a4145; font-size: 11.0pt;">ON Table1.Name1 = Table2.Name2<o:p></o:p></span></pre>
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Result,<o:p></o:p></span></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Id1<o:p></o:p></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Name1<o:p></o:p></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Id2<o:p></o:p></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Name2<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
1<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Padmika<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
3<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Padmika<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
2<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Dissanayake<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
null<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Null<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
3<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Sukitha<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
4<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Sukitha<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
4<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Pahan<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
null<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Null<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
null<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Null<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
1<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Fernando<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
null<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Null<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
2<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Malaka<o:p></o:p></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">This is similar to the
union of two sets (Table1 and Table2) based on Name.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">2.2 LEFT OUTER JOIN<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"> Returns the complete set of records from Table
1 (Left table), with the matching records for Name field (where available) in
Table 2. If there is no match, the right side will contain null.</span><o:p></o:p></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div style="background: #F7FAFB; border: solid #E3EDF3 1.0pt; mso-border-alt: solid #E3EDF3 .75pt; mso-element: para-border-div; padding: 8.0pt 8.0pt 8.0pt 8.0pt;">
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 20.4pt; margin: 19.2pt 0in; padding: 0in;"><span style="color: #3a4145; font-size: 11.0pt;">SELECT * FROM Table1<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 20.4pt; margin: 19.2pt 0in; padding: 0in;"><b><span style="color: #3a4145; font-size: 11.0pt;">LEFT OUTER JOIN</span></b><span style="color: #3a4145; font-size: 11.0pt;"> Table2<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 20.4pt; margin: 19.2pt 0in; padding: 0in;"><span style="color: #3a4145; font-size: 11.0pt;">ON Table1.Name1 = Table2.Name2<o:p></o:p></span></pre>
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Results,<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Id1<o:p></o:p></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Name1<o:p></o:p></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Id2<o:p></o:p></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Name2<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
1<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Padmika<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
3<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Padmika<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
2<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Dissanayake<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
null<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
null<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
3<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Sukitha<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
4<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Sukitha<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
4<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Pahan<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
null<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
null<o:p></o:p></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Special case of the
above result would be to select records that do not have any matching records
from the right table (Table2)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">To do this just add a ‘WHERE
Table2.Id2 IS NULL’ clause to the above query. <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Ex: You have a Customer
table and an Order table (Has a CustomerID column) and want to find out which
customers have not placed any orders <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">2.3 RIGHT OUTER JOIN <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Similar to the above but
all the right table (Table2) records will return rather than the left table
ones.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div style="background: #F7FAFB; border: solid #E3EDF3 1.0pt; mso-border-alt: solid #E3EDF3 .75pt; mso-element: para-border-div; padding: 8.0pt 8.0pt 8.0pt 8.0pt;">
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 20.4pt; margin: 19.2pt 0in; padding: 0in;"><span style="color: #3a4145; font-size: 11.0pt;">SELECT * FROM Table1<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 20.4pt; margin: 19.2pt 0in; padding: 0in;"><span style="color: #3a4145; font-size: 11.0pt;">RIGHT OUTER JOIN Table2<o:p></o:p></span></pre>
<pre style="background-position: initial initial; background-repeat: initial initial; border: none; line-height: 20.4pt; margin: 19.2pt 0in; padding: 0in;"><span style="color: #3a4145; font-size: 11.0pt;">ON Table1.Name1 = Table2.Name2<o:p></o:p></span></pre>
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Results,<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Id1<o:p></o:p></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Name1<o:p></o:p></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Id2<o:p></o:p></div>
</td>
<td style="border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Name2<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
null<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
null<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
1<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Fernando<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
null<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
null<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
2<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Malaka<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
1<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Padmika<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
3<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Padmika<o:p></o:p></div>
</td>
</tr>
<tr>
<td style="border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
3<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Sukitha<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
4<o:p></o:p></div>
</td>
<td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 119.7pt;" valign="top" width="160"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
Sukitha<o:p></o:p></div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Note</span></b><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"> : When inspected
carefully you will see that in this example,<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">OUTER JOIN result = LEFT
JOIN result + RIGHT JOIN result – INNER JOIN result<o:p></o:p></span></div>
Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-18104393317553770612014-03-08T04:28:00.004-08:002014-03-08T05:46:26.313-08:00SQL COUNT ExampleCOUNT returns the number of rows in a select statement (Also note that it doesn't consider null values),<br />
<br />
Note : I'll be using the AdventureWorks2008R2 sample database which can be downloaded from here,<br />
<br />
<a href="http://msftdbprodsamples.codeplex.com/releases/view/59211">http://msftdbprodsamples.codeplex.com/releases/view/59211</a><br />
<br />
<br />
<b>Example 1</b>,<br />
<br />
/* By using the * we return the number of records in the Sales.Customer table */<br />
<pre class="prettyprint">select
count(*)
from Sales.Customer;
</pre>
<br />
<br />
<b>Example 2</b>,<br />
<br />
/* By using StoreID inside the COUNT() function we return the number of store id's in the Sales.Customer table */<br />
<br />
<pre class="prettyprint">select
count(StoreID)
from Sales.Customer;
</pre>
<br />
<b>Example 3</b>,<br />
/* By using "DISTINCT StoreID" inside the COUNT() function we return the <u>unique</u> number of store id's in the Sales.Customer table */<br />
<br />
<pre class="prettyprint">select
count(distinct StoreID)
from Sales.Customer;
</pre>
<b>Note:</b> From a performance point of view it is better to use 1 instead of * inside the COUNT function.
Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-44373848065333444022014-03-01T00:13:00.000-08:002014-03-01T00:15:07.131-08:00DDL vs DML in SQL Server<h3>
DDL<span style="color: #333333; font-family: "Trebuchet MS","sans-serif"; font-size: 10.0pt;"><br />
<span style="background: white;">Data Definition Language (DDL) statements
are used to <u>define the database structure or schema</u>. Examples:</span></span><o:p></o:p></h3>
<ul type="circle">
<li class="MsoNormal" style="background: white; color: #333333; line-height: 14.4pt; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "Trebuchet MS","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">CREATE
- to create objects in the database<o:p></o:p></span></li>
<li class="MsoNormal" style="background: white; color: #333333; line-height: 14.4pt; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "Trebuchet MS","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">ALTER
- alters the structure of the database<o:p></o:p></span></li>
<li class="MsoNormal" style="background: white; color: #333333; line-height: 14.4pt; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "Trebuchet MS","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">DROP
- delete objects from the database</span></li>
</ul>
<h3>
DML<span style="color: #333333; font-family: "Trebuchet MS","sans-serif"; font-size: 10.0pt;"><br />
<span style="background: white;">Data Manipulation Language (DML) statements
are used for <u>managing data within schema objects</u>. Examples:</span></span><o:p></o:p></h3>
<br />
<ul type="circle">
<li class="MsoNormal" style="background: white; color: #333333; line-height: 14.4pt; mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "Trebuchet MS","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">SELECT
- retrieve data<o:p></o:p></span></li>
<li class="MsoNormal" style="background: white; color: #333333; line-height: 14.4pt; mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "Trebuchet MS","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">INSERT
- add data<o:p></o:p></span></li>
<li class="MsoNormal" style="background: white; color: #333333; line-height: 14.4pt; mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "Trebuchet MS","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">UPDATE
- modify data<o:p></o:p></span></li>
<li class="MsoNormal" style="background: white; color: #333333; line-height: 14.4pt; mso-list: l0 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "Trebuchet MS","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">DELETE
- remove data</span></li>
</ul>
<div>
<span style="color: #333333; font-family: Trebuchet MS, sans-serif; font-size: x-small;"><span style="line-height: 19.200000762939453px;"><b>Note : This is not limited to SQL Server</b></span></span></div>
Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-49310937503245066772014-02-28T22:15:00.001-08:002014-02-28T22:15:17.740-08:00SQL Server Data TypesHere are the SQL server data types for quick reference,<br />
<br />
<div class="MsoNormal">
</div>
<ol>
<li>Exact numerics – (bigint, bit, decimal, int, money, numeric,
smallint)</li>
<li>Approximate numerics (float, real)</li>
<li>Date and time (date, datetime2, datetime, datetimeoffset,
time)</li>
<li>Character strings (char, varchar, text)</li>
<li>Unicode character strings (nchar, ntext, nvarchar)</li>
<li>Binary strings (binary, varbinary, image)</li>
<li>Other data types (cursor, timestamp, uniqueidentifier,
table)</li>
<li>Large valued data types (varchar(max), nvarchar(max))</li>
<li>Large object data types (text, ntext, image, xml)</li>
</ol>
<o:p></o:p><br />
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div style="direction: ltr; line-height: 90%; margin-bottom: 0pt; margin-left: 0.38in; margin-top: 4.8pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
</div>
<div class="MsoNormal">
<o:p></o:p></div>
Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-22287619936921264032014-02-16T09:31:00.000-08:002014-02-16T09:32:29.997-08:00ASP.NET ViewState example <div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: 13.5pt;">ViewState is a client
side state management mechanism. It is not the only state management mechanism.
Some other examples would be, <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: 13.5pt;">For client side state
management,<o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial; margin: 0in 0in 0.0001pt; text-indent: -0.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; font-size: 10pt;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]--><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">Hidden Field</span><span style="font-family: 'Segoe UI', sans-serif; font-size: 10.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial; margin: 0in 0in 0.0001pt; text-indent: -0.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; font-size: 10pt;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]--><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">Cookies</span><span style="font-family: 'Segoe UI', sans-serif; font-size: 10.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial; margin: 0in 0in 0.0001pt; text-indent: -0.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; font-size: 10pt;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]--><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">Control State</span><span style="font-family: 'Segoe UI', sans-serif; font-size: 10.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: 13.5pt;">For server side,</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial; margin: 0in 0in 0.0001pt; text-indent: -0.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; font-size: 10pt;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]--><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">Session</span><span style="font-family: 'Segoe UI', sans-serif; font-size: 10.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial; margin: 0in 0in 0.0001pt; text-indent: -0.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; font-size: 10pt;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]--><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">Application Object</span><span style="font-family: 'Segoe UI', sans-serif; font-size: 10.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial; margin: 0in 0in 0.0001pt; text-indent: -0.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; font-size: 10pt;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]--><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">Caching</span><span style="font-family: 'Segoe UI', sans-serif; font-size: 10.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial; margin: 0in 0in 0.0001pt; text-indent: -0.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; font-size: 10pt;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]--><span style="border: 1pt none windowtext; font-family: Consolas; padding: 0in;">Database</span><span style="font-family: 'Segoe UI', sans-serif; font-size: 10.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-color: white; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: 13.5pt;">ViewState should be used to
persist only small amounts of data as having lots of data in ViewState will
degrade performance.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: 13.5pt;">Also by default ViewState
does not encrypt data but only encodes them to Base64. So generally sensitive data should not be kept there.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: 13.5pt;"><br />
However you can encrypt ViewState by setting ViewStateEncryptionMode="Always" as a page level directive,</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: 13.5pt;"><br /></span></div>
<pre class="code" style="color: darkgreen; font-family: Consolas, Courier, monospace; font-size: 13px; line-height: 17.549999237060547px;"><%@Page ViewStateEncryptionMode="Always" %></pre>
<pre class="code" style="color: darkgreen; font-family: Consolas, Courier, monospace; font-size: 13px; line-height: 17.549999237060547px;"></pre>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: 13.5pt;"> or for all pages by setting
in web.config,<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: 13.5pt;"><br /></span></div>
<pre class="code" style="color: darkgreen; font-family: Consolas, Courier, monospace; font-size: 13px; line-height: 17.549999237060547px;"><configuration>
<system.web>
<pages ViewStateEncryptionMode="Always" />
</system.web>
</configuration></pre>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: 13.5pt;">There is a lot of confusion
about ViewState and Form input preservation on postbacks.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: 13.5pt;">An example would be, how a textbox persists
data even when View State is set to off.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: 13.5pt;">This is because many ASP.Net
controls (</span><span style="font-size: medium;">TextBox, ListBox, RadioButtonList etc</span><span style="font-size: 13.5pt;">) have implemented the IPostBackDataHandler interface and
calls the LoadPostData(), which repopulates them.</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: 13.5pt;">Here is a small example of
using ViewState persist state,<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
</div>
<ol>
<li><span style="font-size: medium;">Create a ASP.Net web application </span></li>
<li><span style="font-size: medium;">Add a Web Form named </span>ViewStateExample</li>
<li><span style="font-size: medium;">Paste the below given code to the apsx and apsx.cs files respectively</span></li>
<li><span style="font-size: medium;">Make sure to rename of the namespace </span>LearnASPWebForms to your namespace</li>
</ol>
<br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 11.5pt;"> </span></div>
ViewStateExample.aspx
<br />
<pre class="prettyprint"><%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViewStateExample.aspx.cs" Inherits="LearnASPWebForms.ViewStateExample" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>ViewStateExample</title>
</head>
<body>
<form id="testform" runat="server">
<asp:Label runat="server" Text="Enter a Value" />
<asp:TextBox runat="server" id="FieldToBePreserved" /><br />
<asp:Button runat="server" id="SubmitForm" onclick="SubmitForm_Click" text="Submit and add to ViewState" />
<asp:Button runat="server" id="SubmitDontSave" text="Submit but dont save to ViewState" OnClick="SubmitDontSave_Click" />
<br /><br />
Value from ViewState: <asp:Label runat="server" id="ViewStateValue" BorderStyle="Dotted" />
</form>
</body>
</html>
</pre>
<br />
<br />
<br />
CodeBehind
ViewStateExample.aspx.cs
<br />
<pre class="prettyprint">using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace LearnASPWebForms
{
public partial class ViewStateExample : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (ViewState["Field"] != null)
ViewStateValue.Text = ViewState["Field"].ToString();
else
ViewStateValue.Text = "Nothing in ViewState";
}
protected void SubmitForm_Click(object sender, EventArgs e)
{
ViewState["NameOfUser"] = FieldToBePreserved.Text;
ViewStateValue.Text = FieldToBePreserved.Text;
}
protected void SubmitDontSave_Click(object sender, EventArgs e)
{
//This does nothing
}
}
}
</pre>
Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-67639230886820932282014-02-04T00:11:00.000-08:002014-02-04T00:11:19.436-08:00Could not load file or assembly EntityFramework, Version=6.0.0.0 and MVC 4In MVC 4 this mostly happens when you create a MVC 4 project and then for your DAL (Data access layer ) you have a separate class library project and install EF through NuGet. NuGet will give you the latest version which is currently EF 6. When you try to run the project you will see an error similar to the above with a yellow screen of death. The root cause is that MVC 4 has EF5 referenced. So just open up NuGet and upgrade EF to version 6 under updates section and you are good to go.Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-43898600839307885782014-02-01T22:57:00.000-08:002014-02-01T22:58:36.180-08:00ViewBag vs ViewData in ASP.NET MVCBottom line is that they are essentially the same, ViewBag is just a dynamic wrapper around ViewData. ViewData is actually a dictionary used to pass data from controllers to views. The following example will make this clear,<br />
<br />
<span style="color: #6aa84f;">ViewBag.Name = "Padmika"</span><br />
<br />
is equal to,<br />
<br />
<span style="color: #6aa84f;">ViewData["Name"] = "Padmika"</span>Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-19985924190347320392014-01-25T06:37:00.002-08:002014-01-25T06:37:56.435-08:00Browser definition safari3plus not found : Blackberry redirection not working One of the clients of the product that I work on had a problem where a redirection to an apps download page was not working on Blackberry 6.0 and Blackberry 7.0 OS devices and was working fine for BB 5.0 OS. Strangely this was working fine until the client had installed some updates from Microsoft.<br />
<br />
When digging in to the issue the root cause was that there is a custom browser definition for BB 6.0 and BB 7.0 browsers which had a different user agent string compared against BB 5.0 and this browser definition file was having a parent of "safari3to4". However the machine had an extra browser definition for "safari3plus" under,<br />
<br />
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\Browsers\safari.browser and<br />
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\Browsers\safari.browser<br />
<br />
This was causing the custom browser definition not getting picked up as the parent ID of it was safari3to4.<br />
The fix is (rather than removing safri3plus definition of the above mentioned files ) to rename the parent Id of the custom browser definition file under App_Browsers in the IIS deployed folder, this doesn't even require an IIS reset or an app pool recycle.<br />
<br />
Microsoft changes these browser definition files from time to time and developers who use Request.Browser property to do re-directions should be aware of this fact.<br />
<br />
Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-39996379702088824542013-12-29T04:10:00.000-08:002014-02-02T10:38:14.052-08:00Func vs Action vs Predicate in C#Often users find certain aspects of functional programming in C# confusing and this is one of them.<br />
<br />
To simply put Action<T> and Predicate<T> are special cases of Func<T,TResult>. And all of these are delegate types provided by C# so that you do not need to define your own delegate type.<br />
<br />
<b><u>Action<T></u></b><br />
When you need a delegate that takes in a parameter (say an int) and returns nothing (void) then you have,<br />
<br />
Action<int> which is equivalent to Func<int,void><br />
<br />
(<b>Note</b> that Func<int,void> is not something valid and wont work, this is just to draw a parallel between Action and Func. )<br />
<br />
<b><u>Predicate<T></u></b><br />
When you need a delegate that takes in a parameter (say an int ) and returns a bool then you have,<br />
<br />
Predicate<int> which is equivalent to Func<int,bool> <br />
<br />
Typically Linq uses Func and List<T> uses Action and Predicate. Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-13439974511258568442013-12-17T09:28:00.001-08:002013-12-17T09:29:33.054-08:00An unsecured or incorrectly fault error WCFI encountered this error while executing the following snippet,<br />
<br />
factory.CreateChannel().Issue(rst) <span style="color: #38761d;"> // Here the rst is a RequestSecurityToken object and </span><br />
<span style="color: #38761d;"> // factory is a WSTrustChannelFactory object</span><br />
<br />
It seems that this was due to incorrect clock skew between my machine (client) and the server (where the WCF service was running). After correcting the time of my machine the error went away.Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0tag:blogger.com,1999:blog-352749647010092567.post-29518478130924124902013-11-15T21:15:00.000-08:002013-11-15T21:15:29.651-08:00IIS error 405 method not allowedI was developing some services using Asp.net Web API and it was working fine on the visual studio development server, but as soon as I hosted it on IIS (7.5) I was getting this error. The HTTP verb for the service was PUT. GET and POST requests were working fine. The error was occurring due to WebDAV which does not allow the PUT verb. So a simple solution is to remove the WebDAV module from your web project.<br />
<br />
1. Go to your web.config and add the following under modules in system.webserver,<br />
<br />
<remove name="WebDAVModule"/><br />
<br />
2. After adding this my web.config looked like this (This is only a part of it),<br />
<br />
<system.webServer><br />
<validation validateIntegratedModeConfiguration="false" /><br />
<modules runAllManagedModulesForAllRequests="true"><br />
<span style="background-color: yellow;"> <remove name="WebDAVModule"/></span><br />
</modules>Anonymoushttp://www.blogger.com/profile/17738062232650302403noreply@blogger.com0