<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1382057422619872904</id><updated>2012-01-23T13:51:37.459-08:00</updated><category term='Dynamic Query'/><category term='.net next release'/><category term='Repeater With Empty Data Template'/><category term='whats new with .net'/><category term='Using PIVOT Query'/><category term='.NET Framework 4.0'/><category term='asp.net date'/><category term='Resizing youtube videos in asp.net pages'/><category term='RDBMS intro'/><category term='general regular expression for asp.net'/><category term='LINQ Query'/><category term='Datatable Edit'/><category term='user control level caching'/><category term='Regular Expression asp.net'/><category term='Pivot Query Example'/><category term='rotating rows to columns using pivot'/><category term='COM Glossry'/><category term='Quote'/><category term='web.config reading programatically'/><category term='Application_AuthenticateRequest'/><category term='C# Datetime'/><category term='page level output caching'/><category term='DataBase Basics'/><category term='DATE FORMAT'/><category term='Reading web.config files in asp.net'/><category term='Substract date'/><category term='Convert Date Time'/><category term='asp.net caching'/><category term='Search Based Query'/><category term='gates quote'/><category term='Datatable Sort'/><category term='MyRepeater with emptydatatemplate'/><category term='.NET 3.5'/><category term='Dynamic SQL Query with Stored Procedure'/><category term='Dataset Filter'/><category term='Sys.InvalidOperationException'/><category term='LINQ'/><category term='cache API'/><category term='quotes from bill gates'/><category term='how to clear log file DBCC shrinkfile'/><category term='sample data migration'/><category term='Dataset Edit'/><category term='ASP.NET Event Order HttpModules'/><category term='Datatable Select Distinct'/><category term='Custom Stored Procedure Paging'/><category term='What is COM'/><category term='FCKEditor Image Path'/><category term='Application_EndRequest'/><category term='SELECT CONVERT(VARCHAR('/><category term='F#'/><category term='asp.net yetanother forum integration'/><category term='asp.net custom paging'/><category term='Log file MS MSSQL'/><category term='Data Migration'/><category term='Application_BeginRequest'/><category term='Datetime format'/><category term='commanly used regular expression'/><category term='podcost'/><category term='MS SQL SERVER'/><category term='Application_Start'/><category term='Bill Gates'/><category term='Dataset'/><category term='embeding videos with resize'/><category term='YetAnotherForum'/><category term='Datatable Query'/><category term='SQL Date Time Format'/><category term='Date Conversion c#'/><category term='asp.net'/><category term='javascript file from code behind'/><category term='Condition Based Query'/><category term='get_element().style&apos; is null or not an object'/><category term='Data Contract'/><category term='Quick SQL Reference'/><category term='Converting Date'/><category term='how to data migration'/><category term='ASP.NET 3.5'/><category term='Stored Procedure Within Stored Procedure'/><category term='Event Order Sequence'/><category term='caching techniq'/><category term='Custom Repeater Control'/><category term='future of .NET'/><category term='Pivot Query'/><category term='Lambda Expression'/><category term='javascript'/><category term='Date Manupulation'/><category term='DBCC SHRINKFILE'/><category term='Dynamic Query Stored Procedure'/><category term='asp.net AJAX'/><category term='Fundamental of data migration'/><category term='Extended Date Format'/><category term='ASP.NET Event Order MasterPages'/><category term='quote of bill gates'/><category term='SELECT Basics'/><category term='AJAX'/><category term='Programmatically adding JavaScript File'/><category term='Application_End'/><category term='MS SQL Basics'/><category term='Paging and Dynamic query With Stored Procedure'/><category term='Datatable'/><category term='asp.net data migration'/><category term='End points'/><category term='Adding Date'/><category term='Session_Start'/><category term='youtube regular expression'/><category term='resize videos embedded'/><category term='bill gates said'/><category term='Sys is not defined'/><category term='Datatable Add'/><category term='FCKEditor Skin'/><category term='reading web.config setting'/><category term='COM Define'/><category term='get_element().style'/><category term='Quotes by bill gates'/><category term='what is next .net'/><category term='Standard Date Format'/><category term='ASP.NET Event Order UserControls'/><category term='contextKey'/><category term='WCF Communication Protocol'/><category term='LINQ Query syntax'/><category term='javascript error asp.net 3.5 AJAX'/><category term='Building Dynamic Search Query'/><category term='data migration issues'/><category term='yetanother forum running live site'/><category term='Regulat Expression Element'/><category term='Datatable Delete'/><category term='F# .NET'/><category term='Querying Database'/><category term='Search Query Stored Procedure'/><category term='asp.net caching best practice'/><category term='Extending Repeater'/><category term='WCF Basics'/><category term='HtmlGenericControl  for adding script reference'/><category term='Config of FCKEditor'/><category term='LINQ to Dataset'/><category term='ASP.NET Event Order Pages'/><category term='Ajax DropDown'/><category term='Dataset Query'/><category term='Deferred LINQ Execution'/><category term='How to PIVOT Query'/><category term='Dataset Sort'/><category term='functional programming language'/><category term='COM'/><category term='LINQ Method syntax query'/><category term='OpenSource Forum'/><category term='MS SQL'/><category term='RDBMS Basics'/><category term='new programming language'/><category term='FCKEditor ASP.NET 3.5 Integration'/><category term='Application_Error'/><category term='regualr expression for youtube video url asp.net'/><category term='ScriptLoader.loadScripts cannot be called while the ScriptLoader is already loading'/><category term='Bill Gates Quote'/><category term='Stored Procedure Paging'/><category term='C#'/><category term='data migration basic'/><category term='data migration case study'/><category term='asp.net opensource forum'/><category term='Empty Data Template'/><category term='WCF'/><category term='Global.asax'/><category term='visual studio 2010'/><category term='FCKEditor'/><category term='MS SQL Query'/><category term='Choose .NET 3.5'/><category term='FCKEditor Custom Toolbar'/><category term='CascadingDropDown'/><category term='COM Fundamentals'/><title type='text'>Prawinway... small work arounds  !!!!!!!!!!!!!!!!!!</title><subtitle type='html'>ASP.NET 3.5, SQL Server, Ajax, Html, Javascript, CSS, XML, .Net Framework, IIS, Jquery,...... and the eternal journey continues...........</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>29</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-5765129205141361928</id><published>2010-02-02T08:31:00.001-08:00</published><updated>2010-02-02T08:42:29.921-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LINQ to Dataset'/><category scheme='http://www.blogger.com/atom/ns#' term='Lambda Expression'/><category scheme='http://www.blogger.com/atom/ns#' term='LINQ Query'/><category scheme='http://www.blogger.com/atom/ns#' term='Deferred LINQ Execution'/><category scheme='http://www.blogger.com/atom/ns#' term='LINQ Query syntax'/><category scheme='http://www.blogger.com/atom/ns#' term='LINQ'/><category scheme='http://www.blogger.com/atom/ns#' term='LINQ Method syntax query'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET 3.5'/><title type='text'>Basics and sample example of Language Integrated Query –(LINQ to Dataset)</title><content type='html'>&lt;span xmlns=""&gt;&lt;p&gt; &lt;span style="font-family:Arial;"&gt;&lt;strong&gt;Few Best Feature &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;    Write query against in memory collection other quenchable sources using any .    NET Language&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;    Using LINQ to SQL we can directly write Db related queries in the code itself&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;    We can write Data Access Code for XML using LINQ to XML&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;We can write common data access provider against different data source using LINQ to ENTITIES&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;    We can write reach Queries against data using LINQ to DATASET &lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;    &lt;strong&gt;Simplicity:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;        simplify the data access code and maintainability of code&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;    &lt;strong&gt;Query data in any .NET Programming Language:&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;we can write LINQ queries in the programming languages in stead of learning SQL dialect&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;    ex – var employee = from emp in&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;                tblemployee    &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;                where dept = 'sales'&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;                select emp&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;    &lt;strong&gt;Strongly Typed Object in our Data access code&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;Query against strongly typed data objects easily. Write data access code in object oriented manner as used in the rest of the application &lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;    &lt;strong&gt;Productivity&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;Increase productivity, reduce runtime errors by using strongly typed objects instead of traditional SQL queries &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;    &lt;strong&gt;Optimize Development Efforts&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;Become more productive and optimize the overall development efforts by using the consistent query language for all aspect of the application&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;    &lt;strong&gt;Reduce Bugs and Errors&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;Work with strongly typed CLR Objects that reduce runtime errors in the application, identify query related errors at the compile time and reduce the debugging efforts by using strongly typed objects &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;    &lt;strong&gt;Be more productive with the visual studio &lt;/strong&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;    &lt;strong&gt;Flexibility&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;Use of consistent LINQ syntax across all data source. Use LINQ with any data source&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;        LINQ to SQL, LINQ to DATASET, LINQ to XML and LINQ to Entities &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;strong&gt;LINQ Query&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;span style="font-family:Arial;"&gt;LINQ query consist of the Three part of the query operations &lt;/span&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:Arial;"&gt;&lt;strong&gt;Obtain the data source &lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Arial;"&gt;&lt;strong&gt;Create the query &lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Arial;"&gt;&lt;strong&gt;Execute query &lt;/strong&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;&lt;br /&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;// The Three Parts of a LINQ Query:&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// 1. Data source.&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;int[] numbers = new int[7] { 0, 1, 2, 3, 4, 5, 6 }; &lt;/em&gt;&lt;/span&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// 2. Query creation.&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// Array implicitly supports the generic IEnumerable&amp;lt;T&amp;gt; interface&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// numQuery is an IEnumerable&amp;lt;int&amp;gt;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;var numQuery =&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;from num in numbers&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;where (num % 2) == 0&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;select num; &lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// 3. Query execution.&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;foreach (int num in numQuery)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Console.Write("{0,1} ", num);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;} &lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;Developer who writes queries, most visible language integrated part of LINQ is the Query Expression, which is written in the declarative syntax, by using query syntax we can perform complex filtering, ordering and grouping operations on different data sources with minimum code.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;Variable in query expression is strongly typed, although in many cases we don't need to provide type explicitly&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;LINQ queries can be written as &lt;strong&gt;Query Syntax and Method syntax &lt;/strong&gt;&lt;/span&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;Most queries in the LINQ documentation are written in the query syntax however the CLR does not have any notion for query syntax itself therefore during compilation query expression are converted into something that CLR can understand These methods are called standard query operators, and they have names such as Where, Select, GroupBy, Join, Max, Average, and so on. You can call them directly by using method syntax instead of query syntax. &lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;In general query syntax is preferred over the method syntax coz is is usually more simpler and can understand easily but in fact there is no semantic difference in between the query syntax and the method syntax there are some operation such as number of element that matched the specified condition, maximum value in the data source can be expressed only as the method syntax. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;strong&gt;Query Expression syntax and Method syntax LINQ Query&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;br /&gt;&lt;em&gt;int[] numbers = { 5, 10, 8, 3, 6, 12}; &lt;/em&gt;&lt;/span&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;    //Query syntax:&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;    IEnumerable&amp;lt;int&amp;gt; numQuery1 =&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;from num in numbers&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;where num % 2 == 0&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;orderby num&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;select num; &lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;    //Method syntax:&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;IEnumerable&amp;lt;int&amp;gt; numQuery2 = numbers.Where(num =&amp;gt; num % 2 == 0).OrderBy(n =&amp;gt; n); &lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;     foreach (int i in numQuery1)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;     {&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;     Console.Write(i + " ");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;     }&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;     Console.WriteLine(System.Environment.NewLine);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;    foreach (int i in numQuery2)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;    {&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Console.Write(i + " ");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;} &lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// Keep the console open in debug mode.&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Console.WriteLine(System.Environment.NewLine);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Console.WriteLine("Press any key to exit");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Console.ReadKey(); &lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;/*&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Output:&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;6 8 10 12&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;6 8 10 12&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;*/ &lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;output from the above two example is same. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;To understand the query based syntax is very easy.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;Now we will poke up in the Method based syntax&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;on the right side of the query expression where clause is expressed as the instance method on the numbers object like numbers.Where, here we will find the the where which is not the default method found on array but infact this is the extension method The standard query operators(like Where/Select/SelectMany/Join / and Orderby) are implemented as a new kind of method called extension methods. Extensions methods "extend" an existing type; they can be called as if they were instance methods on the type.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;strong&gt;Lambda Expressions&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;In method syntax conditional expression (num % 2 == 0) is passed as Where(num =&amp;gt; num % 2 == 0) This inline expression is called as Lambda Expression&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;This is the conveient way of writing the code otherwise which will be written in the cumbersome manner as anonymous method, generic expression or expression tree.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;The symbaol (=&amp;gt;) read as GOES TO &lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;num on the left side of the operator is the input body of the lambda is just same as the query expression or it can include any other complex logic return value is just expression result. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;strong&gt;Query Exceution &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;strong&gt;Deferred Execution&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;In LINQ the excutio of query is different than the query itself.we will not receive any data by just creating the query variable.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;Each query is not executable until we iterate over the query variable over foreach loop&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;A query is executed in a foreach statement, and foreach requires IEnumerable or IEnumerable&amp;lt;(Of &amp;lt;(T&amp;gt;)&amp;gt;). Types that support IEnumerable&amp;lt;(Of &amp;lt;(T&amp;gt;)&amp;gt;) or a derived interface such as the generic IQueryable&amp;lt;(Of &amp;lt;(T&amp;gt;)&amp;gt;) are called queryable types. &lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;Because the query variable itself never holds the query results, you can execute it as often as you like. For example, you may have a database that is being updated continually by a separate application. In your application, you could create one query that retrieves the latest data, and you could execute it repeatedly at some interval to retrieve different results every time.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;strong&gt;Forcing Immediate Execution&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;Queries that perform aggregation functions over a range of source elements must first irate through the source elements Queries such as Count, Max, Average, First These execute without the explicit foreach statement bcoz the query itself must use the foreach to return the resulted single value like this &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;var evenNumQuery =&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;from num in numbers &lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;where (num % 2) == 0&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;select num; &lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;int evenNumCount = evenNumQuery.Count(); &lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;to force immediate execution of any query and cache its result we can use ToList(TSource) or ToArray(TSource) methods like below &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;List&amp;lt;int&amp;gt; numQuery2 =&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;(from num in numbers&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;where (num % 2) == 0&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;select num).ToList();&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// or like this:&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// numQuery3 is still an int[]&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;var numQuery3 =&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;(from num in numbers&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;where (num % 2) == 0&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;select num).ToArray(); &lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;We can also force execution by putting the foreach loop immediately after the query expression. However, by calling ToList or ToArray We can also cache all the data in a single collection object. &lt;/span&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;Some RnD with LINQ to Dataset. Following example which is the simple empty aspx page to test the normal functionality of the LINQ. This is done as a part of digging the practice carried out by me to test the various simple aspect of the LINQ coding.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;Following is the code behind code of the empty aspx page which we can use to test LINQ functionality on the fly along with the few basics mentioned in the c&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;using System;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;using System.Configuration;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;using System.Data;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;using System.Reflection;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;using System.Linq;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;using System.Web;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;using System.Web.Security;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;using System.Web.UI;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;using System.Web.UI.WebControls;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;using System.Web.UI.WebControls.WebParts;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;using System.Xml.Linq;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;using System.Text;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;using System.Collections.Generic;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;public partial class _Default : System.Web.UI.Page&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;FewBasicsofLinq();&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;LessThanGreaterThanTest();&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DataSet ds = CreateSampleDataset();&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;SimpleWhereCondition(ds);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;LinqtoObjectTest(ds);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;FieldTExample(ds);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DelegateLinqTest(ds);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DataRowComparerUniontest(ds);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;ShapingQueries(ds);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;GropuingResults(ds);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;JoinExample(ds);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;AsDataViewTestExample(ds);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;CopyToDattableTestExample(ds);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;protected void FewBasicsofLinq()&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("1) LINQ queries target IEnumerable&amp;lt;T&amp;gt; sources. The DataSets DataTable and the DataTables DataRowCollection do not implement IEnumerable&amp;lt;DataRow&amp;gt; so these types cannot be used as sources for LINQ query expressions. To work around this issue, an extension method called &amp;lt;b&amp;gt;AsEnumerable&amp;lt;/b&amp;gt; was added to the DataTable type. This extension method takes a source DataTable and wraps it in an object of the type EnumerableRowCollection which implements IEnumerable&amp;lt;DataRow&amp;gt;. This allows DataTables to be a source for LINQ query expressions.&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("2) In fact, the DataTable.AsEnumerable method turns a given DataTable into a sequence of objects where the element type is DataRow. (see linqtoobject&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("3) As a general rule, all access to DataRow column values should be done through the Field&amp;lt;T&amp;gt; method when developing LINQ to DataSet query expressions. This makes the query expression much less error prone and generally provides much cleaner code. &amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("4) DataSet is an entirely in-memory cache, all LINQ queries against it are translated directly into .NET IL (intermediate language). This is different from LINQ technologies such as LINQ to SQL or LINQ to Entities which require the LINQ query to be translated to the target source's query language, and are therefore limited by what can be translated. As a result, LINQ to DataSet queries can be arbitrarily complex and can contain anything that can be expressed in the host language. &amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("5) When working with LINQ to DataSet, you should also keep in mind how the LINQ set query operators (Union, Distinct, Intersection, Except) work. These operators all have two overloads, one which takes an IEqualityComparer&amp;lt;T&amp;gt; and one that does not. When calling one of the set query operators where the source(s) is IEnumerable&amp;lt;DataRow&amp;gt;, the set operator implementation will call DataRow.Equals() to compare elements when an IEqualityComparer&amp;lt;DataRow&amp;gt; comparer is not passed in. For developers familiar with the well known relational semantics of set operators, the results will be quite unexpected since the DataRow.Equals method will compare DataRow references and not the underlying values. &amp;lt;b&amp;gt;To support more traditional relational semantics LINQ to DataSet includes a type called DataRowComparer which includes a default DataRow comparer for comparing two DataRows.&amp;lt;/b&amp;gt; &amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;protected void LessThanGreaterThanTest()&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;int[] no = { 10, 13, 1, 4, 12, 3, 4, 9, 8, 120, 1234 };&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;var nogreaterthan80 = from n in no&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;where n &amp;gt; 80&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;orderby n ascending&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;select n;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("No Greater Than 80 : &amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;foreach (var number in nogreaterthan80)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write(number + "&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;var nolessthan120 = from n in no&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;where n &amp;lt; 120&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;orderby n descending&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;select n;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("No Less Than 120 : &amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;foreach (var number in nolessthan120)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write(number + "&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;protected DataSet CreateSampleDataset()&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DataSet ds = new DataSet("Parks");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DataTable parksDataTable = ds.Tables.Add("National Parks");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;parksDataTable.Columns.Add("ID", typeof(int));&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;parksDataTable.Columns.Add("Name", typeof(string));&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;parksDataTable.Columns.Add("YearEstablished", typeof(int));&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;parksDataTable.Columns.Add("Country", typeof(string));&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;parksDataTable.Columns.Add("Rating", typeof(int));&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DataTable countriesDataTable = ds.Tables.Add("Countries");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;countriesDataTable.Columns.Add("ID", typeof(int));&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;countriesDataTable.Columns.Add("Name", typeof(string));&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;countriesDataTable.Columns.Add("Population", typeof(long));&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;countriesDataTable.Columns.Add("ContinentID", typeof(int));&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DataTable continentsDataTable = ds.Tables.Add("Continents");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;continentsDataTable.Columns.Add("ID", typeof(int));&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;continentsDataTable.Columns.Add("Name", typeof(string));&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DataRelation ContinentCountryDataRelation = ds.Relations.Add(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;continentsDataTable.Columns["ID"],&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;countriesDataTable.Columns["ContinentID"]);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;continentsDataTable.Rows.Add(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;new object[] { 1, "North America" });&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;continentsDataTable.Rows.Add(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;new object[] { 2, "South America" });&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;continentsDataTable.Rows.Add(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;new object[] { 3, "Asia" });&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;countriesDataTable.Rows.Add(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;new object[] { 1, "Canada", 31612000, 1 });&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;countriesDataTable.Rows.Add(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;new object[] { 2, "USA", 302249000, 1 });&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;countriesDataTable.Rows.Add(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;new object[] { 3, "Argentina", 39921833, 2 });&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;countriesDataTable.Rows.Add(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;new object[] { 4, "Japan", 127433000, 3 });&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;countriesDataTable.Rows.Add(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;new object[] { 5, "South Korea", 49024737, 3 });&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;parksDataTable.Rows.Add(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;new object[] { 1, "Jasper", 1907, "Canada", 8 });&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;parksDataTable.Rows.Add(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;new object[] { 2, "Yoho", 1886, "Canada", 7 });&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;parksDataTable.Rows.Add(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;new object[] { 3, "North Cascade", 1968, "USA", 9 });&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;parksDataTable.Rows.Add(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;new object[] { 4, "Lago Puelo", 1971, "Argentina", 8 });&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;parksDataTable.Rows.Add(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;new object[] { 5, "Bandai-Asahi", 1950, "Japan", null });&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;parksDataTable.Rows.Add(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;new object[] { 6, "Saikai", 1955, "Japan", 6 });&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;parksDataTable.Rows.Add(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;new object[] { 7, "Jirisan", 1967, "South Korea", 8 });&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("&amp;lt;b&amp;gt;Dataset Created !!!!&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;return ds;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;protected void SimpleWhereCondition(DataSet ds)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("&amp;lt;b&amp;gt;Simple where condition&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;var wherecountryname = from park in ds.Tables["National Parks"].AsEnumerable()&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;where (string)park["Country"] == "Japan"&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;select park;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DumpResults(wherecountryname);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;protected void LinqtoObjectTest(DataSet ds)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("&amp;lt;b&amp;gt;Linq To Object&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;List&amp;lt;DataRow&amp;gt; list = new List&amp;lt;DataRow&amp;gt;(ds.Tables["Continents"].Rows.Cast&amp;lt;DataRow&amp;gt;());&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;var querylinqtoobject = from park in list&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;where (string)park["Name"] == "Asia"&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;select park;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DumpResults(querylinqtoobject);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;protected void FieldTExample(DataSet ds)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("&amp;lt;b&amp;gt;field&amp;lt;T&amp;gt; Example&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;var fldtex = from park in ds.Tables["National Parks"].AsEnumerable()&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;where park.Field&amp;lt;int?&amp;gt;("Rating") &amp;gt; 8&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;select park;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DumpResults(fldtex);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;//CALLING DELEGATE checkPopulation from linq to dataset queries&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;protected void DelegateLinqTest(DataSet ds)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("&amp;lt;b&amp;gt;Delgate Linq Example&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Func&amp;lt;long, bool&amp;gt; checkPopulation = delegate(long i)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{return i &amp;lt; 100000000;};&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;var delgatelinqtest = from country in&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;ds.Tables["Countries"].AsEnumerable()&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;where country.Field&amp;lt;string&amp;gt;("Name").Length &amp;gt; 3 &amp;amp;&amp;amp;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;!country.HasErrors &amp;amp;&amp;amp;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;checkPopulation(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;country.Field&amp;lt;long&amp;gt;("Population"))&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;select country;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DumpResults(delgatelinqtest);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;protected void DataRowComparerUniontest(DataSet ds)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("&amp;lt;b&amp;gt;Data Row comparer Union Test&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;var source1 = from park in ds.Tables["National Parks"].AsEnumerable()&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;where park.Field&amp;lt;int?&amp;gt;("Rating") &amp;lt; 8&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;select park;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;var source2 = from park in ds.Tables["National Parks"].AsEnumerable()&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;where park.Field&amp;lt;int&amp;gt;("YearEstablished") &amp;gt; 1960&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;select park;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;var unionResults = source1.Union(source2, DataRowComparer.Default);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DumpResults(unionResults);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;//use DataRowCompared for explanation view the head topic no 5)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;protected void ShapingQueries(DataSet ds)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("&amp;lt;b&amp;gt;Shaping Queries&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;var shapingqueries = from park in ds.Tables["National Parks"].AsEnumerable()&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;orderby park.Field&amp;lt;int&amp;gt;("YearEstablished")&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;select new&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;ParkName = park.Field&amp;lt;string&amp;gt;("Name"),&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Established =&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;park.Field&amp;lt;int&amp;gt;("YearEstablished")&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;};&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DumpResults(shapingqueries);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;//use DataRowCompared for explanation view the head topic no 5)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;protected void GropuingResults(DataSet ds)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("&amp;lt;b&amp;gt;Grouping Results&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;var groupingrslt = from park in ds.Tables["National Parks"].AsEnumerable()&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;group park by park.Field&amp;lt;string&amp;gt;("Country") into g&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;select new { Country = g.Key, Count = g.Count() };&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DumpResults(groupingrslt);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;//use DataRowCompared for explanation view the head topic no 5)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;protected void JoinExample(DataSet ds)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;//Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;//Response.Write("&amp;lt;b&amp;gt;Join Example Results&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;//var joinexampl = from park in ds.Tables["National Parks"].AsEnumerable()&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// join country in ds.Tables["Countries"].AsEnumerable()&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// on park.Field&amp;lt;string&amp;gt;("Country") equals&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// country.Field&amp;lt;string&amp;gt;("Name")&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// select new&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// {&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// ParkName = park.Field&amp;lt;string&amp;gt;("Name"),&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// Country = country.Field&amp;lt;string&amp;gt;("Name"),&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// Continent = country.&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// GetParentRow(&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// ContinentCountryDataRelation)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// .Field&amp;lt;string&amp;gt;("Name")&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;// };&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;//DumpResults(joinexampl);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;//Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;//use DataRowCompared for explanation view the head topic no 5)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;protected void AsDataViewTestExample(DataSet ds)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("&amp;lt;b&amp;gt;AsDataViewTest Example Results&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DataView dataView = (from park in&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;ds.Tables["National Parks"].AsEnumerable()&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;where park.Field&amp;lt;int?&amp;gt;("YearEstablished") &amp;lt; 1960&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;orderby park.Field&amp;lt;string&amp;gt;("Country")&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;select park).AsDataView();&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DataRowView[] drv = dataView.FindRows("Canada");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;foreach (object obj in drv.Cast&amp;lt;Object&amp;gt;())&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write(obj);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;//use DataRowCompared for explanation view the head topic no 5)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;protected void CopyToDattableTestExample(DataSet ds)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("&amp;lt;b&amp;gt;CopyToDattableTest Example Results&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;DataTable newParksTable = (from park in&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;ds.Tables["National Parks"].AsEnumerable()&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;where park.Field&amp;lt;int?&amp;gt;("YearEstablished") &amp;lt; 1960&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;orderby park.Field&amp;lt;int?&amp;gt;("YearEstablished")&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;select park).CopyToDataTable();&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write("###################################################################################&amp;lt;/br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;//use DataRowCompared for explanation view the head topic no 5)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;//Method to Display the query result&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;public void DumpResults&amp;lt;T&amp;gt;(IEnumerable&amp;lt;T&amp;gt; source)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;StringBuilder sb = new StringBuilder();&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;if (typeof(T) == typeof(DataRow))&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;foreach (DataRow dr in source.Cast&amp;lt;DataRow&amp;gt;())&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;foreach (object o in dr.ItemArray)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;sb.Append((o == DBNull.Value ? "DBNull" : o) + " ");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;sb.Append("&amp;lt;br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;else&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;foreach (T t in source)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;foreach (PropertyInfo pi in typeof(T).GetProperties())&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;{&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;object o = pi.GetValue(t, null);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;sb.Append(o + " ");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;sb.Append("&amp;lt;br&amp;gt;");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;Response.Write(sb.ToString());&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;}&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;        &lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;strong&gt;LAMBDA EXPRESSION&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;Lambda expression is the anonymous function which can contain the expression and statement can can be used to create delegate and expression tree&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;    Lambda expression use the Lambda Operator(=&amp;gt;) read as &lt;strong&gt;GOES TO &lt;/strong&gt;.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;The left side of the lambda expression specifies the input if any and right side holds the expression or statement block. The lambda expression p =&amp;gt; p * p read as "p goes to p time p" this &lt;strong&gt;expression can be assigned as delegate types&lt;/strong&gt; as follows&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;    delegate int del(int i);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;    static void Main(string[] args)&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;    {&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;        del myDelegate = p =&amp;gt; p * p;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;        int j = myDelegate(5); //j = 25&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;    }&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;Lambdas are not allowed on the left side of the is or as operator.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;All restrictions that apply to anonymous methods also apply to lambda expressions.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;strong&gt;Expression Lambadas&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;A lambda expression with an expression on the right hand side is called expression lambda. Expression lambda are used extensively in the construction of the expression trees&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;An expression lambda returns the expression result and takes the following basic form&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;(input parameter) =&amp;gt; expression&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;parenthesis are optional if the input parameter is single otherwise it is compulsory. Two or more parameter enclosed in the parenthesis separated by comma&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;(x, y) =&amp;gt; x == y&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;sometime it is difficult or impossible for compiler to infer the input data type, in that case we can specify the data type explicitly as follows&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;(int x, string s) =&amp;gt; s.Length &amp;gt; x&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;even we can specify zero input parameter with empty parenthesis like as&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;() =&amp;gt; SomeMethod()&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;strong&gt;Statement Lambda&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;statement lambda resembles the expression lambda except that the statement is enclosed in the parenthesis&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;(input parameter ) =&amp;gt; (statement;)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;body of the statement lambda can consist of any number of lines but practically they are not more than two three lines&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;delegate void TestDelegate(string s);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 35pt"&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;…&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;TestDelegate myDel = n =&amp;gt; { string s = n + " " + "World"; Console.WriteLine(s); };&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;&lt;em&gt;myDel("Hello");&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Arial;"&gt;Statement lambdas, like anonymous methods, cannot be used to create expression trees.&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-5765129205141361928?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/5765129205141361928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=5765129205141361928' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/5765129205141361928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/5765129205141361928'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2010/02/language-integrated-query-linq-linq-to.html' title='Basics and sample example of Language Integrated Query –(LINQ to Dataset)'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-4221269859349200484</id><published>2010-01-17T04:04:00.001-08:00</published><updated>2010-01-17T04:36:56.442-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WCF Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Data Contract'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF Communication Protocol'/><category scheme='http://www.blogger.com/atom/ns#' term='End points'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET 3.5'/><title type='text'>WCF Basics / fundamentals how to</title><content type='html'>&lt;span xmlns=""&gt;&lt;h2&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Overview&lt;br /&gt;&lt;/span&gt;&lt;/h2&gt;&lt;h4&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;em&gt;Windows Communication Foundation takes combines many existing communication technologies, such as Web Services, Windows Remoting, Microsoft Message Queuing (MSMQ), and abstracts them into a single technology (WCF). In most cases, this simplifies the way WE communicate with other applications. It also allows us to communicate with other applications without being coupled to a specific technology. Therefore, we could use Web Services over SOAP to begin with, and later move to remote procedure calls (RPC) without changing our code&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h2&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;The Basics&lt;br /&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Conceptual Overview&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;Windows Communication Foundation (WCF) is a runtime and a set of APIs for creating systems that send messages between services and clients.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;The same infrastructure and APIs are used to create applications that communicate with other applications on the same computer system or on a system that resides in another company and is accessed over the Internet.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;Messaging and Endpoints&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;WCF is based on the notion of message-based communication, and anything that can be modeled as a message (for example, an HTTP request or an MSMQ message) can be represented in a uniform way in the programming model. This enables a unified API across different transport mechanisms.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;The model distinguishes between &lt;em&gt;clients&lt;/em&gt;, which are applications that initiate communication, and &lt;em&gt;services&lt;/em&gt;, which are applications that wait for clients to communicate with them and respond to that communication. A single application can act as both a client and a service.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;Messages are sent between endpoints. Endpoints are places where messages are sent or received (or both), and they define all the information required for the message exchange. A service exposes one or more application endpoints (as well as zero or more infrastructure endpoints), and the client generates an endpoint that is compatible with one of the service's endpoints.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;An &lt;em&gt;endpoint&lt;/em&gt; describes in a standard-based way where messages should be sent, how they should be sent, and what the messages should look like. A service can expose this information as metadata that clients can process to generate appropriate WCF clients and communication &lt;em&gt;stacks&lt;/em&gt;.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;Communication Protocols&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;One required element of the communication stack is the &lt;em&gt;transport protocol&lt;/em&gt;. Messages can be sent over intranets and the Internet using common transports, such as HTTP and TCP. Other transports are included that support communication with Microsoft Message Queuing (MSMQ) applications and nodes on a Peer Networking mesh. More transport mechanisms can be added using the built-in extension points of WCF.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;Another required element in the communication stack is the encoding that specifies how any given message is formatted. WCF provides the following encodings:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;Text encoding, an interoperable encoding.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;Message Transmission Optimization Mechanism (MTOM) encoding, which is an interoperable way for efficiently sending unstructured binary data to and from a service.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;Binary encoding for efficient transfer.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;More encoding mechanisms (for example, a compression encoding) can be added using the built-in extension points of WCF.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;Message Patterns&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;WCF supports several messaging patterns, including request-reply, one-way, and duplex communication. Different transports support different messaging patterns, and thus affect the types of interactions that they support. The WCF APIs and runtime also help you to send messages securely and reliably.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;h2&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;WCF Terms&lt;br /&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;Other concepts and terms used in the WCF documentation include the following.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;message&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;A message is a self-contained unit of data that may consist of several parts, including a body and headers.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;service&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;A service is a construct that exposes one or more endpoints, with each endpoint exposing one or more service operations.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;endpoint&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;An endpoint is a construct at which messages are sent or received (or both). It comprises a location (an address) that defines where messages can be sent, a specification of the communication mechanism (a binding) that described how messages should be sent, and a definition for a set of messages that can be sent or received (or both) at that location (a service contract) that describes what message can be sent.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;An WCF service is exposed to the world as a collection of endpoints.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;application endpoint&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;An endpoint exposed by the application and that corresponds to a service contract implemented by the application.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;infrastructure endpoint&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;An endpoint that is exposed by the infrastructure to facilitate functionality that is needed or provided by the service that does not relate to a service contract. For example, a service might have an infrastructure endpoint that provides metadata information.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;address&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;An address specifies the location where messages are received. It is specified as a Uniform Resource Identifier (URI). The URI schema part names the transport mechanism to use to reach the address, such as HTTP and TCP. The hierarchical part of the URI contains a unique location whose format is dependent on the transport mechanism.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;The endpoint address enables you to create unique endpoint addresses for each endpoint in a service, or under certain conditions share an address across endpoints. The following example shows an address using the HTTPS protocol with a non-default port:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="BACKGROUND: #dddddd; MARGIN-LEFT: 36pt"&gt;&lt;pre&gt;&lt;code&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;HTTPS://prawinway:8005/ServiceModelSamples/CalculatorService&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;binding&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;span style="color:black;"&gt;A binding defines how an endpoint communicates to the world. It is constructed of a set of components called binding elements that "stack" one on top of the other to create the communication infrastructure. At the very least, a binding defines the transport (such as HTTP or TCP) and the encoding being used (such as text or binary). A binding can contain binding elements that specify details like the security mechanisms used to secure messages, or the message pattern used by an endpoint. For more information, see &lt;a href="http://msdn.microsoft.com/en-us/library/ms733830.aspx"&gt;&lt;/span&gt;Configuring Windows Communication Foundation Services&lt;span style="color:black;"&gt;.&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;binding element&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;A binding element represents a particular piece of the binding, such as a transport, an encoding, an implementation of an infrastructure-level protocol (such as WS-ReliableMessaging), or any other component of the communication stack.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;behaviors&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;A behavior is a component that controls various run-time aspects of a service, an endpoint, a particular operation, or a client. Behaviors are grouped according to scope: common behaviors affect all endpoints globally, service behaviors affect only service-related aspects, endpoint behaviors affect only endpoint-related properties, and operation-level behaviors affect particular operations. For example, one service behavior is throttling, which specifies how a service reacts when an excess of messages threaten to overwhelm its handling capabilities. An endpoint behavior, on the other hand, controls only aspects relevant to endpoints, such as how and where to find a security credential.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;system-provided bindings&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;span style="color:black;"&gt;WCF includes a number of system-provided bindings. These are collections of binding elements that are optimized for specific scenarios. For example, the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.wshttpbinding.aspx"&gt;&lt;/a&gt;&lt;/span&gt;WSHttpBinding&lt;span style="color:black;"&gt; is designed for interoperability with services that implement various WS-* specifications. These predefined bindings save time by presenting only those options that can be correctly applied to the specific scenario. If a predefined binding does not meet your requirements, you can create your own custom binding.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;configuration versus coding&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;Control of an application can be done either through coding, through configuration, or through a combination of both. Configuration has the advantage of allowing someone other than the developer (for example, a network administrator) to set client and service parameters after the code is written and without having to recompile. Configuration not only enables you to set values like endpoint addresses, but also allows further control by enabling you to add endpoints, bindings, and behaviors. Coding allows the developer to retain strict control over all components of the service or client, and any settings done through the configuration can be inspected and if needed overridden by the code.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;service operation&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;A service operation is a procedure defined in a service's code that implements the functionality for an operation. This operation is exposed to clients as methods on a WCF client. The method may return a value, and may take an optional number of arguments, or take no arguments, and return no response. For example, an operation that functions as a simple "Hello" can be used as a notification of a client's presence and to begin a series of operations.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;service contract&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;span style="color:black;"&gt;The service contract ties together multiple related operations into a single functional unit. The contract can define service-level settings, such as the namespace of the service, a corresponding callback contract, and other such settings. In most cases, the contract is defined by creating an interface in the programming language of your choice and applying the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.servicecontractattribute.aspx"&gt;&lt;/a&gt;&lt;/span&gt;ServiceContractAttribute&lt;span style="color:black;"&gt; attribute to the interface. The actual service code results by implementing the interface.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;operation contract&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;span style="color:black;"&gt;An operation contract defines the parameters and return type of an operation. When creating an interface that defines the service contract, you signify an operation contract by applying the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.operationcontractattribute.aspx"&gt;&lt;/a&gt;&lt;/span&gt;OperationContractAttribute&lt;span style="color:black;"&gt; attribute to each method definition that is part of the contract. The operations can be modeled as taking a single message and returning a single message, or as taking a set of types and returning a type. In the latter case, the system will determine the format for the messages that need to be exchanged for that operation.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;message contract&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;A message contract describes the format of a message. For example, it declares whether message elements should go in headers versus the body, what level of security should be applied to what elements of the message, and so on.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;fault contract&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;A fault contract can be associated with a service operation to denote errors that can be returned to the caller. An operation can have zero or more faults associated with it. These errors are SOAP faults that are modeled as exceptions in the programming model.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;data contract&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;The data types a service uses must be described in metadata to enable others to interoperate with the service. The descriptions of the data types are known as the data contract, and the types can be used in any part of a message, for example, as parameters or return types. If the service is using only simple types, there is no need to explicitly use data contracts.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;hosting&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;A service must be hosted in some process. A &lt;em&gt;host&lt;/em&gt; is an application that controls the lifetime of the service. Services can be self-hosted or managed by an existing hosting process.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;self-hosted service&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;A self-hosted service is one that runs within a process application that the developer created. The developer controls its lifetime, sets the properties of the service, opens the service (which sets it into a listening mode), and closes the service.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;hosting process&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;A hosting process is an application that is designed to host services. These include Internet Information Services (IIS), Windows Activation Services (WAS), and Windows Services. In these hosted scenarios, the host controls the lifetime of the service. For example, using IIS you can set up a virtual directory that contains the service assembly and configuration file. When a message is received, IIS starts the service and controls its lifetime.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;instancing&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;A service has an instancing model. There are three instancing models: "single," in which a single CLR object services all the clients; "per call," in which a new CLR object is created to handle each client call; and "per session," in which a set of CLR objects are created, one for each separate session. The choice of an instancing model depends on the application requirements and the expected usage pattern of the service.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;client application&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;A client application is a program that exchanges messages with one or more endpoints. The client application begins by creating an instance of a WCF client and calling methods of the WCF client. It is important to note that a single application can be both a client and a service.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;channel&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;A channel is a concrete implementation of a binding element. The binding represents the configuration, and the channel is the implementation associated with that configuration. Therefore, there is a channel associated with each binding element. Channels stack on top of each other to create the concrete implementation of the binding: the channel stack.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;WCF client&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;A WCF&lt;em&gt; client&lt;/em&gt; is a client-application construct that exposes the service operations as methods (in the .NET Framework programming language of your choice, such as Visual Basic or Visual C#). Any application can host a WCF client, including an application that hosts a service. Therefore, it is possible to create a service that includes WCF clients of other services.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;span style="color:black;"&gt;A WCF client can be automatically generated by using the &lt;a href="http://msdn.microsoft.com/en-us/library/aa347733.aspx"&gt;&lt;/a&gt;&lt;/span&gt;ServiceModel Metadata Utility Tool (Svcutil.exe)&lt;span style="color:black;"&gt; and pointing it at a running service that publishes metadata.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;metadata&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;span style="color:black;"&gt;The metadata of a service describes the characteristics of the service that an external entity needs to understand to communicate with the service. Metadata can be consumed by the &lt;a href="http://msdn.microsoft.com/en-us/library/aa347733.aspx"&gt;&lt;/a&gt;&lt;/span&gt;ServiceModel Metadata Utility Tool (Svcutil.exe)&lt;span style="color:black;"&gt; to generate a WCF client and accompanying configuration that a client application can use to interact with the service.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;The metadata exposed by the service includes XML schema documents, which define the data contract of the service, and WSDL documents, which describe the methods of the service.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;When enabled, metadata for the service is automatically generated by WCF by inspecting the service and its endpoints. To publish metadata from a service, you must explicitly enable the metadata behavior.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;security&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;Security in WCF includes confidentiality (encryption of messages to prevent eavesdropping), integrity (the means for detection of tampering with the message), authentication (the means for validation of servers and clients), and authorization (the control of access to resources). These functions are provided by either leveraging existing security mechanisms, such as TLS over HTTP (also known as HTTPS), or by implementing one or more of the various WS-* security specifications.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;transport security mode&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;Security can be provided by one of three modes: transport mode, message security mode, and transport with message credential mode. The transport security mode specifies that confidentiality, integrity, and authentication are provided by the transport layer mechanisms (such as HTTPS). When using a transport like HTTPS, this mode has the advantage of being efficient in its performance, and well understood because of its prevalence on the Internet. The disadvantage is that this kind of security is applied separately on each hop in the communication path, making the communication susceptible to a "man in the middle" attack.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;message security mode&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;Message security mode specifies that security is provided by implementing one or more of the security specifications, such as the specification named "Web Services Security: SOAP Message Security" (available at http://go.microsoft.com/fwlink/?LinkId=94684). Each message contains the necessary mechanisms to provide security during its transit, and to enable the receivers to detect tampering and to decrypt the messages. In this sense, the security is encapsulated within every message, providing end-to-end security across multiple hops. Because security information becomes part of the message, it is also possible to include multiple kinds of credentials with the message (these are referred to as &lt;em&gt;claims&lt;/em&gt;). This approach also has the advantage of enabling the message to travel securely over any transport, including multiple transports between its origin and destination. The disadvantage of this approach is the complexity of the cryptographic mechanisms employed, resulting in performance implications.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;transport with message credential security mode&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:black;"&gt;This mode uses the transport layer to provide confidentiality, authentication, and integrity of the messages, while each of the messages can contain multiple credentials (claims) required by the receivers of the message&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;There are a few basic tasks when creating a WCF service. The basic tasks that must be&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;performed are, in order:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Define the service contract. A service contract specifies the signature of a service, the data it exchanges, and other contractually required data.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Implement the contract. To implement a service contract, create the class that implements the contract and specify some custom behaviors that the runtime should have.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Configure the service by specifying endpoint information and other behavior information.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Host the service in an application.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Build a client application.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;For more information, see &lt;a href="http://msdn2.microsoft.com/en-us/library/ms732098.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms732098.aspx&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;h2&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Example&lt;br /&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;To display a step-by-step enactment of the above steps, let's define a web service that reports the current date/time:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;1.1 Define a Service Contract&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;First, let's create a project to house our service contract. Let's call it WCFDateTime.Service.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;1.2 Define a Service Contract&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Then, let's define an interface that represents the service we're going to provide. In this case, let's call it IDateTimeService.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;public interface IDateTimeService&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;span style="color:olive;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;h3&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;1.3 Define a Service Contract&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;    We need to add a method to our service that will return the current date/time:    &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;public interface IDateTimeService&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;DateTime GetCurrentDateTime();    &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;span style="color:olive;"&gt;}&lt;/span&gt;    &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;h3&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;1.4 Define a Service Contract&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Now, we need to decorate our code with attributes so that WCF will recognize our interface and its methods. Namely, we will add the following attributes:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul style="MARGIN-LEFT: 72pt"&gt;&lt;li&gt;&lt;div&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;strong&gt;ServiceContractAttribute&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Identifies an interface as a WCF service contract&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;div&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;strong&gt;OperationContractAttribute&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Identifies methods of an interface as WCF service operations, that is, methods that can be called through WCF&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;using System.ServiceModel;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;[ServiceContract]&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;public interface IDateTimeService&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;    [OperationContract]&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;DateTime GetCurrentDateTime();    &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;span style="color:olive;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;In order to use the above attributes, you'll need to add a reference to the System.ServiceModel assembly. The service contract is now ready to be used.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;h3&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;2.1 Implement the Contract&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Now that we've defined our service contract, we can move on to implementing it. First, let's create another project to house our server application. Let's call it WCFDateTime.Server, and make it a Console Application project.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;2.2 Implement the Contract&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Now, let's implement the IDateTimeService. The implementation is going to run on our server, to provide the date/time to whoever is going to consume our service.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;In the WCFDateTime.Server project, let's create a class called DateTimeService and have it implement IDateTimeService:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;using WCFDateTime.Service;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;public class DateTimeService : IDateTimeService&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;span style="color:olive;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;    &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Remember to add a reference to the WCFDateTime.Service project so you can use IDateTimeService.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;h3&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;2.3 Implement the Contract&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;The above code will obviously not compile, because we did not implement the GetCurrentDateTime method:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;public class DateTimeService : IDateTimeService&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;    public DateTime GetCurrentDateTime()&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;    {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;        return DateTime.Now;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;    }    &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;span style="color:olive;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;    That's it! The DateTimeService is now ready to be used.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;h3&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;3.1 Configure the Service&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Now we need to configure our service so it can be consumed by client applications. The simplest way to accomplish this is by adding an application configuration file (app.config or web.config) to the WCFDateTime.Server project:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;&amp;lt;configuration&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;&amp;lt;system.serviceModel&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;&amp;lt;services&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;&amp;lt;service name="WCFDateTime.Server.DateTimeService"&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;&amp;lt;endpoint&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;address="http://localhost:8081/DateTimeService"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;binding="wsHttpBinding"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;contract="WCFDateTime.Service.IDateTimeService" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;&amp;lt;/service&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;&amp;lt;/services&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;&amp;lt;/system.serviceModel&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;span style="color:olive;"&gt;&amp;lt;/configuration&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;    When defining an endpoint for WCF, remember your A-B-Cs:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ol style="MARGIN-LEFT: 90pt"&gt;&lt;li&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Address (where)&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Binding (how)&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Contract (what)&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;The &lt;em&gt;address &lt;/em&gt;specifies the address where you want the service to be located.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;The &lt;em&gt;binding &lt;/em&gt;specifies the transport you want to use in order to provide the service.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;The &lt;em&gt;contract&lt;/em&gt; specifies what service will be provided&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;4.1 Host the Service in an Application&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Now that WCF has been configured, the simplest way to host this service is to create a Console Application and use the ServiceHost class. First, add a reference to the System.ServiceModel assembly. Then, In the program.cs file of WCFDateTime.Server, do the following:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;using System.ServiceModel;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;namespace WCFDateTime.Server&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;class Program&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;static public void Main(string[] args)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;// Get a host for our service&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;ServiceHost serviceHost = new ServiceHost(&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;typeof(DateTimeService)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;// Open the service host to start listening for incoming requests&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;serviceHost.Open();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;// The service can now be accessed&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;Console.WriteLine("The service is ready.");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;Console.WriteLine("Press &amp;lt;ENTER&amp;gt; to terminate service.");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;Console.ReadLine();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;// Close the service host&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;serviceHost.Close();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;span style="color:olive;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;By simply running this application, we expose our service so that client applications can use it.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;h3&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;1 Build a Client Application&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;To build a client application, we must create a new project for it. Let's call it WCFDateTime.Client, and make it a Console Application as well.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;h3&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;2 Build a Client Application&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Now, we need to add an Application Configuration file, and give it some settings that will allow us to connect to the service we just created:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;&amp;lt;configuration&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;&amp;lt;system.serviceModel&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;&amp;lt;client&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;&amp;lt;endpoint&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;address="http://localhost:8081/DateTimeService"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;binding="wsHttpBinding"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;contract="WCFDateTime.Service.IDateTimeService"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;name="MyDateTimeService"&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;&amp;lt;/endpoint&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;&amp;lt;/client&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;&amp;lt;/system.serviceModel&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;span style="color:olive;"&gt;&amp;lt;/configuration&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;    &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Now that our we've configured our WCF client, we can connect to it. There are two ways to connect to the WCF service we previously created:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ol style="MARGIN-LEFT: 72pt"&gt;&lt;li&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;em&gt;Client proxy&lt;/em&gt; generation&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;em&gt;Channel factories&lt;/em&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Most Microsoft articles will point you in the direction of using &lt;strong&gt;client proxies&lt;/strong&gt;; however, for our purposes, &lt;strong&gt;channel factories&lt;/strong&gt; are quicker to implement and more robust in a Model/View/Presenter architecture.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;h3&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;3 Build a Client Application&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Now, add a reference to the System.ServiceModel and WCFDateTime.Service assemblies, and then add the following to the program.cs file:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;using System.ServiceModel;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;using WCFDateTime.Service;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;class Program&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;public static void Main(string[] args)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;// Get a channel factory for our service,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;// using the configuration for "MyDateTimeService"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;// in the application configuration file.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;ChannelFactory&amp;lt;IDateTimeService&amp;gt; channelFactory =&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;new ChannelFactory&amp;lt;IDateTimeService&amp;gt;("MyDateTimeService");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;// Get an instance of our service&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;IDateTimeService service = channelFactory.CreateChannel();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;// Get the server's date/time&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;DateTime dt = service.GetCurrentDateTime();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;// Write the current server date/time&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;Console.WriteLine("The current server time is " + dt);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;// Close the connection to our service&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;channelFactory.Close();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;color:olive;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="BACKGROUND: #ffffcc"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;&lt;span style="color:olive;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;h3&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;4 Build a Client Application&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;Your client application is now ready to run! Simply start the WCFDateTime.Server application, and once it's running, run the WCFDateTime.Client application to see it work!&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 36pt"&gt;&lt;span style="font-family:Times New Roman;font-size:12;"&gt;This example is ok for testing purpose but when it comes to real time implementation of WCF things goes something unexpected as excepted ;)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-4221269859349200484?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/4221269859349200484/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=4221269859349200484' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/4221269859349200484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/4221269859349200484'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2010/01/wcf-basics-fundamentals-how-to.html' title='WCF Basics / fundamentals how to'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-6377692387660406323</id><published>2009-07-28T02:27:00.000-07:00</published><updated>2009-07-28T07:32:26.581-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='youtube regular expression'/><category scheme='http://www.blogger.com/atom/ns#' term='regualr expression for youtube video url asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='Resizing youtube videos in asp.net pages'/><category scheme='http://www.blogger.com/atom/ns#' term='embeding videos with resize'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='resize videos embedded'/><title type='text'>Resizing youtube videos in asp.net pages</title><content type='html'>how can i make the videos size smaller or bigger that i have embdded in the asp.net pages ?&lt;br /&gt;&lt;br /&gt;how can i resize the videos embedded ??&lt;br /&gt;&lt;br /&gt;Whenever we embed the video in asp.net pages we get the object code which contians the&lt;br /&gt;height=”xxx” width=”xxx” – it should be near the very beginning of object.&lt;br /&gt;&lt;br /&gt;This is the code which tells html page the size of the video.&lt;br /&gt;&lt;br /&gt;I tried to change it but nothing was happening.&lt;br /&gt;&lt;br /&gt;There is one trick which we have to follow to achive this.&lt;br /&gt;&lt;br /&gt;youtube videos have the sixe of width="560" and height="340" by default.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;we have to adjust height and width so that the ratio of width to height remains same.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;for example consider if we have to make the video size half as the default we have to change the height and width keeping the ration of height and width as the same as default.&lt;br /&gt;&lt;br /&gt;for this we have to make the width="280" , height="170"&lt;br /&gt;&lt;br /&gt;see the following exapmle&lt;br /&gt;&lt;br /&gt;&lt;object width="212" height="172"&gt;&lt;param name="movie" value="http://www.youtube.com/v/z9l0g9L-_W8&amp;amp;hl=en&amp;amp;fs=1&amp;amp;"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/z9l0g9L-_W8&amp;amp;hl=en&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;This is the example&lt;br /&gt;&lt;br /&gt;&lt;object width="106" height="86"&gt;&lt;param name="movie" value="http://www.youtube.com/v/z9l0g9L-_W8&amp;amp;hl=en&amp;amp;fs=1&amp;amp;"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/z9l0g9L-_W8&amp;amp;hl=en&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;this is the half of the above size&lt;br /&gt;&lt;br /&gt;:)&lt;br /&gt;&lt;br /&gt;Capturing the actual video URL from the embed code of the You tube Video&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Regex r = new Regex ("src=\"(?&lt;/span&gt;&lt;youtube style="font-weight: bold;"&gt;http://www\\.youtube\\.com\\S*)\"");&lt;br /&gt;    Match m = r.Match(txtuploadvideo.Text);&lt;br /&gt;&lt;br /&gt;    if (m.Success)&lt;br /&gt;       string actualvideopath = m.ToString();&lt;br /&gt;    Response.Write(&lt;/youtube&gt;&lt;/code&gt;&lt;code style="font-weight: bold;"&gt;actualvideopath&lt;/code&gt;&lt;code&gt;&lt;youtube&gt;&lt;span style="font-weight: bold;"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;/youtube&gt;&lt;/code&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Where in &lt;/span&gt;&lt;code style="font-family: arial;"&gt;txtuploadvideo.Text is the actual embed object which we get from the youtube.&lt;br /&gt;&lt;br /&gt;in string &lt;/code&gt;&lt;code style="font-family: arial;"&gt;actualvideopath we get the actual url of the video of the youtube&lt;/code&gt;&lt;span style="font-family:arial;"&gt;,Which we can save it in the database and at runtime we can dispaly it as after concatnating it in the desired format.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;where in we can get control over the height and width in the display.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-6377692387660406323?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/6377692387660406323/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=6377692387660406323' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/6377692387660406323'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/6377692387660406323'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2009/07/resizing-youtube-videos-in-aspnet-pages.html' title='Resizing youtube videos in asp.net pages'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-7401024473736263885</id><published>2009-07-21T00:58:00.001-07:00</published><updated>2009-07-21T01:09:00.659-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Reading web.config files in asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='web.config reading programatically'/><category scheme='http://www.blogger.com/atom/ns#' term='reading web.config setting'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><title type='text'>Reading web.config files in asp.net web project for cookie time out.</title><content type='html'>&lt;span xmlns=""&gt;&lt;p&gt;In one of my project I had to implement and use the following method which will read timeout property from the web.config&lt;br /&gt;&lt;/p&gt;&lt;p&gt;In this way we can read any web.config setting programtically.for saving any values we have to use save and save as method.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;/// &amp;lt;summary&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;/// Retrieves cookie timeout value in the &amp;lt;forms&amp;gt;&amp;lt;/forms&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;/// section in the web.config file as this&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;/// value is not accessable via the FormsAuthentication or any other built in class&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;/// &amp;lt;/summary&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;private static int GetCookieTimeoutValue()&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;    int timeout = 30; //Default timeout is 30 minutes&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;    XmlDocument webConfig = new XmlDocument();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;    webConfig.Load(HttpContext.Current.Server.MapPath("web.config"));&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;    XmlNode node = webConfig.SelectSingleNode("/configuration/" +&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;                             "system.web/authentication/forms");&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;    if (node != null &amp;amp;&amp;amp; node.Attributes["timeout"] != null)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;    {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;        timeout = int.Parse(node.Attributes["timeout"].Value);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;    }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;    return timeout;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;After doing this, the system was able to read the "&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;timeout&lt;/span&gt;" value from the &lt;em&gt;web.config&lt;/em&gt; property.&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-7401024473736263885?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/7401024473736263885/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=7401024473736263885' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/7401024473736263885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/7401024473736263885'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2009/07/reading-webconfig-files-in-aspnet-web.html' title='Reading web.config files in asp.net web project for cookie time out.'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-5650440942094079714</id><published>2009-07-21T00:55:00.001-07:00</published><updated>2009-07-21T01:11:44.549-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='page level output caching'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net caching'/><category scheme='http://www.blogger.com/atom/ns#' term='user control level caching'/><category scheme='http://www.blogger.com/atom/ns#' term='caching techniq'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net caching best practice'/><category scheme='http://www.blogger.com/atom/ns#' term='cache API'/><title type='text'>ASP.NET Caching: Techniques and Best Practices</title><content type='html'>&lt;span xmlns=""&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;ASP.NET provides three primary forms of caching:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Page level output caching&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;User control level output caching (or fragment caching)&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Cache API.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Output caching and fragment caching are very easy to implement, and are sufficient in many cases.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;The cache API provides quite a lot additional flexibility, and can be used to take advantage of caching throughout every layer of an application.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Caching has the greatest potential impact on an application's performance, out of all the other features in ASP.NET, and it is one of the things that allow ASP.NET developers to accept the additional overhead of building sites using rather heavy controls like Grid View without fear that performance will suffer too much.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;In order to see the most benefit from caching in your applications, you should consider ways of implementing caching at all levels of your program.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:13pt;"  &gt;&lt;strong&gt;Cache Early; Cache Often&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Implement caching at every layer of your application. Add caching support to the data , business logic, and UI/output layer.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:13pt;"  &gt;&lt;strong&gt;Caching Hides Many Sins&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Caching can be a good way to get "good enough" performance without requiring a lot of time and analysis.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:18pt;"  &gt;&lt;strong&gt;Page Level Output Caching&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;The simplest form of caching, output caching simply keeps a copy of the HTML that was sent in response to a request in memory. Subsequent requests are then sent the cached output until the cache expires, resulting in potentially very large performance gains (depending on how much effort was required to create the original page output—sending cached output is always very fast and fairly constant).&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:13pt;"  &gt;&lt;strong&gt;Implementation&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;To implement page output caching, simply add an OutputCache directive to the page.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;&lt;strong&gt;&amp;lt;%@ OutputCache Duration="60" VaryByParam="*" %&amp;gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;This directive, as with other page directives should appear at the top of the ASPX page, before any output. It supports five attributes (or parameters), two of which are required.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;table style="border-collapse: collapse;" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 105px;"&gt;&lt;col style="width: 525px;"&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;&lt;tr&gt;&lt;td style="padding: 1px;" colspan="2" valign="middle"&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Duration&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding: 1px;" valign="middle"&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Required. Time, in seconds, the page should be cached. Must be a positive integer.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding: 1px;" colspan="2" valign="middle"&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Location&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding: 1px;" valign="middle"&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Specifies where the output should be cached. If specified, must be one of: Any, Client, Downstream, None, Server or ServerAndClient.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding: 1px;" colspan="2" valign="middle"&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;VaryByParam&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding: 1px;" valign="middle"&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Required. The names of the variables in the Request, which should result in, separate cache entries. "none" can be used to specify no variation. "*" can be used to create new cache entries for every different set of variables. Separate variables with ";".&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding: 1px;" colspan="2" valign="middle"&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;VaryByHeader&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding: 1px;" valign="middle"&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Varies cache entries based on variations in a specified header.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding: 1px;" colspan="2" valign="middle"&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;VaryByCustom&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding: 1px;" valign="middle"&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Allows custom variations to be specified in the global.asax (for example, "Browser").&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Most situations can be handled with a combination of the required Duration and VaryByParam options. For instance, if you have a product catalog that allows the user to view pages of the catalog based on a categoryID and a page variable, you could cache it for some period of time (an hour would probably be acceptable unless the products change all the time, so a duration of 3600 seconds) with a VaryByParam of "categoryID;page". This would create separate cache entries for every page of the catalog for each category. Each entry would persist for one hour from its first request.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;VaryByHeader and VaryByCustom are primarily used to allow customization of the page's look or content based on the client that is accessing them. Perhaps the same URL renders output for both browsers and mobile phone clients, and needs to cache separate versions based on this. Or perhaps the page is optimized for IE but needs to be able to degrade gracefully for Netscape or Opera (instead of just breaking). This last example is common enough that we'll show an example of how to do it:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;&lt;strong&gt;Example: VaryByCustom to support browser customization&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;In order to enable separate cache entries for each browser, VaryByCustom can be set to a value of "browser". This functionality is built into the caching module, and will insert separate cached versions of the page for each browser name and major version.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;&lt;strong&gt;&amp;lt;%@ OutputCache Duration="60" VaryByParam="None" VaryByCustom="browser"  %&amp;gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:18pt;"  &gt;&lt;strong&gt;Fragment Caching, User Control Output Caching&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Often, caching an entire page is not feasible, because certain parts of the page are customized for the user. However, there may be other parts of the page that are common to the entire application. These are perfect candidates for caching, using fragment caching and user controls. Menus and other layout elements, especially ones that are dynamically generated from a data source, should be cached with this technique. If need be, the cached controls can be configured to vary based on the changes to its controls (or other properties) or any of the other variations supported by page level output caching. Hundreds of pages using the same controls can also share the cached entries for those controls, rather than keeping separate cached versions for each page.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:13pt;"  &gt;&lt;strong&gt;Implementation&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Fragment caching uses the same syntax as page level output caching, but applied to a user control (.ascx file) instead of to a web form (.aspx file). All of the attributes supported by the OutputCache directive on a web form are also supported for user controls except for the Location attribute. User controls also support an OutputCache attribute called VaryByControl, which will vary the caching of the user control depending on the value of a member of that control (typically a control on the page, such as a DropDownList). If VaryByControl is specified, VaryByParam may be omitted. Finally, by default each user control on each page is cached separately. However, if a user control does not vary between pages in an application and is named the same across all such pages, the Shared="true" parameter can be applied to it, which will cause the cached version(s) of the user control to be used by all pages referencing that control.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;&lt;strong&gt;Examples&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;&lt;strong&gt;&amp;lt;%@ OutputCache Duration="60" VaryByParam="*" %&amp;gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;This would cache the user control for 60 seconds, and would create a separate cache entry for every variation of querystring and for every page this control is placed on.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;&lt;strong&gt;&amp;lt;%@ OutputCache Duration="60" VaryByParam="none"&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;&lt;strong&gt;  VaryByControl="CategoryDropDownList" %&amp;gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;This would cache the user control for 60 seconds, and would create a separate cache entry for each different value of the CategoryDropDownList control, and for each page this control is placed on.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;&lt;strong&gt;&amp;lt;%@ OutputCache Duration="60" VaryByParam="none" VaryByCustom="browser"&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;&lt;strong&gt;  Shared="true %&amp;gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Finally, this would cache the user control for 60 seconds, and would create one cache entry for each browser name and major version. The cache entries for each browser would then be shared by all pages referencing this user control (as long as all pages refer to the control with the same ID).&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:18pt;"  &gt;&lt;strong&gt;Caching API, Using the Cache Object&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Page and user control level output caching can be a quick and easy way to boost performance of your site, but the real flexibility and power of caching in ASP.NET is exposed via the Cache object. Using the Cache object, you can store any serializeable data object, and control how that cache entry expires based on a combination of one or more dependencies. These dependencies can include time elapsed since the item was cached, time elapsed since the item was last accessed, changes to files and/or folders, changes to other cached items, or (with a little work) changes to particular tables in a database.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:13pt;"  &gt;&lt;strong&gt;Storing Data in the Cache&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;The simplest way to store data in the Cache is simply to assign it, using a key, just like a HashTable or Dictionary object:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Cache["key"] = "value";&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;This will store the item in the cache without any dependencies, so it will not expire unless the cache engine removes it in order to make room for additional cached data. To include specific cache dependencies, the Add() or Insert() method is used. Each of these has several overloads. The only difference between Add() and Insert() is that Add() returns a reference to the cached object, while has no return value (void in C#, Sub in VB).&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;&lt;strong&gt;Examples&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;Cache.Insert("key", myXMLFileData, new&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;  System.Web.Caching.CacheDependency(Server.MapPath("users.xml")));&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;This would insert xml data from a file into the cache, eliminating the need to read from the file on subsequent requests. The CacheDependency will ensure that when the file changes, the cache will immediately expire, allowing the latest data to be pulled from the file and re-cached. An array of filenames can also be specified if the cached data depends on several files.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;Cache.Insert("dependentkey", myDependentData, new&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;  System.Web.Caching.CacheDependency(new string[] {}, new string[]&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;  {"key"}));&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;This example would insert a second piece of data that depended on the existence of the first piece (with a key value of "key"). If no key existed in the cache called "key", or if the item associated with that key expires or is updated, then the cache entry for "dependentkey" would expire.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;Cache.Insert("key", myTimeSensitiveData, null,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;  DateTime.Now.AddMinutes(1), TimeSpan.Zero);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Absolute Expiration: This example will cache the time sensitive data for one minute, at which point the cache will expire. Note that absolute expiration and sliding expiration (below) cannot be used together.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;Cache.Insert("key", myFrequentlyAccessedData, null,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;  System.Web.Caching.Cache.NoAbsoluteExpiration,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;  TimeSpan.FromMinutes(1));&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Sliding Expiration: This example will cache some frequently used data. The data will remain in the cache until one minute passes without anything referencing it. Note that sliding expiration and absolute expiration cannot be used together.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:13pt;"  &gt;&lt;strong&gt;More Options&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;In addition to the dependencies described above, we can also specify the priority of the item (from low to high to NotRemovable, defined in the System.Web.Caching.CacheItemPriority enumeration) and a &lt;strong&gt;CacheItemRemovedCallback&lt;/strong&gt; function to call when the item expires from the cache. Most of the time, the default priority will suffice—let the caching engine do what it's good at and handle the cache's memory management. The CacheItemRemovedCallback option allows for some interesting possibilities, but in practice it too is rarely used. However, to demonstrate the technique, I'll provide an example of its usage:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;&lt;strong&gt;CacheItemRemovedCallback example&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;System.Web.Caching.CacheItemRemovedCallback callback = new System.Web.Caching.CacheItemRemovedCallback (OnRemove);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;Cache.Insert("key",myFile,null,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;   System.Web.Caching.Cache.NoAbsoluteExpiration,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;   TimeSpan.Zero,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;   System.Web.Caching.CacheItemPriority.Default, callback);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt; . . .&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;public static void OnRemove(string key,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;   object cacheItem,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;   System.Web.Caching.CacheItemRemovedReason reason)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;   {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;      AppendLog("The cached value with key '" + key +&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;            "' was removed from the cache.  Reason: " +&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;            reason.ToString());&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;This will log the reason for the expiration of data from the cache using whatever logic is defined in the&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt; AppendLog() &lt;/span&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;method&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;One potential use for this feature would be to refresh cached data in the background so that users never need to wait for the data to be populated, but the data is kept relatively fresh. Unfortunately in practice, this doesn't work very well with the current version of the caching API, because the callback doesn't fire or complete execution prior to the cached item being removed from the cache. Thus, a user will frequently make a request that will try to access the cached value, find that it is null, and be forced to wait for it to repopulate. In a future version of ASP.NET, I would like to see an additional callback, which might be called CachedItemExpiredButNotRemovedCallback, which if defined must complete execution before the cached item is removed.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:13pt;"  &gt;&lt;strong&gt;Cached Data Reference Pattern&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Whenever an attempt is made to access data from the cache, it should be with the assumption that the data might not be there anymore. Thus, the following pattern should be universally applied to your access of cached data. In this case, we're going to assume the object that has been cached is a DataTable.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;public DataTable GetCustomers(bool BypassCache)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;{&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;   string cacheKey = "CustomersDataTable";&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;   object cacheItem = Cache[cacheKey] as DataTable;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;   if((BypassCache) || (cacheItem == null))&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;   {&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;      cacheItem = GetCustomersFromDataSource();&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;      Cache.Insert(cacheKey, cacheItem, null,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;      DateTime.Now.AddSeconds(GetCacheSecondsFromConfig(cacheKey),&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;      TimeSpan.Zero);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;   }&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;   return (DataTable)cacheItem;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10pt;"  &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;There are several points I'd like to make about this pattern:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Values, like cacheKey, cacheItem and the cache duration, are defined once and only once.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;The cache can be bypassed as needed—for example, after registering a new customer and redirecting to a list of customers, it would probably be best to bypass the cache and repopulate it with the latest data, which would include the newly inserted customer.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Cache is only accessed once. This has performance benefits and ensures that NullReferenceExceptions don't occur because the item was present the first time it was checked but had expired before the second check.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;The pattern uses strong type checking. The "as" operator in C# will attempt to cast an object to a type and will simply return null if it fails or if the object is null.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;The duration is stored in a configuration file. All cache dependencies, whether file-based, time-based, or otherwise, should ideally be stored in a configuration file so that changes can be made and performance measured easily. I also recommend that a default cache duration be specified, and that the GetCacheSecondsFromConfig() method uses the default if no duration is specified for the cacheKey being used.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Caching can provide huge performance benefits to applications, and should therefore be considered when an application is being designed as well as when it is being performance tested. I have yet to encounter an application that could not benefit from caching in some capacity, though certainly some applications are better suited than others. A solid understanding of the caching options available in ASP.NET is an important skill for any ASP.NET developer to master&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Times New Roman;font-size:12pt;"  &gt;Orignal Link - http://msdn.microsoft.com/en-us/library/aa478965.aspx&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-5650440942094079714?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/5650440942094079714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=5650440942094079714' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/5650440942094079714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/5650440942094079714'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2009/07/aspnet-caching-techniques-and-best.html' title='ASP.NET Caching: Techniques and Best Practices'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-3905275082155478361</id><published>2009-07-07T06:29:00.001-07:00</published><updated>2009-07-08T07:54:05.374-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Log file MS MSSQL'/><category scheme='http://www.blogger.com/atom/ns#' term='DBCC SHRINKFILE'/><category scheme='http://www.blogger.com/atom/ns#' term='MS SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='how to clear log file DBCC shrinkfile'/><category scheme='http://www.blogger.com/atom/ns#' term='MS SQL SERVER'/><title type='text'>How to DBCC SHRINKFILE to shrink the transaction log file in SQL Server 2005</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;In MS SQL Server 2005, we can shrink a transaction log file in a database to remove unused pages. The database engine reuses space effectively. However, when a transaction log file grows unexpectedly, we may have to shrink the transaction log file manually.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;In SQL Server 2005, a shrink operation (DBCC SHRINKFILE) tries to shrink the specified transaction log file to the requested size immediately. To shrink the transaction log file manually under the full recovery model, first back up the transaction log file. Then, use the DBCC SHRINKFILE statement to shrink the transaction log file.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;When you try to shrink a transaction log file that has little free space in SQL Server 2005, we may have to perform an additional log backup operation. The additional log backup operation truncates the transaction log file to a smaller size. This log backup operation is in addition to the three steps that we perform to shrink the transaction log file in SQL Server 2000. To shrink a transaction log file that has little free space in SQL Server 2005, follow these steps:&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;div&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Back up the transaction log file to make most of the active virtual log files inactive. Therefore, the inactive virtual log files can be removed in a later step. To do this, run a Transact-SQL statement that is similar to the following Transact-SQL statement. &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;BACKUP LOG &amp;lt;DatabaseName&amp;gt; TO DISK = '&amp;lt;BackupFile&amp;gt;'&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;strong&gt;Note&lt;/strong&gt; In this statement, &lt;em&gt;&amp;lt;DatabaseName&amp;gt;&lt;/em&gt; is a placeholder for the name of the database that you are backing up. In this statement, &lt;em&gt;&amp;lt;BackupFile&amp;gt;&lt;/em&gt; is a placeholder for the full path of the backup file.&lt;br/&gt;For example, run the following Transact-SQL statement. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;BACKUP LOG TestDB TO DISK='C:\TestDB1.bak'&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;div&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Shrink the transaction log file. To do this, run a Transact-SQL statement that is similar to the following Transact-SQL statement. &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;span style='font-family:Courier New; font-size:10pt'&gt;DBCC SHRINKFILE (&amp;lt;FileName&amp;gt;, &amp;lt;TargetSize&amp;gt;) WITH NO_INFOMSGS&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;strong&gt;Note&lt;/strong&gt; In this statement, &lt;em&gt;&amp;lt;FileName&amp;gt;&lt;/em&gt; is a placeholder for the name of the transaction log file. In this statement, &lt;em&gt;&amp;lt;TargetSize&amp;gt;&lt;/em&gt; is a placeholder for the target size that you want the transaction log file to be. The target size must be reasonable. For example, you cannot shrink the transaction log file to a size that is less than 2 virtual log files.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;If the DBCC SHRINKFILE statement does not shrink the transaction log file to the target size, run the BACKUP LOG statement that is mentioned in step 1 to make more of the virtual log files inactive.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Run the DBCC SHRINKFILE statement that is mentioned in step 2. After this operation, the transaction log file should be similar to the target size.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;In summary, the log manager's algorithm for picking up the next virtual log file changed in SQL Server 2005. Therefore, shrinking the transaction log file in SQL Server 2005 may differ from shrinking the transaction log file in SQL Server 2000: &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;If a log file has lots of free space, shrinking the transaction log file in SQL Server 2005 is faster than shrinking the transaction log file in SQL Server 2000.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;If a log file has no free space, shrinking the transaction log file in SQL Server 2005 is the same as shrinking the transaction log file in SQL Server 2000.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;If a log file has little free space, you may have to perform an additional log backup operation in SQL Server 2005 than you have to perform in SQL Server 2000.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-3905275082155478361?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/3905275082155478361/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=3905275082155478361' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/3905275082155478361'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/3905275082155478361'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2009/07/how-to-dbcc-shrinkfile-to-shrink.html' title='How to DBCC SHRINKFILE to shrink the transaction log file in SQL Server 2005'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-2819604015539510620</id><published>2009-06-20T06:10:00.001-07:00</published><updated>2009-06-20T06:27:15.848-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Standard Date Format'/><category scheme='http://www.blogger.com/atom/ns#' term='Convert Date Time'/><category scheme='http://www.blogger.com/atom/ns#' term='Extended Date Format'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Date Time Format'/><category scheme='http://www.blogger.com/atom/ns#' term='MS SQL Query'/><category scheme='http://www.blogger.com/atom/ns#' term='SELECT CONVERT(VARCHAR('/><category scheme='http://www.blogger.com/atom/ns#' term='MS SQL SERVER'/><category scheme='http://www.blogger.com/atom/ns#' term='DATE FORMAT'/><title type='text'>MS SQL SERVER DATE FORMAT</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;As How to format date time value or column in to format specific date is the frequent question whenever we do some common operation on the date time related values.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Here I have a summary of the different date time format of the MS SQL Server as a part of CONVERT Function&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Output of the following sample queries is in the VARCHAR data type and not of DATETIME data type.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Standard Date Format:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse'&gt;&lt;colgroup&gt;&lt;col style='width:175px'/&gt;&lt;col style='width:108px'/&gt;&lt;col style='width:288px'/&gt;&lt;col style='width:79px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  outset 0.75pt; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Date Format &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  outset 0.75pt; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Standard&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  outset 0.75pt; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SQL Statement&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  outset 0.75pt; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Output&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Mon DD YYYY &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;br/&gt;HH:MIAM (or PM)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Default&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(20), GETDATE(), 100)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Jan 1 2005 1:29PM &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;MM/DD/YY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;USA&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 1) AS [MM/DD/YY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;11/23/98&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;MM/DD/YYYY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;USA&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 101) AS [MM/DD/YYYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;11/23/1998&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;YY.MM.DD&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;ANSI&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 2) AS [YY.MM.DD]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;72.01.01&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;YYYY.MM.DD&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;ANSI&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 102) AS [YYYY.MM.DD]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;1972.01.01&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DD/MM/YY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;British/French&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 3) AS [DD/MM/YY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;19/02/72&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DD/MM/YYYY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;British/French&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 103) AS [DD/MM/YYYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;19/02/1972&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DD.MM.YY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;German&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 4) AS [DD.MM.YY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;25.12.05&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DD.MM.YYYY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;German&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 104) AS [DD.MM.YYYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;25.12.2005&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DD-MM-YY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Italian&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 5) AS [DD-MM-YY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;24-01-98&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DD-MM-YYYY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Italian&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 105) AS [DD-MM-YYYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;24-01-1998&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DD Mon YY &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;-&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(9), GETDATE(), 6) AS [DD MON YY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;04 Jul 06 &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DD Mon YYYY &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;-&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(11), GETDATE(), 106) AS [DD MON YYYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;04 Jul 2006 &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Mon DD, YY &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;-&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 7) AS [Mon DD, YY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Jan 24, 98 &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Mon DD, YYYY &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;-&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(12), GETDATE(), 107) AS [Mon DD, YYYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Jan 24, 1998 &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;HH:MM:SS&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;-&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 108)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;03:24:53&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Mon DD YYYY HH:MI:SS:MMMAM (or PM) &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Default + &lt;br/&gt;milliseconds&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(26), GETDATE(), 109)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Apr 28 2006 12:32:29:253PM &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;MM-DD-YY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;USA&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 10) AS [MM-DD-YY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;01-01-06&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;MM-DD-YYYY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;USA&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 110) AS [MM-DD-YYYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;01-01-2006&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;YY/MM/DD&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;-&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 11) AS [YY/MM/DD]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;98/11/23&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;YYYY/MM/DD&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;-&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 111) AS [YYYY/MM/DD]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;1998/11/23&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;YYMMDD&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;ISO&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(6), GETDATE(), 12) AS [YYMMDD]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;980124&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;YYYYMMDD&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;ISO&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 112) AS [YYYYMMDD]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;19980124&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DD Mon YYYY HH:MM:SS:MMM(24h) &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Europe default + milliseconds&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(24), GETDATE(), 113)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;28 Apr 2006 00:34:55:190 &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;HH:MI:SS:MMM(24H)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;-&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(12), GETDATE(), 114) AS [HH:MI:SS:MMM(24H)]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;11:34:23:013&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;YYYY-MM-DD HH:MI:SS(24h)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;ODBC Canonical&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(19), GETDATE(), 120)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;1972-01-01 13:42:24&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;YYYY-MM-DD HH:MI:SS.MMM(24h)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;ODBC Canonical&lt;br/&gt;(with milliseconds)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(23), GETDATE(), 121)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;1972-02-19 06:35:24.489&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;YYYY-MM-DDTHH:MM:SS:MMM&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;ISO8601&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(23), GETDATE(), 126)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;1998-11-23T11:25:43:250&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DD Mon YYYY HH:MI:SS:MMMAM &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Kuwaiti&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(26), GETDATE(), 130)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;28 Apr 2006 12:39:32:429AM &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DD/MM/YYYY HH:MI:SS:MMMAM&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Kuwaiti&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(25), GETDATE(), 131)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;28/04/2006 12:39:32:429AM&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;&lt;br /&gt;         &lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt; &lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt; &lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Here are some more date formats that does not come standard in SQL Server as part of the CONVERT function.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;Extended Date Format:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;table border='0' style='border-collapse:collapse'&gt;&lt;colgroup&gt;&lt;col style='width:81px'/&gt;&lt;col style='width:498px'/&gt;&lt;col style='width:72px'/&gt;&lt;/colgroup&gt;&lt;tbody valign='top'&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  outset 0.75pt; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Date Format&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  outset 0.75pt; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SQL Statement&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  outset 0.75pt; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Output&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;YY-MM-DD&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 3, 8) AS [YY-MM-DD]&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT REPLACE(CONVERT(VARCHAR(8), GETDATE(), 11), '/', '-') AS [YY-MM-DD]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;99-01-24&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;YYYY-MM-DD&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 120) AS [YYYY-MM-DD]&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 111), '/', '-') AS [YYYY-MM-DD]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;1999-01-24&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;MM/YY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT RIGHT(CONVERT(VARCHAR(8), GETDATE(), 3), 5) AS [MM/YY]&lt;br/&gt;SELECT SUBSTRING(CONVERT(VARCHAR(8), GETDATE(), 3), 4, 5) AS [MM/YY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;08/99&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;MM/YYYY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT RIGHT(CONVERT(VARCHAR(10), GETDATE(), 103), 7) AS [MM/YYYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;12/2005&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;YY/MM&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(5), GETDATE(), 11) AS [YY/MM]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;99/08&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style='height: 23px'&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;YYYY/MM&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(7), GETDATE(), 111) AS [YYYY/MM]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;2005/12&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Month DD, YYYY &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT DATENAME(MM, GETDATE()) + RIGHT(CONVERT(VARCHAR(12), GETDATE(), 107), 9) AS [Month DD, YYYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;July 04, 2006 &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Mon YYYY &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT SUBSTRING(CONVERT(VARCHAR(11), GETDATE(), 113), 4, 8) AS [Mon YYYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Apr 2006 &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Month YYYY &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT DATENAME(MM, GETDATE()) + ' ' + CAST(YEAR(GETDATE()) AS VARCHAR(4)) AS [Month YYYY] &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;February 2006 &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DD Month &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CAST(DAY(GETDATE()) AS VARCHAR(2)) + ' ' + DATENAME(MM, GETDATE()) AS [DD Month]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;11 September &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Month DD &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT DATENAME(MM, GETDATE()) + ' ' + CAST(DAY(GETDATE()) AS VARCHAR(2)) AS [Month DD]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;September 11 &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DD Month YY &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CAST(DAY(GETDATE()) AS VARCHAR(2)) + ' ' + DATENAME(MM, GETDATE()) + ' ' + RIGHT(CAST(YEAR(GETDATE()) AS VARCHAR(4)), 2) AS [DD Month YY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;19 February 72 &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DD Month YYYY &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CAST(DAY(GETDATE()) AS VARCHAR(2)) + ' ' + DATENAME(MM, GETDATE()) + ' ' + CAST(YEAR(GETDATE()) AS VARCHAR(4)) AS [DD Month YYYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;11 September 2002 &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;MM-YY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT RIGHT(CONVERT(VARCHAR(8), GETDATE(), 5), 5) AS [MM-YY]&lt;br/&gt;SELECT SUBSTRING(CONVERT(VARCHAR(8), GETDATE(), 5), 4, 5) AS [MM-YY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;12/92&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;MM-YYYY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT RIGHT(CONVERT(VARCHAR(10), GETDATE(), 105), 7) AS [MM-YYYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;05-2006&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;YY-MM&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT RIGHT(CONVERT(VARCHAR(7), GETDATE(), 120), 5) AS [YY-MM]&lt;br/&gt;SELECT SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 3, 5) AS [YY-MM]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;92/12&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;YYYY-MM&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT CONVERT(VARCHAR(7), GETDATE(), 120) AS [YYYY-MM]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;2006-05&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;MMDDYY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 1), '/', '') AS [MMDDYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;122506&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;MMDDYYYY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 101), '/', '') AS [MMDDYYYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;12252006&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DDMMYY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 3), '/', '') AS [DDMMYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;240702&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DDMMYYYY&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 103), '/', '') AS [DDMMYYYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;24072002&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Mon-YY &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT REPLACE(RIGHT(CONVERT(VARCHAR(9), GETDATE(), 6), 6), ' ', '-') AS [Mon-YY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Sep-02 &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Mon-YYYY &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT REPLACE(RIGHT(CONVERT(VARCHAR(11), GETDATE(), 106), 8), ' ', '-') AS [Mon-YYYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;Sep-2002 &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DD-Mon-YY &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT REPLACE(CONVERT(VARCHAR(9), GETDATE(), 6), ' ', '-') AS [DD-Mon-YY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;25-Dec-05 &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  outset 0.75pt; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;DD-Mon-YYYY &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;SELECT REPLACE(CONVERT(VARCHAR(11), GETDATE(), 106), ' ', '-') AS [DD-Mon-YYYY]&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style='padding-top: 3px; padding-left: 3px; padding-bottom: 3px; padding-right: 3px; border-top:  none; border-left:  none; border-bottom:  outset 0.75pt; border-right:  outset 0.75pt' vAlign='middle'&gt;&lt;p style='text-align: center'&gt;&lt;span style='font-family:Times New Roman; font-size:7pt'&gt;25-Dec-2005 &lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;span style='color:red'&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/span&gt; To make the month name in upper case, simply use the UPPER string function.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;This post is for the general look up for my personal use &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style='font-family:Times New Roman; font-size:12pt'&gt;&lt;br /&gt;    &lt;/span&gt; &lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-2819604015539510620?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/2819604015539510620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=2819604015539510620' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/2819604015539510620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/2819604015539510620'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2009/06/ms-sql-server-date-format.html' title='MS SQL SERVER DATE FORMAT'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-9063975989404838894</id><published>2009-06-19T03:29:00.001-07:00</published><updated>2009-06-19T03:32:30.869-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='asp.net AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='get_element().style&apos; is null or not an object'/><category scheme='http://www.blogger.com/atom/ns#' term='get_element().style'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET 3.5'/><title type='text'>'this.get_element().style' is null or not an object</title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 12"&gt;&lt;meta name="Originator" content="Microsoft Word 12"&gt;&lt;link style="font-family: times new roman;" rel="File-List" href="file:///C:%5CDOCUME%7E1%5Cadmin%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"&gt;&lt;link style="font-family: times new roman;" rel="themeData" href="file:///C:%5CDOCUME%7E1%5Cadmin%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"&gt;&lt;link style="font-family: times new roman;" rel="colorSchemeMapping" href="file:///C:%5CDOCUME%7E1%5Cadmin%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:trackmoves/&gt;   &lt;w:trackformatting/&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:donotpromoteqf/&gt;   &lt;w:lidthemeother&gt;EN-US&lt;/w:LidThemeOther&gt;   &lt;w:lidthemeasian&gt;X-NONE&lt;/w:LidThemeAsian&gt;   &lt;w:lidthemecomplexscript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;    &lt;w:splitpgbreakandparamark/&gt;    &lt;w:dontvertaligncellwithsp/&gt;    &lt;w:dontbreakconstrainedforcedtables/&gt;    &lt;w:dontvertalignintxbx/&gt;    &lt;w:word11kerningpairs/&gt;    &lt;w:cachedcolbalance/&gt;    &lt;w:usefelayout/&gt;   &lt;/w:Compatibility&gt;   &lt;w:donotoptimizeforbrowser/&gt;   &lt;m:mathpr&gt;    &lt;m:mathfont val="Cambria Math"&gt;    &lt;m:brkbin val="before"&gt;    &lt;m:brkbinsub val="--"&gt;    &lt;m:smallfrac val="off"&gt;    &lt;m:dispdef/&gt;    &lt;m:lmargin val="0"&gt;    &lt;m:rmargin val="0"&gt;    &lt;m:defjc val="centerGroup"&gt;    &lt;m:wrapindent val="1440"&gt;    &lt;m:intlim val="subSup"&gt;    &lt;m:narylim val="undOvr"&gt;   &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"&gt;   &lt;w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 1"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 2"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 3"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 4"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 5"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 6"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 7"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 8"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 9"&gt;   &lt;w:lsdexception locked="false" priority="35" qformat="true" name="caption"&gt;   &lt;w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"&gt;   &lt;w:lsdexception locked="false" priority="1" name="Default Paragraph Font"&gt;   &lt;w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"&gt;   &lt;w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"&gt;   &lt;w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Revision"&gt;   &lt;w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"&gt;   &lt;w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"&gt;   &lt;w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"&gt;   &lt;w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"&gt;   &lt;w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"&gt;   &lt;w:lsdexception locked="false" priority="37" name="Bibliography"&gt;   &lt;w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:0; 	mso-generic-font-family:roman; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-priority:1; 	mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:0in; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	mso-bidi-font-size:10.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} p 	{mso-style-priority:99; 	mso-style-unhide:no; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:0in; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	mso-bidi-font-size:10.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph 	{mso-style-priority:34; 	mso-style-unhide:no; 	mso-style-qformat:yes; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:.5in; 	mso-add-space:auto; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	mso-bidi-font-size:10.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst 	{mso-style-priority:34; 	mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-type:export-only; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:0in; 	margin-left:.5in; 	margin-bottom:.0001pt; 	mso-add-space:auto; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	mso-bidi-font-size:10.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle 	{mso-style-priority:34; 	mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-type:export-only; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:0in; 	margin-left:.5in; 	margin-bottom:.0001pt; 	mso-add-space:auto; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	mso-bidi-font-size:10.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast 	{mso-style-priority:34; 	mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-type:export-only; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:.5in; 	mso-add-space:auto; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	mso-bidi-font-size:10.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	mso-bidi-font-size:10.0pt; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} .MsoPapDefault 	{mso-style-type:export-only; 	margin-bottom:10.0pt;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.0in 1.0in 1.0in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;}  /* List Definitions */  @list l0 	{mso-list-id:1738354168; 	mso-list-type:hybrid; 	mso-list-template-ids:736368574 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l0:level1 	{mso-level-text:"%1\)"; 	mso-level-tab-stop:none; 	mso-level-number-position:left; 	text-indent:-.25in;} ol 	{margin-bottom:0in;} ul 	{margin-bottom:0in;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin-top:0in; 	mso-para-margin-right:0in; 	mso-para-margin-bottom:10.0pt; 	mso-para-margin-left:0in; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	mso-bidi-font-size:10.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p style="font-family: times new roman;"&gt;The error occurs in  the function "Sys$UI$_UpdateProgress$_startRequest()"&lt;br /&gt;It fails on : " this.get_element().style.display = 'block';"&lt;/p&gt;  &lt;p style="font-family: times new roman;"&gt;&lt;code&gt;&lt;br /&gt;function Sys$UI$_UpdateProgress$_startRequest() {&lt;br /&gt;       if (this._pageRequestManager.get_isInAsyncPostBack()) {&lt;br /&gt;           if (this._dynamicLayout) this.get_element().style.display = 'block';&lt;br /&gt;           else this.get_element().style.visibility = 'visible';&lt;br /&gt;       }&lt;br /&gt;       this._timerCookie = null;&lt;br /&gt;   }&lt;/code&gt;&lt;/p&gt;&lt;p style="font-family: times new roman;"&gt;&lt;br /&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;&lt;p style="font-family: times new roman;"&gt;&lt;span style="font-size:85%;"&gt;&lt;code&gt;Solution to this problems are&lt;br /&gt;&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin-bottom: 0.0001pt; text-indent: -0.25in; font-family: courier new;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=";font-size:85%;" &gt;&lt;span style=""&gt;1)&lt;span style=""&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=";font-size:85%;" &gt;had the same problem when the UpdatePanel content was updating really fast and i constantly repeated clicking the update button&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; font-family: courier new;"&gt;&lt;span style=";font-size:85%;" &gt;Changing the DisplayAfter property to 50 solved it:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; font-family: courier new;"&gt;&lt;span style=";font-size:85%;" &gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; font-family: courier new;"&gt;&lt;span style=";font-size:85%;" &gt;&lt;asp:updateprogress runat="server"&gt;DisplayAfter="50" ID="UpdatePanel1Progress" AssociatedUpdatePanelID="UpdatePanel1"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/asp:updateprogress&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; font-family: courier new;"&gt;&lt;span style=";font-size:85%;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin-bottom: 0.0001pt; text-indent: -0.25in; font-family: courier new;"&gt;&lt;!--[if !supportLists]--&gt;&lt;span style=";font-size:85%;" &gt;&lt;span style=""&gt;2)&lt;span style=""&gt;      &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style="font-size:85%;"&gt;Place the UpdateProgress outside the UpdatePanel.&lt;/span&gt;&lt;span style=";font-size:85%;" &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="font-family: courier new;" class="MsoNormal"&gt;&lt;span style=";font-size:85%;" &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-family: courier new;font-family:&amp;quot;;font-size:85%;"  &gt;Reason :&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10pt;"  &gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: courier new;"&gt; get_element() is used to get the dom element the behavior is attached to. the&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;error displayed means the dom object does not have a style property, so its&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;not a true dom object.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;this means that you UpdateProgress control is setup wrong. either you are&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;missing the template, or gave it a bad AssociatedUpdatePanelID&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-9063975989404838894?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/9063975989404838894/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=9063975989404838894' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/9063975989404838894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/9063975989404838894'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2009/06/thisgetelementstyle-is-null-or-not.html' title='&apos;this.get_element().style&apos; is null or not an object'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-6262850943419379173</id><published>2009-05-02T02:53:00.000-07:00</published><updated>2009-05-02T04:19:58.706-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript error asp.net 3.5 AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='Sys is not defined'/><category scheme='http://www.blogger.com/atom/ns#' term='Sys.InvalidOperationException'/><category scheme='http://www.blogger.com/atom/ns#' term='ScriptLoader.loadScripts cannot be called while the ScriptLoader is already loading'/><title type='text'>Sys.InvalidOperationException: ScriptLoader.loadScripts cannot be called while the ScriptLoader is already loading scripts</title><content type='html'>&lt;span style="font-family:times new roman;"&gt;whenever we do some quick ajax request in asp.net 3.5 ajax application, for sure we will one javascript error&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;Sys.InvalidOperationException: ScriptLoader.loadScripts cannot be called while the ScriptLoader is already loading scripts.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span id="ctl00_ctl00_MasterContent_Content_CommentsRepeater_ctl02_MessageLabel" class="commentText" style="display: inline-block; width: 99%;font-family:times new roman;" &gt;The following javascript code  is to prevent double postback&lt;br /&gt;on any of the buttons while an async post back is already happening&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-family:times new roman;font-size:85%;"  &gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);font-family:times new roman;font-size:85%;"  &gt;script&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt; &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-family:times new roman;font-size:85%;"  &gt;type&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-family:times new roman;font-size:85%;"  &gt;="text/javascript"&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt; &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-family:times new roman;font-size:85%;"  &gt;language&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-family:times new roman;font-size:85%;"  &gt;="javascript"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-family:times new roman;font-size:85%;"  &gt;var&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt; prm = Sys.WebForms.PageRequestManager.getInstance();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;prm.add_initializeRequest(initializeRequest);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;prm.add_endRequest(endRequest);&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-family:times new roman;font-size:85%;"  &gt;var&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt; postbackElement; &lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt; &lt;/span&gt;&lt;p  style="font-family:times new roman;"&gt;&lt;span style="color: rgb(0, 128, 0);font-size:85%;" &gt;// checks the PageRequestManager if there is already a postback being processed&lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt; &lt;/span&gt;&lt;p  style="font-family:times new roman;"&gt;&lt;span style="color: rgb(0, 128, 0);font-size:85%;" &gt;// and aborts the postback (question: which postback does it abort?)&lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt; &lt;/span&gt;&lt;p  style="font-family:times new roman;"&gt;&lt;span style="color: rgb(0, 128, 0);font-size:85%;" &gt;// See details here: http://microsoftmiles.blogspot.com/2006/11/maintaining-gridview-scroll-position-in.html&lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt; &lt;/span&gt;&lt;p  style="font-family:times new roman;"&gt;&lt;span style="color: rgb(0, 128, 0);font-size:85%;" &gt;// and http://geekswithblogs.net/rashid/archive/2007/08/08/Asp.net-Ajax-UpdatePanel-Simultaneous-Update---A-Remedy.aspx&lt;/span&gt;&lt;/p&gt;&lt;span style="color: rgb(0, 0, 255);font-family:times new roman;font-size:85%;"  &gt;function&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt; initializeRequest(sender, args)&lt;br /&gt;{&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;br /&gt;document.body.style.cursor = &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);font-family:times new roman;font-size:85%;"  &gt;"wait"&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-family:times new roman;font-size:85%;"  &gt;&lt;br /&gt;if&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt; (prm.get_isInAsyncPostBack()) &lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt; &lt;/span&gt; &lt;p  style="font-family:times new roman;"&gt;&lt;span style="font-size:85%;"&gt;{&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);font-size:85%;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p  style="font-family:times new roman;"&gt;&lt;span style="color: rgb(0, 128, 0);font-size:85%;" &gt;//debugger&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p  style="font-family:times new roman;"&gt;&lt;span style="font-size:85%;"&gt;args.set_cancel(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-size:85%;" &gt;true&lt;/span&gt;);&lt;/p&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;  &lt;p&gt;}&lt;/p&gt; &lt;p&gt;}&lt;/p&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-family:times new roman;font-size:85%;"  &gt;function&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt; endRequest(sender, args) {&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;document.body.style.cursor = &lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);font-family:times new roman;font-size:85%;"  &gt;"default"&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;;&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;  &lt;/span&gt;&lt;p  style="font-family:times new roman;"&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;span style="color: rgb(0, 0, 255);font-family:times new roman;font-size:85%;"  &gt;&lt;span style="color: rgb(0, 0, 255);font-size:85%;" &gt;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;*/&lt;br /&gt;&lt;br /&gt;&lt;span id="ctl00_ctl00_MasterContent_Content_CommentsRepeater_ctl02_MessageLabel" class="commentText" style="display: inline-block; width: 99%;"&gt;we can get detialed information about this on orignal link -&lt;br /&gt;&lt;br /&gt;http://forums.asp.net/p/1173891/1976235.aspx#1976235&lt;br /&gt;http://www.codeplex.com/AjaxControlToolkit/WorkItem/View.aspx?WorkItemId=14712&lt;/span&gt;&lt;/span&gt;&lt;div class="wp_syntax"  style="font-family:times new roman;"&gt;&lt;div class="code"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;  &lt;/span&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;  &lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-6262850943419379173?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/6262850943419379173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=6262850943419379173' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/6262850943419379173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/6262850943419379173'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2009/05/sysinvalidoperationexception.html' title='Sys.InvalidOperationException: ScriptLoader.loadScripts cannot be called while the ScriptLoader is already loading scripts'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-430859613005262775</id><published>2009-04-14T07:36:00.000-07:00</published><updated>2009-04-14T07:51:16.059-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='commanly used regular expression'/><category scheme='http://www.blogger.com/atom/ns#' term='general regular expression for asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='Regulat Expression Element'/><category scheme='http://www.blogger.com/atom/ns#' term='Regular Expression asp.net'/><title type='text'>Regular Expression for asp.net - Most Frequently used</title><content type='html'>This post consist of the frequently used regular expression with the asp.net.&lt;br /&gt;with the in short over view with of the regular expression elemnt.&lt;br /&gt;&lt;br /&gt;It is collection of the regular expression which i encounter frequently.&lt;br /&gt;&lt;span style="font-weight: bold;font-size:180%;" &gt;&lt;br /&gt;&lt;br /&gt;Regular Expression Elements&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Some of the commonly used regular expression elements are:&lt;br /&gt;&lt;br /&gt;^ Matches start of input&lt;br /&gt;&lt;br /&gt;$ Matches end of input&lt;br /&gt;&lt;br /&gt;. Matches any character except new line&lt;br /&gt;&lt;br /&gt;| OR&lt;br /&gt;&lt;br /&gt;* Match the preceding expression 0 or more number of times&lt;br /&gt;&lt;br /&gt;+ Match the preceding expression 1 or more number of times&lt;br /&gt;&lt;br /&gt;? Match the preceding expression 0 or 1 number of times&lt;br /&gt;&lt;br /&gt;() Logical group / sub-expression (capture as auto number group)&lt;br /&gt;&lt;br /&gt;(?(exp)) Named capture group&lt;br /&gt;&lt;br /&gt;(?=exp) Match any position preceding a suffix exp&lt;br /&gt;&lt;br /&gt;(?&lt;=exp) Match any position following a prefix exp  (?!exp) Match any position after which exp is not found  (?&lt;!--exp) Match any position before which exp is not found  [�] List of characters to match  [^expression] Not containing any of the specified character  {n} or {n. m} Quantifier (Match exact number or range of instances)  (?(exp (yes|no)) If expression (exp) is true match yes part else no part  \ Escape character (to match any of the special characters)  \w Match any word character  \W Match any non-word character  \s Match any white space character  \S Match any non-white space character  \d Match any numeric digit  \D Match any numeric digit  \b Match a backspace if in character matching mode ([]).  Otherwise match the position at beginning or end of a word  \t Match tab  \r Match carriage return  \n Match line feed   The following are matching substitutions:  num Substitute last substring matched by group number num  ${name} Substitute last substring matched by group name  $&amp; Substitute a copy of entire text itself  $` Substitute all the text of the input string before match  $� Substitute all the text of the input string after match  $+ Substitute last matched group  $_ Substitute input string  $$ ubstitute literal $   Regular expression examples for decimals input  Positive Integers — ^\d+$ Negative Integers — ^-\d+$ Integer — ^-{0,1}\d+$ Positive Number — ^\d*\.{0,1}\d+$ Negative Number — ^-\d*\.{0,1}\d+$ Positive Number or Negative Number - ^-{0,1}\d*\.{0,1}\d+$ Phone number — ^\+?[\d\s]{3,}$ Phone with code — ^\+?[\d\s]+\(?[\d\s]{10,}$ Year 1900-2099 — ^(19|20)[\d]{2,2}$ Date (dd mm yyyy, d/m/yyyy, etc.) — ^([1-9]|0[1-9]|[12][1-9]|3[01])\D([1-9]|0[1-9]|1[012])\D(19[0-9][0-9]|20[0-9][0-9])$ IP v4 — ^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]){3}$ Regular expression examples for Alphabetic input  Personal Name — ^[\w\.\’]{2,}([\s][\w\.\’]{2,})+$ Username — ^[\w\d\_\.]{4,}$ Password at least 6 symbols — ^.{6,}$ Password or empty input — ^.{6,}$|^$ email — ^[\_]*([a-z0-9]+(\.|\_*)?)+@([a-z][a-z0-9\-]+(\.|\-*\.))+[a-z]{2,6}$ domain — ^([a-z][a-z0-9\-]+(\.|\-*\.))+[a-z]{2,6}$  Url — http://([\w-]+\.)+[\w-]+(/[\w- ./?%&amp;=]*)?  Other regular expressions  Match no input — ^$ Match blank input — ^\s[\t]*$ Match New line — [\r\n]|$    here are some Regular expressions for html parsing . you can use it in your application while parsing html table to fetch data from it     1.        Table Expression  = “&lt;table[^--&gt;]*&gt;(.*?)”&lt;br /&gt;&lt;th[^&gt;&lt;tr[^&gt;&lt;td[^&gt;&lt;script(?:(?:.*(?&gt;&lt;src&gt;&lt;content&gt;&lt;script))*)&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Indian Mobile No&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;^((\+){0,1}91(\s){0,1}(\-){0,1}(\s){0,1}){0,1}9[0-9](\s){0,1}(\-){0,1}(\s){0,1}[1-9]{1}[0-9]{7}$&lt;br /&gt;&lt;br /&gt;Matches&lt;br /&gt;9836193498 +919836193498 9745622222&lt;br /&gt;Non-Matches&lt;br /&gt;+9197456222222 8745622222 9836193481&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;IsAlphaNumeric&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;^a-zA-Z0-9&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Start With Character and contian alphanumeric&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;^[a-zA-Z][a-zA-Z0-9]*$&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Contianing format like this 12345-67890&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;^[0-9]{5}[-][0-9]{5}$&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Mobile numbar validation start with 9 and 9 digit long&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;^[9][0-9]{9}$&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;trailing and leading spaces&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;^[ \t]+|[ \t]+$&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;NameValidationRegularExpression&lt;/span&gt; = "^[a-zA-Z]+(([\'\\,\\.\\-][a-zA-Z])?[a-zA-Z]*)*$"; ^[a-zA-Z0-9]+(([\'\\,\\.\\-][a-zA-Z0-9])?[a-zA-Z0-9]*)*$ ;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;NumberValidationRegularExpression&lt;/span&gt; = "^([1-9]([0-9])+)$";&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;AlphaNumericValidationRegularExpression&lt;/span&gt; = "^([a-zA-Z0-9]+)$"; , ^[a-zA-Z0-9]+(\s*)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;DateValidationRegularExpression&lt;/span&gt; = "^(01|1|02|2|3|03|5|05|4|04|06|6|7|07|8|08|10|9|09|11|12)[/-]((31(?! (02|04|06|09|11|2|4|6|9)))|((30|29)(?! 02))|(29(?= 02 (((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))|(0?[1-9])|1\\d|2[0-8])[/-]((1[6-9]|[2-9]\\d)\\d{2})$";&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;EmailIdValidationRegularExpression&lt;/span&gt; = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;ZipCodeValidationRegularExpression&lt;/span&gt; = "^\\d{5}((-|\\s)?\\d{4})?$";&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;PhoneValidationRegularExpression&lt;/span&gt; = "((\\(\\d{3}\\) ?)|(\\d{3}-))?\\d{3}-\\d{4}";&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;CurrencyValidationRegularExpression&lt;/span&gt; = "^\\$?\\-?([1-9]{1}[0-9]{0,2}(\\,\\d{3})*(\\.\\d{0,2})?|[1-9]{1}\\d{0,}(\\.\\d{0,2})?|0(\\.\\d{0,2})?|(\\.\\d{1,2}))$|^\\-?\\$?([1-9]{1}\\d{0,2}(\\,\\d{3})*(\\.\\d{0,2})?|[1-9]{1}\\d{0,}(\\.\\d{0,2})?|0(\\.\\d{0,2})?|(\\.\\d{1,2}))$|^\\(\\$?([1-9]{1}\\d{0,2}(\\,\\d{3})*(\\.\\d{0,2})?|[1-9]{1}\\d{0,}(\\.\\d{0,2})?|0(\\.\\d{0,2})?|(\\.\\d{1,2}))\\)$";&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;NameValidationRegularExpression&lt;/span&gt; = "^([a-zA-Z0-9-]{1,25})$";&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;GuidValidationRegularExpression&lt;/span&gt; ="^\\{?[a-zA-Z\\d]{8}-([a-zA-Z\\d]{4}-){3}[a-zA-Z\\d]{12}\\}?$";&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;URLValidationExpression &lt;/span&gt;= "^(http|https|ftp)\\://((([a-z_0-9\\-]+)+(([\\:]?)+([a-z_0-9\\-]+))?)(\\@+)?)?(((((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5]))))|((([a-z0-9\\-])+\\.)+([a-z]{2}\\.[a-z]{2}|[a-z]{2,4})))(([\\:])(([1-9]{1}[0-9]{1,3})|([1-5]{1}[0-9]{2,4})|(6[0-5]{2}[0-3][0-6])))?$";&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;FederalIDValidationExpression&lt;/span&gt; = "^([a-zA-Z 0-9\\-]+)$";&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Name&lt;/span&gt; = ^[a-zA-Z0-9'@#_\-\*\./\\:`~\s\^]+(\s*)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Decimal(11,3)&lt;/span&gt;--- ^[1-9]\d{0,10}(\.\d{0,3})?$&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Only Small case alphabates &lt;/span&gt;- ^[a-z]*$&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;credit card (card number which has totally 16 digit&lt;br /&gt;&lt;br /&gt;after every 4 digit it has "-" or not contain.) &lt;/span&gt;- ^(\d{4}-){3}\d{4}$|^(\d{4} ){3}\d{4}$|^\d{16}$&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;URL&lt;/span&gt; - ?(http:[/][/]|www.)([a-z]|[A-Z]|[0-9]|[/.]|[~])*&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;IPAddress&lt;/span&gt; - ?:(?:25[0-5]|2[0-4]\d|[01]\d\d|\d?\d)(?(?=\.?\d)\.)){4}$&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;email address&lt;/span&gt; - ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Time&lt;/span&gt; - ?^(?:0?[1-9]:[0-5]|1(?=[012])\d:[0-5])\d(?:[ap]m)?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;ShortDate &lt;/span&gt;- ?\d{1,2})/(?\d{1,2})/(?(?:\d{4}|\d{2}&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;Long Date&lt;/span&gt; - 31(?!\ (Feb(ruary)?|Apr(il)?|June?|(Sept|Nov)(ember)?)))|((30|29)(?!\ Feb(ruary)?))|(29(?=\ Feb(ruary)?\ (((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))|(0?[1-9])|1\d|2[0-8])\ (Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sept|Nov|Dec)(ember)?)\ ((1[6-9]|[2-9]\d)\d{2})$&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Not Natural &lt;/span&gt;- [^0-9]&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;Natural &lt;/span&gt;- 0*[1-9][0-9]*&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Whole No&lt;/span&gt; - [^0-9]&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;IsAlpha&lt;/span&gt; - [^a-zA-Z]&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;Is AlphaNumeric&lt;/span&gt; - [^a-zA-Z0-9]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;date Format (for MM/DD/YYYY format) &lt;/span&gt;-  ([1-9]|1[012])[- /.]([1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;date Format (for DD/MM/YYYY format)&lt;/span&gt; -  (0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;for Day&lt;/span&gt; - ^((([1-9]?)|([1-2][0-9])?)|([3][0-1]?))$&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;for Month&lt;/span&gt; - ^((([1-9]?)|([0][1-9])?)|([1][0-2]?))$&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;for year &lt;/span&gt;- [0-9]{4}&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Strip html tags from string&lt;/span&gt; - &lt;(.|\n)+?&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Us Telephone pattern&lt;/span&gt; - ^(\(\d{3}\)[- ]?|\d{3}[- ])?\d{3}[- ]\d{4}$&lt;br /&gt;&lt;br /&gt;Matches&lt;br /&gt;(555)555-5555 | (555) 555-5555 | 555-5555&lt;br /&gt;Non-Matches&lt;br /&gt;5555555555 | 555.555.5555 | (555 555-5555&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;here are some&lt;span style="font-size:130%;"&gt; Regular expressions for html parsing&lt;/span&gt; . you can use it in your application while parsing html table to fetch data from it&lt;br /&gt;&lt;br /&gt; 1.&lt;br /&gt;     Table Expression  = “&lt;table[^&gt;]*&gt;(.*?)”&lt;br /&gt; 2.&lt;br /&gt;      Header Expression  = “&lt;th[^&gt;]*&gt;(.*?)”&lt;br /&gt; 3.   Row Expression  = “&lt;tr[^&gt;]*&gt;(.*?)”&lt;br /&gt; 4.   Column Expression  = “&lt;td[^&gt;]*&gt;(.*?)”&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Script Block Parser&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;script(?:(?:.*(?&gt;&lt;src&gt;(?&lt;=src=")[^"]*(?="))[^&gt;]*)|[^&gt;]*)&gt;(?&lt;content&gt;(?:(?:\n|.)(?!(?:\n|.)&lt;script))*)&gt;&lt;br /&gt;&lt;br /&gt;&lt;/script))*)&gt;&lt;/content&gt;&lt;/src&gt;&lt;/script(?:(?:.*(?&gt;&lt;/td[^&gt;&lt;/tr[^&gt;&lt;/th[^&gt;&lt;/table[^&gt;&lt;/script))*)&gt;&lt;/content&gt;&lt;/src&gt;&lt;/script(?:(?:.*(?&gt;&lt;/td[^&gt;&lt;/tr[^&gt;&lt;/th[^&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-430859613005262775?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/430859613005262775/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=430859613005262775' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/430859613005262775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/430859613005262775'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2009/04/regular-expression-for-aspnet-most.html' title='Regular Expression for asp.net - Most Frequently used'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-3967712719540762778</id><published>2009-04-08T03:42:00.001-07:00</published><updated>2009-04-08T03:52:08.864-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='Programmatically adding JavaScript File'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript file from code behind'/><category scheme='http://www.blogger.com/atom/ns#' term='HtmlGenericControl  for adding script reference'/><title type='text'>Programmatically adding JavaScript File to Asp.Net page ( Using code behind)</title><content type='html'>we can programmaticaly add javascript file to the aspx page if we dont want to add our JavaScript file declaratively via HTML to our ASP.Net page.&lt;br /&gt;&lt;br /&gt;We can add this just like this...&lt;br /&gt;its very simple --- only once we use it or know about it :) &lt;br /&gt;&lt;br /&gt;we just have to add following code like this&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    protected void Page_Init(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        HtmlGenericControl js = new HtmlGenericControl("script");&lt;br /&gt;        js.Attributes["type"] = "text/javascript";&lt;br /&gt;        js.Attributes["src"] = "js/myfunctions.js";&lt;br /&gt;        Page.Header.Controls.Add(js);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;we can use this approach in adding the conditional javascrip file to our page for the SEO purpose...or it depends upon the context how to use it...but we can&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-3967712719540762778?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/3967712719540762778/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=3967712719540762778' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/3967712719540762778'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/3967712719540762778'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2009/04/programmatically-adding-javascript-file.html' title='Programmatically adding JavaScript File to Asp.Net page ( Using code behind)'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-3883190832682770258</id><published>2009-03-14T01:46:00.000-07:00</published><updated>2009-03-14T01:55:07.837-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET Event Order UserControls'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET Event Order MasterPages'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET Event Order Pages'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET Event Order HttpModules'/><category scheme='http://www.blogger.com/atom/ns#' term='Event Order Sequence'/><title type='text'>ASP.NET Event Order Pages, UserControls, MasterPages and HttpModules</title><content type='html'>I found article that shows the order of events for Pages, UserControls, Master Pages and HttpModules  I am going to use it as easy to find collection.&lt;br /&gt;&lt;br /&gt;You can find the entire orignal post here &lt;a href="http://forums.asp.net/t/1191194.aspx"&gt;http://forums.asp.net/t/1191194.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Special thanks to Mike Banavige.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Understanding the Page Life Cycle can be very important as you begin to build Pages with MasterPages and UserControls.&lt;br /&gt;&lt;br /&gt;Does the Init event fire first for the Page, the MasterPage or the UserControl? &lt;br /&gt;What about the Load event?&lt;br /&gt;&lt;br /&gt;If you make an incorrect assumption about the sequence that these events fire, then you may end up with a page that simply doesn't behave the way you had anticipated.&lt;br /&gt;&lt;br /&gt;By running a simple test, we can see exactly when each event fires.  Our test setup is composed of a Page, MasterPage, UserControl, Nested UserControl and Button control as follows:&lt;br /&gt;&lt;br /&gt;    *&lt;br /&gt;      The Page is tied to the MasterPage&lt;br /&gt;    *&lt;br /&gt;      The UserControl is on the Page&lt;br /&gt;    *&lt;br /&gt;      The Nested UserControl is on the UserControl&lt;br /&gt;    *&lt;br /&gt;      The Button is on the Nested UserControl.&lt;br /&gt;    *&lt;br /&gt;      Clicking the Button calls the Page.DataBind method&lt;br /&gt;&lt;br /&gt;Each event on these controls has been set to call Debug.WriteLine as each event is raised.  In addition to the events that get raised for regular pages, I've also set up an HttpModule and wired up all of those events as well. The results in the Debug output window of running this page and Clicking the Button are as follows:&lt;br /&gt;&lt;br /&gt;BeginRequest - HttpModule&lt;br /&gt;AuthenticateRequest - HttpModule&lt;br /&gt;PostAuthenticateRequest - HttpModule&lt;br /&gt;PostAuthorizeRequest - HttpModule&lt;br /&gt;ResolveRequestCache - HttpModule&lt;br /&gt;PostResolveRequestCache - HttpModule&lt;br /&gt;PostMapRequestHandler - HttpModule&lt;br /&gt;AcquireRequestState - HttpModule&lt;br /&gt;PostAcquireRequestState - HttpModule&lt;br /&gt;PreRequestHandlerExecute - HttpModule&lt;br /&gt;&lt;br /&gt;PreInit - Page&lt;br /&gt;&lt;br /&gt;Init - ChildUserControl&lt;br /&gt;Init - UserControl&lt;br /&gt;Init - MasterPage&lt;br /&gt;Init - Page&lt;br /&gt;&lt;br /&gt;InitComplete - Page&lt;br /&gt;&lt;br /&gt;LoadPageStateFromPersistenceMedium - Page &lt;br /&gt;&lt;br /&gt;ProcessPostData (first try) - Page&lt;br /&gt;&lt;br /&gt;PreLoad - Page&lt;br /&gt;&lt;br /&gt;Load - Page&lt;br /&gt;Load - MasterPage&lt;br /&gt;Load - UserControl&lt;br /&gt;Load - ChildUserControl&lt;br /&gt;&lt;br /&gt;ProcessPostData (second try) - Page&lt;br /&gt;&lt;br /&gt;RaiseChangedEvents - Page&lt;br /&gt;RaisePostBackEvent - Page&lt;br /&gt;&lt;br /&gt;Click - Button - ChildUserControl&lt;br /&gt;&lt;br /&gt;    DataBinding - Page&lt;br /&gt;    DataBinding - MasterPage&lt;br /&gt;    DataBinding - UserControl&lt;br /&gt;    DataBinding - ChildUserControl&lt;br /&gt;&lt;br /&gt;LoadComplete - Page&lt;br /&gt;&lt;br /&gt;PreRender - Page&lt;br /&gt;PreRender - MasterPage&lt;br /&gt;PreRender - UserControl&lt;br /&gt;PreRender - ChildUserControl&lt;br /&gt;&lt;br /&gt;PreRenderComplete - Page&lt;br /&gt;&lt;br /&gt;SaveViewState - Page&lt;br /&gt;SavePageStateToPersistenceMedium - Page&lt;br /&gt;SaveStateComplete - Page&lt;br /&gt;&lt;br /&gt;Unload - ChildUserControl&lt;br /&gt;Unload - UserControl&lt;br /&gt;Unload - MasterPage&lt;br /&gt;Unload - Page&lt;br /&gt;&lt;br /&gt;PostRequestHandlerExecute - HttpModule&lt;br /&gt;ReleaseRequestState - HttpModule&lt;br /&gt;PostReleaseRequestState - HttpModule&lt;br /&gt;UpdateRequestCache - HttpModule&lt;br /&gt;PostUpdateRequestCache - HttpModule&lt;br /&gt;EndRequest - HttpModule&lt;br /&gt;PreSendRequestHeaders - HttpModule&lt;br /&gt;PreSendRequestContent - HttpModule &lt;br /&gt;&lt;br /&gt;Mike Banavige&lt;br /&gt;~~~~~~~~~~~~&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-3883190832682770258?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/3883190832682770258/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=3883190832682770258' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/3883190832682770258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/3883190832682770258'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2009/03/aspnet-event-order-pages-usercontrols.html' title='ASP.NET Event Order Pages, UserControls, MasterPages and HttpModules'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-4186082969388842417</id><published>2009-03-03T22:59:00.000-08:00</published><updated>2009-03-14T01:53:23.582-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Pivot Query'/><category scheme='http://www.blogger.com/atom/ns#' term='MS SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='MS SQL Query'/><category scheme='http://www.blogger.com/atom/ns#' term='Pivot Query Example'/><category scheme='http://www.blogger.com/atom/ns#' term='How to PIVOT Query'/><category scheme='http://www.blogger.com/atom/ns#' term='rotating rows to columns using pivot'/><category scheme='http://www.blogger.com/atom/ns#' term='Using PIVOT Query'/><title type='text'>Pivot Query With SQL Server 2005</title><content type='html'>In SQL Server 2005 we have operator called PIVOT with this operater CASE statement and GROUP BY statements are no longer necessary.&lt;br /&gt;&lt;br /&gt;Every PIVOT Query involves the aggregation of some type so we can omit the GROUP BY Statement.PIVOT Operator provides the same functionality that we can achieve with the CASE Statement.&lt;br /&gt;&lt;br /&gt;PIVOT Operator allows us to rotate row level data into the tabular level data without use of the case statement.&lt;br /&gt;&lt;br /&gt;we will see the one simple example which i did as a RnD for the same...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for example purpose we will create one simple table as like this&lt;br /&gt;&lt;br /&gt;create table pwPIVOTrnd&lt;br /&gt;(&lt;br /&gt;pwCol1 int,&lt;br /&gt;pwCol2 int&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;after this we will insert some dummy data to the table&lt;br /&gt;&lt;br /&gt;insert into pwPIVOTrnd values (1, 2)&lt;br /&gt;insert into pwPIVOTrnd values (2, 22)&lt;br /&gt;insert into pwPIVOTrnd values (3, 370)&lt;br /&gt;&lt;br /&gt;after this we sil see the output of the&lt;br /&gt;&lt;br /&gt;select * from pwPIVOTrnd&lt;br /&gt;&lt;br /&gt;output will look like this&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;pwCol1 pwCol2&lt;br /&gt;1      2&lt;br /&gt;2      22&lt;br /&gt;3      370&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now we want to rotate all rows of pwCol2 into the single row :)&lt;br /&gt;&lt;br /&gt;means 2, 22 , 370 will come in the one single row&lt;br /&gt;&lt;br /&gt;we will see the query and its result so that it will be crystal clear&lt;br /&gt;&lt;br /&gt;select distinct [1]as IstRowAsIstCol, [2] as SecondRowAsSecondCol, [3] as ThirdRowAsThirdCol&lt;br /&gt;from&lt;br /&gt;(&lt;br /&gt;select pwCol1, pwCol2 from pwPIVOTrnd tp&lt;br /&gt;) as H&lt;br /&gt;pivot&lt;br /&gt;(&lt;br /&gt;avg(pwCol2)&lt;br /&gt;For pwCol1 in ([1], [2], [3])&lt;br /&gt;) as pvt&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;IstRowAsIstCol SecondRowAsSecondCol ThirdRowAsThirdCol&lt;br /&gt;2              22                   370&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;so we got the out like above...same result can be achived with using the CASE but it will take more coding and time.&lt;br /&gt;&lt;br /&gt;for column in([1],[2],[3]) we have to mention therow data which we want to select as column, so [1],[2],[3] are the row data of column1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Limitation of PIVOT Operator&lt;br /&gt;&lt;br /&gt;Much of the functionality provided by the PIVOT Operator requires to "HARDCORE" the fields that we are pivoting into columnar data.&lt;br /&gt;&lt;br /&gt;other one thing is that with PIVOT we can aggregate only one field in resultset where as with the case we can aggregate with more than one field.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-4186082969388842417?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/4186082969388842417/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=4186082969388842417' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/4186082969388842417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/4186082969388842417'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2009/03/pivot-query-sql-server-2005.html' title='Pivot Query With SQL Server 2005'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-4588712123473063932</id><published>2009-02-28T03:07:00.000-08:00</published><updated>2009-03-02T06:45:59.565-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MyRepeater with emptydatatemplate'/><category scheme='http://www.blogger.com/atom/ns#' term='Empty Data Template'/><category scheme='http://www.blogger.com/atom/ns#' term='Custom Repeater Control'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='Extending Repeater'/><category scheme='http://www.blogger.com/atom/ns#' term='Repeater With Empty Data Template'/><title type='text'>Empty data template for repeater control</title><content type='html'>In one of my project i need to use the repeater control plenty of times and considering the problem of the empty template i though to Google it out&lt;br /&gt;&lt;br /&gt;mean while i got plenty of reference on the net...few are really good which will check the item count in the repeater and based on it it repeater's visible property is changed.&lt;br /&gt;&lt;br /&gt;means if count is 0 den make the repeater as visible="false" this is ok for the condition where we need it on 2-3 pages...&lt;br /&gt;&lt;br /&gt;i was looking around for an article on how to extend the repeater control to add an empty data template similar to the Grid View control.&lt;br /&gt;&lt;br /&gt;here is the code...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Linq;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.Security;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;using System.Web.UI.WebControls.WebParts;&lt;br /&gt;using System.Xml.Linq;&lt;br /&gt;using System.Collections;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;&lt;br /&gt;/// &lt;summary&gt;&lt;br /&gt;/// Summary description for MyRepeater&lt;br /&gt;/// &lt;/summary&gt;&lt;br /&gt;&lt;br /&gt;namespace prawinway.test&lt;br /&gt;{&lt;br /&gt;public class MyRepeater : Repeater&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;    public ITemplate EmptyDataTemplate{get;set;}&lt;br /&gt;&lt;br /&gt;    protected override void CreateControlHierarchy( bool useDataSource )&lt;br /&gt;    {&lt;br /&gt;        IEnumerable data = GetData();&lt;br /&gt;        if (EmptyDataTemplate != null &amp;amp;&amp;amp; data != null &amp;amp;&amp;amp; !data.GetEnumerator().MoveNext())&lt;br /&gt;        {&lt;br /&gt;            WebControl control = new WebControl( HtmlTextWriterTag.Div );&lt;br /&gt;            EmptyDataTemplate.InstantiateIn(control);&lt;br /&gt;            Controls.Add( control );&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;            base.CreateControlHierarchy( useDataSource );&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;herw we are extending MyRepeater class from the Repeater and added one propert for EmptyDataTemplate.&lt;br /&gt;&lt;br /&gt;we can register this within our aspx page as :&lt;br /&gt;&lt;br /&gt;&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="myrepeatertest.aspx.cs" Inherits="myrepeatertest" %&gt;&lt;br /&gt;&lt;%@ Register TagPrefix="prawinway" Namespace="prawinway.test" Assembly="MyRepeater" %&gt;&lt;br /&gt;&lt;br /&gt;Total HTML for this will look like this&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_iw1sg5UH9L8/Sakmfn-KtAI/AAAAAAAAALI/-utk9sIB-Wk/s1600-h/prawinway_myrepeatertest.bmp"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 135px;" src="http://4.bp.blogspot.com/_iw1sg5UH9L8/Sakmfn-KtAI/AAAAAAAAALI/-utk9sIB-Wk/s320/prawinway_myrepeatertest.bmp" alt="" id="BLOGGER_PHOTO_ID_5307815960580371458" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;It will run like a charm...even we can ad the additional functionality like custom paging and sorting with some modification with extending repeater control.&lt;br /&gt;&lt;br /&gt;Happy Programming&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-4588712123473063932?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/4588712123473063932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=4588712123473063932' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/4588712123473063932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/4588712123473063932'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2009/02/empty-data-template-for-repeater.html' title='Empty data template for repeater control'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_iw1sg5UH9L8/Sakmfn-KtAI/AAAAAAAAALI/-utk9sIB-Wk/s72-c/prawinway_myrepeatertest.bmp' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-3771125477149121653</id><published>2009-02-26T00:00:00.000-08:00</published><updated>2009-02-26T00:39:09.810-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='asp.net custom paging'/><category scheme='http://www.blogger.com/atom/ns#' term='Stored Procedure Within Stored Procedure'/><category scheme='http://www.blogger.com/atom/ns#' term='Stored Procedure Paging'/><category scheme='http://www.blogger.com/atom/ns#' term='Custom Stored Procedure Paging'/><category scheme='http://www.blogger.com/atom/ns#' term='Paging and Dynamic query With Stored Procedure'/><title type='text'>SQL Stored Procedure Paging With the Dynamic Query</title><content type='html'>&lt;span style=";font-family:times new roman;font-size:180%;"  &gt;SQL Procedure Paging With Dynamic query :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; In the previous post i have written the Dynamic Query generation with the stored procedure. It runs like a charm.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; But my requirement changed a often...as i have to display search data in the repeater with paging.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; In the database i have huge data and doing traditional paging is not the advisable way to do it.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; So i thought to write the some logic which will fetch only records which we have to display on the page.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; means if i have to display page number 1 with 10 records on each page i will fetech only 10 records from the database.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; The procedure which i have written for Generating dynamic Query with the Stored procedure Based on the optional input parameter.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;set ANSI_NULLS ON&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;set QUOTED_IDENTIFIER ON&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;go&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;/* This is sample stored procedure that builds dynamic SQL for product search */&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;ALTER Procedure [dbo].[Usprpm_SearchProduct]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    /* Input Parameters it will take all parametet on which the user can search the product(all parameters are optional) */&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @dresstype                                VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @worktype                                VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @material                                VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @category                                VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @keyword                                VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @catalog                                VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @weight                                    FLOAT = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @pricelow                                DECIMAL(18,0) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @pricehigh                                DECIMAL(18,0) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @color                                    VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @code                                    VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @sizetype                                VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @newarrival                                BIT = NULL&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;AS&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    Set NoCount ON&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    /* Variable Declaration */&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    Declare @SQLstrquesry AS NVarchar(4000)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    Declare @ParameterDefinition AS NVarchar(2000) &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    /* Build the Transact-SQL String with the input parameters */ &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    Set @SQLstrquesry = 'Select * from rpm_product where (1=1) ' &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    /* check for the condition and build the WHERE clause accordingly */&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    If @dresstype Is Not Null &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;         Set @SQLstrquesry = @SQLstrquesry + ' And (dresstype = @dresstype)'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    If @worktype Is Not Null&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;         Set @SQLstrquesry = @SQLstrquesry + ' And (worktype = @worktype)' &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    If @material Is Not Null&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;         Set @SQLstrquesry = @SQLstrquesry + ' And (material = @material)'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    If @category Is Not Null &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;         Set @SQLstrquesry = @SQLstrquesry + ' And (category = @category)'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    If @keyword Is Not Null&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;         Set @SQLstrquesry = @SQLstrquesry + ' And (keyword = @keyword)' &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    If @material Is Not Null&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;         Set @SQLstrquesry = @SQLstrquesry + ' And (material = @material)'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    If @weight Is Not Null&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;         Set @SQLstrquesry = @SQLstrquesry + ' And (weight &lt;= @weight)'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    If @color Is Not Null&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;         Set @SQLstrquesry = @SQLstrquesry + ' And (color LIKE % @color %)'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    If @code Is Not Null&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;         Set @SQLstrquesry = @SQLstrquesry + ' And (code = @code)' &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    If @sizetype Is Not Null&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;         Set @SQLstrquesry = @SQLstrquesry + ' And (sizetype = @sizetype)' &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    -- this section is used to check for the lower and upper limit of the price...user can select none, lowest price, highest price or the none&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    if ((@pricelow Is Not Null) and (@pricehigh Is Not Null)) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        Set @SQLstrquesry = @SQLstrquesry + ' And (price BETWEEN @pricelow AND @pricehigh)'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    else if(@pricelow Is Not Null) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        Set @SQLstrquesry = @SQLstrquesry + ' And (price &gt;= @pricelow)'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    else if (@pricehigh Is Not Null) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        Set @SQLstrquesry = @SQLstrquesry + ' And (price &lt;= @pricehigh)'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    -- checking if the user wants to check with the newarrival if yes then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    if ((@newarrival Is Not Null) and (@newarrival=1)) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        Set @SQLstrquesry = @SQLstrquesry + ' And (newarrival = 1 )'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    /* Specify Parameter Format for all input parameters included &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;     in the stmt */&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    Set @ParameterDefinition =      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                '@dresstype    VARCHAR(50),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @worktype    VARCHAR(50),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @material    VARCHAR(50),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @category    VARCHAR(50),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @keyword    VARCHAR(50),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @catalog    VARCHAR(50),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @weight        FLOAT,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @pricelow    DECIMAL(18,0),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @pricehigh    DECIMAL(18,0),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @color        VARCHAR(50),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @code        VARCHAR(50),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @sizetype    VARCHAR(50),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @newarrival BIT'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    /* Execute the Transact-SQL String with all parameter value's &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;       Using sp_executesql Command */&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    Execute sp_Executesql     @SQLstrquesry, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @ParameterDefinition, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @dresstype,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @worktype,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @material,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @category,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @keyword,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @catalog,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @weight,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @pricelow,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @pricehigh,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @color,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @code,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @sizetype,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                @newarrival&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    If @@ERROR &lt;&gt; 0 GoTo ErrorHandler&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    Set NoCount OFF&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    Return(0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;ErrorHandler:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        Return(@@ERROR)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; We can check it like this.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;EXEC Usprpm_SearchProduct 'dress type', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ,NULL, NULL&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; after thinking i have written one stroed produre( actually i taken help of google/live - &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; and there are lot of sample to do it...i have taken the basic idea from there)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; and for test the procedure which will fetech the records based on the pageno and number of records is like this -&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;CREATE PROCEDURE uspPagingTest&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @Int_PageNo            int,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @Int_RecordPerPage    int&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;AS&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    Declare @Int_From_Page int,@int_To_Page int,@Int_Total_Records int&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    set @Int_From_Page = ((@Int_PageNo-1)*@Int_RecordPerPage)+1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    set @int_To_Page = @Int_PageNo*@Int_RecordPerPage&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    print @Int_From_Page&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    print @int_To_Page&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    SET NOCOUNT ON;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    Select @Int_Total_Records=Count(*) From rpm_product;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    DECLARE @tblTemprpm_product TABLE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    (&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        nID            INT IDENTITY,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        productid    INT,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        dresstype    VARCHAR(50),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        color        VARCHAR(50),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        code        VARCHAR(50),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        imgsmall1    VARCHAR(80)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    )&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    INSERT INTO @tblTemprpm_product&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    (&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        productid,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        dresstype,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        color,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        code,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        imgsmall1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    )SELECT&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        productid,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        dresstype,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        color,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        code,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        imgsmall1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    FROM rpm_product&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    ORDER BY&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    productid&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    SELECT    productid,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            dresstype,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            color,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            code,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            imgsmall1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    FROM @tblTemprpm_product&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    WHERE nID BETWEEN @Int_From_Page and @int_To_Page&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    ORDER BY&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    nID ASC&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; We can check it&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;exec uspPagingTest 1, 9&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;exec uspPagingTest 2, 9&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; now main thing is that i have to integrating  these two stored procedure to create one robust stroed procedure &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; which will generate the dynamic query based on the optional search parameter and the paging with &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; the required record fetching instead of unnecessarily fetching all records for every request.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; Now one things come under the scanner for each request &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; we have to pass the all parameter (first sp and second sp parameter in a single sp) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; or call one sp in the other.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; even though we can archive it in both way.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; I have decided to call one procedure through the other.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; I have decided to call Usprpm_SearchProduct from uspPagingTest:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; instead of inserting records from rpm_product table i have decided to insert records &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; to our temptable from the search query which we will get from the Usprpm_SearchProduct stored procedure.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; Means we have to pass all parameter to our uspPagingTest stored procedure &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; which will internally call our dynamic query generation stored procedure to insert&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;  the records in our temp table and we will get each the required records from that temp table to display.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; final stored procedure will look like this.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;CREATE PROCEDURE Usprpm_PagingResult&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @Int_PageNo            int,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @Int_RecordPerPage    int,&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    --these input parameter are added&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @dresstype                                VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @worktype                                VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @material                                VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @category                                VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @keyword                                VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @catalog                                VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @weight                                    FLOAT = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @pricelow                                DECIMAL(18,0) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @pricehigh                                DECIMAL(18,0) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @color                                    VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @code                                    VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @sizetype                                VARCHAR(50) = NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    @newarrival                                BIT = NULL&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;AS&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    Declare @Int_From_Page int,@int_To_Page int,@Int_Total_Records int&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    set @Int_From_Page = ((@Int_PageNo-1)*@Int_RecordPerPage)+1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    set @int_To_Page = @Int_PageNo*@Int_RecordPerPage&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    print @Int_From_Page&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    print @int_To_Page&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    SET NOCOUNT ON;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;   &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    DECLARE @tblTemprpm_product TABLE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    (&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        nID            INT IDENTITY,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        productid   INT, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        dresstype    VARCHAR(50), &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        worktype    VARCHAR(50), &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        material    VARCHAR(50), &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        category    VARCHAR(50), &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        keyword        VARCHAR(50), &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        catalog        VARCHAR(50), &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        weight        FLOAT, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        price        Decimal, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        color        VARCHAR(50), &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        sizetype    VARCHAR(50), &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        code        VARCHAR(50), &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        imgsmall1    VARCHAR(80), &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        imgmedium1    VARCHAR(80), &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        imgbig1        VARCHAR(80),&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        imgsmall2    VARCHAR(80), &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        imgmedium2    VARCHAR(80), &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        imgbig2        VARCHAR(80), &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        issingleimage BIT, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        isleftorrightimage BIT, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        adjoiningproductid VARCHAR(50), &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        instock        BIT, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        isdisplay    BIT, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        newarrival    BIT &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    )&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    INSERT INTO @tblTemprpm_product&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    (&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        productid, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        dresstype, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        worktype, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        material, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        category, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        keyword, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        catalog, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        weight, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        price, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        color, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        sizetype, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        code, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        imgsmall1, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        imgmedium1, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        imgbig1,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        imgsmall2, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        imgmedium2, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        imgbig2, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        issingleimage, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        isleftorrightimage, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        adjoiningproductid, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        instock, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        isdisplay, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;        newarrival &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    )&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; EXEC Usprpm_SearchProduct  @dresstype, @worktype, @material, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                                        @category, @keyword, @catalog, @weight, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                                        @pricelow, @pricehigh, @color, @code, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;                                        @sizetype, @newarrival&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    --here I have applied the logiv of fetehcing the records based on the search parameter&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    -- I am calling the search dymanmic query genration stored procedure.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    Select @Int_Total_Records=Count(*) From @tblTemprpm_product;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    SELECT    productid, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            dresstype, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            worktype, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            material, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            category, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            keyword, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            catalog, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            weight, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            price, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            color, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            sizetype, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            code, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            imgsmall1, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            imgmedium1, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            imgbig1,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            imgsmall2, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            imgmedium2, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            imgbig2, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            issingleimage, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            isleftorrightimage, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            adjoiningproductid, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            instock, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            isdisplay, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;            newarrival &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    FROM @tblTemprpm_product&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    WHERE nID BETWEEN @Int_From_Page and @int_To_Page&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    ORDER BY&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;    nID ASC&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; and the stored procedure which we have used earlier called Usprpm_SearchProduct will be same.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; Even we can use out parameter for the Total number of records for the search result.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;  Off course there are many other way to archive this..but at the moment &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; i felt this is easy and efficient solution for my problem.Even we can customize it and write it more efficiently for achieving even more efficient results.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt; Happy programming and cheers !!!!&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-3771125477149121653?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/3771125477149121653/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=3771125477149121653' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/3771125477149121653'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/3771125477149121653'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2009/02/sql-stored-procedure-paging-with.html' title='SQL Stored Procedure Paging With the Dynamic Query'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-921770971798835871</id><published>2009-02-23T01:25:00.000-08:00</published><updated>2009-02-28T04:03:51.682-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Dynamic SQL Query with Stored Procedure'/><category scheme='http://www.blogger.com/atom/ns#' term='Dynamic Query'/><category scheme='http://www.blogger.com/atom/ns#' term='Condition Based Query'/><category scheme='http://www.blogger.com/atom/ns#' term='Building Dynamic Search Query'/><category scheme='http://www.blogger.com/atom/ns#' term='Search Based Query'/><category scheme='http://www.blogger.com/atom/ns#' term='Search Query Stored Procedure'/><category scheme='http://www.blogger.com/atom/ns#' term='Dynamic Query Stored Procedure'/><title type='text'>Dynamic SQL Query with Stored Procedure</title><content type='html'>&lt;span style="font-size:180%;"&gt;&lt;span style="font-family:times new roman;"&gt;Dynamic SQL Query with Stored Procedure &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;Generally we need the Dynamic SQL Queries when we want to fetch the records based on the  criteria for the given context from the database.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;Given the context  I wanted to write the search for the product where user can search the product based on the various parameter with all parameter having the optional base.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;after looking the requirement i though to write the query based on the given condtion directly in to the coding but taking security and the performance thread into the account i decided to write the Dynamic SQL Query in the Stored Procedure itself.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;Even you can find the other article on the net which does the same work and may be they are more efficient than this.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;This just for the my own future reference...so that whenever need arise in future i can just look into it....and after doing few modification...i can use it again.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;This is what the sole purpose of this post.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;/* This is sample stored procedure that builds dynamic SQL for product search */&lt;br /&gt;&lt;br /&gt;ALTER Procedure Usprpm_SearchProduct&lt;br /&gt;&lt;br /&gt; /* Input Parameters it will take all parametet on which the user can search the product(all parameters are optional) */&lt;br /&gt;&lt;br /&gt; @dresstype                                VARCHAR(50) = NULL,&lt;br /&gt; @worktype                                VARCHAR(50) = NULL,&lt;br /&gt; @material                                VARCHAR(50) = NULL,&lt;br /&gt; @category                                VARCHAR(50) = NULL,&lt;br /&gt; @keyword                                VARCHAR(50) = NULL,&lt;br /&gt; @catalog                                VARCHAR(50) = NULL,&lt;br /&gt; @weight                                    FLOAT = NULL,&lt;br /&gt; @pricelow                                DECIMAL(18,0) = NULL,&lt;br /&gt; @pricehigh                                DECIMAL(18,0) = NULL,&lt;br /&gt; @color                                    VARCHAR(50) = NULL,&lt;br /&gt; @code                                    VARCHAR(50) = NULL,&lt;br /&gt; @sizetype                                VARCHAR(50) = NULL,&lt;br /&gt; @newarrival                                BIT = NULL&lt;br /&gt; &lt;br /&gt;AS&lt;br /&gt; Set NoCount ON&lt;br /&gt;&lt;br /&gt; /* Variable Declaration */&lt;br /&gt;&lt;br /&gt; Declare @SQLstrquesry AS NVarchar(4000)&lt;br /&gt;&lt;br /&gt; Declare @ParameterDefinition AS NVarchar(2000)&lt;br /&gt;&lt;br /&gt; /* Build the Transact-SQL String with the input parameters */&lt;br /&gt;&lt;br /&gt; Set @SQLstrquesry = 'Select * from rpm_product where (1=1) '&lt;br /&gt;&lt;br /&gt; /* check for the condition and build the WHERE clause accordingly */&lt;br /&gt;&lt;br /&gt; If @dresstype Is Not Null&lt;br /&gt;      Set @SQLstrquesry = @SQLstrquesry + ' And (dresstype = @dresstype)'&lt;br /&gt;&lt;br /&gt; If @worktype Is Not Null&lt;br /&gt;      Set @SQLstrquesry = @SQLstrquesry + ' And (worktype = @worktype)'&lt;br /&gt;&lt;br /&gt; If @material Is Not Null&lt;br /&gt;      Set @SQLstrquesry = @SQLstrquesry + ' And (material = @material)'&lt;br /&gt;&lt;br /&gt; If @category Is Not Null&lt;br /&gt;      Set @SQLstrquesry = @SQLstrquesry + ' And (category = @category)'&lt;br /&gt;&lt;br /&gt; If @keyword Is Not Null&lt;br /&gt;      Set @SQLstrquesry = @SQLstrquesry + ' And (keyword = @keyword)'&lt;br /&gt;&lt;br /&gt; If @material Is Not Null&lt;br /&gt;      Set @SQLstrquesry = @SQLstrquesry + ' And (material = @material)'&lt;br /&gt;&lt;br /&gt; If @weight Is Not Null&lt;br /&gt;      Set @SQLstrquesry = @SQLstrquesry + ' And (weight &lt;= @weight)'&lt;br /&gt;&lt;br /&gt; If @color Is Not Null         &lt;br /&gt;Set @SQLstrquesry = @SQLstrquesry + ' And (color LIKE % @color %)'&lt;br /&gt;&lt;br /&gt;If @code Is Not Null          Set @SQLstrquesry = @SQLstrquesry + ' And (code = @code)'&lt;br /&gt;&lt;br /&gt; If @sizetype Is Not Null          Set @SQLstrquesry = @SQLstrquesry + ' And (sizetype = @sizetype)'     &lt;br /&gt;&lt;br /&gt;-- this section is used to check for the lower and upper limit of the price...user can select none, lowest price, highest price or the none&lt;br /&gt;&lt;br /&gt; if ((@pricelow Is Not Null) and (@pricehigh Is Not Null))&lt;br /&gt; Set @SQLstrquesry = @SQLstrquesry + ' And (price BETWEEN @pricelow AND @pricehigh)'&lt;br /&gt; else if(@pricelow Is Not Null)         Set @SQLstrquesry = @SQLstrquesry + ' And (price &gt;= @pricelow)'&lt;br /&gt; else if (@pricehigh Is Not Null)&lt;br /&gt;     Set @SQLstrquesry = @SQLstrquesry + ' And (price &lt;= @pricehigh)'      -- checking if the user wants to check with the newarrival if yes then&lt;br /&gt;   if ((@newarrival Is Not Null) and (@newarrival=1))         Set @SQLstrquesry = @SQLstrquesry + ' And (newarrival = 1 )'       &lt;br /&gt;/* Specify Parameter Format for all input parameters included      in the stmt */     &lt;br /&gt;Set @ParameterDefinition =      '                  @dresstype    VARCHAR(50),                &lt;br /&gt;@worktype    VARCHAR(50),                &lt;br /&gt;@material    VARCHAR(50),&lt;br /&gt; @category    VARCHAR(50),&lt;br /&gt; @keyword    VARCHAR(50),&lt;br /&gt; @catalog    VARCHAR(50),&lt;br /&gt; @weight        FLOAT,                &lt;br /&gt;@pricelow    DECIMAL(18,0),                &lt;br /&gt;@pricehigh    DECIMAL(18,0),&lt;br /&gt; @color        VARCHAR(50),                &lt;br /&gt;@code        VARCHAR(50),                &lt;br /&gt;@sizetype    VARCHAR(50),&lt;br /&gt;               @newarrival BIT' &lt;br /&gt;&lt;br /&gt;/* Execute the Transact-SQL String with all parameter value's        Using sp_executesql Command */     &lt;br /&gt;&lt;br /&gt;Execute sp_Executesql     @SQLstrquesry,                 @ParameterDefinition,                 @dresstype,                 @worktype,                 @material,                 @category,                 @keyword,                 @catalog,                 @weight,                 @pricelow,                 @pricehigh,                 @color,                 @code,                 @sizetype,                 @newarrival                     If @@ERROR &lt;&gt; 0 GoTo ErrorHandler&lt;br /&gt;&lt;br /&gt; Set NoCount OFF&lt;br /&gt; Return(0)&lt;br /&gt;&lt;br /&gt;ErrorHandler:&lt;br /&gt;&lt;br /&gt; Return(@@ERROR)&lt;br /&gt;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;after creating the procdure we can execute it for test as follows&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;EXEC Usprpm_SearchProduct 'dress type', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ,NULL, NULL&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;this will return all the matching records based on the search paramater&lt;/span&gt; we passed&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Happy programming :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-921770971798835871?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/921770971798835871/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=921770971798835871' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/921770971798835871'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/921770971798835871'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2009/02/dynamic-sql-query-with-stored-procedure.html' title='Dynamic SQL Query with Stored Procedure'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-4865643348731725084</id><published>2009-02-21T01:43:00.000-08:00</published><updated>2009-02-21T02:14:07.688-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Session_Start'/><category scheme='http://www.blogger.com/atom/ns#' term='Application_BeginRequest'/><category scheme='http://www.blogger.com/atom/ns#' term='Global.asax'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net'/><category scheme='http://www.blogger.com/atom/ns#' term='Application_Error'/><category scheme='http://www.blogger.com/atom/ns#' term='Application_EndRequest'/><category scheme='http://www.blogger.com/atom/ns#' term='Application_Start'/><category scheme='http://www.blogger.com/atom/ns#' term='Application_AuthenticateRequest'/><category scheme='http://www.blogger.com/atom/ns#' term='Application_End'/><title type='text'>What we can do with Global.asax in asp.net</title><content type='html'>&lt;span style="font-family: times new roman;font-size:180%;" &gt;What we can do with Global.asax in asp.net&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;Writing logic at the application level.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;Handling events or error at the application level.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;Defining Even handler with the application or session-wide scope.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;:)&lt;/span&gt;&lt;br /&gt;&lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;    &lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;The Global.asax&lt;/span&gt;   -&lt;br /&gt;&lt;br /&gt;                      Also known as the ASP.NET application file.&lt;br /&gt;                      Located in the root directory of an ASP.NET application.&lt;br /&gt;                     This file contains code that is executed in response to application-level and session-level events raised by ASP.NET or by HTTP modules.&lt;br /&gt;                     We can also &lt;span style="color:black;"&gt;define ‘objects’ with application-wide or session-wide scope in the Global.asax file. These events and objects declared in the Global.asax are applied to all resources in that web application.&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;                        The Global.asax is an optional file. Use it only when there is a need for it.&lt;br /&gt;                      If a user requests the Global.asax file, the request is rejected. External users cannot view the file.&lt;br /&gt;                      The Global.asax file is parsed and dynamically compiled by ASP.NET. WE deploy this file as an assembly in the \bin directory of an ASP.NET application.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;font-size:130%;" &gt;Adding global.asax&lt;/span&gt;&lt;span style="font-family: times new roman;"&gt; file to our project(web)  is simple - (in VS2005 and VS2008)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;font-family:Verdana;font-size:85%;"  &gt;Create a new website &gt; Go to the Solution Explorer &gt; Add New Item &gt; Global Application Class &gt; Add&lt;br /&gt;&lt;br /&gt;In Global.asax methods fires corresponding to events and there are two sets which fires corrosponding to the event -&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;1) Enovokes on every request&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;2) Does not envoke on every request&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;Envokes on every request :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;These are the methods corresponding to events that fire on each request.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;Application_BeginRequest()&lt;/span&gt; – fired when a request for the web application comes in we can use it for application level use when the application starts.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;Application_AuthenticateRequest() &lt;/span&gt;–fired just before the user credentials are authenticated. We specify your own authentication logic over here.&lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;Application_AuthorizeRequest()&lt;/span&gt; – fired on successful authentication of user’s credentials. We use this method to give authorization rights to user. &lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;Application_ResolveRequestCache()&lt;/span&gt; – fired on successful completion of an authorization request. &lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;Application_AcquireRequestState()&lt;/span&gt; – fired just before the session state is retrieved for the current request.&lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;Application_PreRequestHandlerExecute()&lt;/span&gt; - fired before the page framework begins before executing an event handler to handle the request.&lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;Application_PostRequestHandlerExecute()&lt;/span&gt; – fired after HTTP handler has executed the request.&lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;Application_ReleaseRequestState()&lt;/span&gt; – fired before current state data kept in the session collection is serialized.&lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;Application_UpdateRequestCache()&lt;/span&gt; – fired before information is added to output cache of the page.&lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;Application_EndRequest() &lt;/span&gt;– fired at the end of each request&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;font-family:Verdana;font-size:180%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: times new roman;font-family:Verdana;font-size:85%;"  &gt;&lt;span style="font-size:180%;"&gt;Does not envoke on every request :&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;These are the methods corresponding to events that do not fire on each request&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;Application_Start()&lt;/span&gt; – fired when the first resource is requested from the web server and the web application starts.&lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;Session_Start()&lt;/span&gt; – fired when session starts on each new user requesting a page.&lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;Application_Error() &lt;/span&gt;– fired when an error occurs.&lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;Session_End()&lt;/span&gt; – fired when the session of a user ends.&lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;Application_End()&lt;/span&gt; – fired when the web application ends.&lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 10pt; font-family: times new roman;" align="justify"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;Application_Disposed()&lt;/span&gt; - fired when the web application is destroyed.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;A Simple example shows how we can catach unhandled errors that occur at the application level.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="margin: 0in 0in 0pt; line-height: normal; font-family: times new roman;"&gt;&lt;span style="font-size:85%;"&gt;    &lt;span style="color:blue;"&gt;void&lt;/span&gt; Application_Error(&lt;span style="color:blue;"&gt;object&lt;/span&gt; sender, &lt;span style="color: rgb(43, 145, 175);"&gt;EventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 0pt; line-height: normal; font-family: times new roman;"&gt;&lt;span style="font-size:85%;"&gt;    {&lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 0pt; line-height: normal; font-family: times new roman;"&gt;&lt;span style="font-size:85%;"&gt;     &lt;br /&gt;      &lt;span style="color:green;"&gt;// This code will runs whenever unhandled error occurs in the&lt;br /&gt;      // Here we can write logic for error log or something&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 0pt; line-height: normal; font-family: times new roman;"&gt;&lt;span style="font-size:85%;"&gt;          &lt;span style="color: rgb(43, 145, 175);"&gt;Exception&lt;/span&gt; objError = Server.GetLastError().GetBaseException();&lt;/span&gt;&lt;/div&gt;  &lt;div style="margin: 0in 0in 0pt; line-height: normal; font-family: times new roman;"&gt;&lt;span style="font-size:85%;"&gt;          &lt;span style="color:blue;"&gt;string&lt;/span&gt; error =&lt;br /&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;                "Error in: "&lt;/span&gt; + Request.Url.ToString() + &lt;span style="color: rgb(163, 21, 21);"&gt;"Error Message:"&lt;/span&gt; +    objError.Message.ToString();&lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 0pt; line-height: normal; font-family: times new roman;"&gt;&lt;span style="font-size:85%;"&gt;        &lt;/span&gt;&lt;/div&gt; &lt;div style="margin: 0in 0in 10pt; line-height: normal; font-family: times new roman;"&gt;&lt;span style="font-size:85%;"&gt;    }&lt;br /&gt;&lt;br /&gt;In one case i have used application_start to count the no of user visiting to the sites and display it.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: times new roman;"&gt;We can use this little file as per our requirement with the some logic on the particular event amazingly.....&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;happy programming !!!!!!!!!!&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;font-family:Verdana;font-size:85%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-4865643348731725084?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/4865643348731725084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=4865643348731725084' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/4865643348731725084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/4865643348731725084'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2009/02/what-we-can-do-with-globalaspx-in.html' title='What we can do with Global.asax in asp.net'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-5605806463314655018</id><published>2009-02-14T01:58:00.000-08:00</published><updated>2009-02-21T02:21:07.344-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='functional programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='F#'/><category scheme='http://www.blogger.com/atom/ns#' term='new programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='whats new with .net'/><category scheme='http://www.blogger.com/atom/ns#' term='F# .NET'/><category scheme='http://www.blogger.com/atom/ns#' term='what is next .net'/><title type='text'>F#  - functional programming language for the .NET Framework.</title><content type='html'>&lt;span style="font-family: times new roman;"&gt;F# is a functional programming language for the .NET Framework. It combines the succinct, expressive, and compositional style of functional programming with the runtime, libraries, interoperability, and object model of .NET.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;you can get additional in detials information about the language on the microsoft website&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a style="font-family: times new roman;" hreg="http://msdn.microsoft.com/en-us/fsharp/default.aspx"&gt;http://msdn.microsoft.com/en-us/fsharp/default.aspx&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p style="font-family: times new roman;"&gt;The best times  for using it are for things that involve doing some number crunching and string manipulation. &lt;/p&gt;  &lt;p style="font-family: times new roman;"&gt;For those of you that have not looked at F# yet, you can learn about it &lt;a href="http://msdn.microsoft.com/en-us/fsharp/default.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p style="font-family: times new roman;"&gt;Also, there is a &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=61ad6924-93ad-48dc-8c67-60f7e7803d3c"&gt;download&lt;/a&gt; available for Visual Studio 2008 that lets you start using it.&lt;/p&gt;  &lt;p style="font-family: times new roman;"&gt;This is also some great information in &lt;a href="http://cs.hubfs.net/forums/default.aspx"&gt;hubFS&lt;/a&gt;.  That is a great place to see example code and ask people how to do some things in F#.  I would also suggest checking out this post, &lt;a title="The F# Operators and Basic Functions" href="http://blogs.msdn.com/dsyme/archive/2008/09/01/the-f-operators-and-basic-functions.aspx"&gt;The F# Operators and Basic Functions&lt;/a&gt;.&lt;/p&gt;  &lt;p style="font-family: times new roman;"&gt;Keep in mind that F# is a &lt;a href="http://en.wikipedia.org/wiki/Functional_programming"&gt;functional programming language&lt;/a&gt;.  So this allows you to have all the power of a functional language, and still be in .NET and use tools you are familiar with.&lt;/p&gt;  &lt;p style="font-family: times new roman;"&gt;One example of using F# is &lt;a href="http://blogs.msdn.com/lucabol/archive/2008/12/04/financial-functions-for-net-released.aspx"&gt;Luca Bolognese’s Financial Functions&lt;/a&gt;.&lt;/p&gt;&lt;p style="font-family: times new roman;"&gt;Hope programmer will like this language.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1382057422619872904-5605806463314655018?l=prawinway.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://prawinway.blogspot.com/feeds/5605806463314655018/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1382057422619872904&amp;postID=5605806463314655018' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/5605806463314655018'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1382057422619872904/posts/default/5605806463314655018'/><link rel='alternate' type='text/html' href='http://prawinway.blogspot.com/2009/02/f-functional-programming-language-for.html' title='F#  - functional programming language for the .NET Framework.'/><author><name>pravin</name><uri>http://www.blogger.com/profile/02816324219078295310</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_iw1sg5UH9L8/Sgk8wtKhepI/AAAAAAAABJ0/RjXqZHg02oY/S220/Picture+289.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1382057422619872904.post-1457523608227614196</id><published>2009-02-10T05:12:00.000-08:00</published><updated>2009-02-21T03:13:46.607-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RDBMS Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Querying Database'/><category scheme='http://www.blogger.com/atom/ns#' term='DataBase Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='Quick SQL Reference'/><category scheme='http://www.blogger.com/atom/ns#' term='MS SQL Query'/><category scheme='http://www.blogger.com/atom/ns#' term='RDBMS intro'/><category scheme='http://www.blogger.com/atom/ns#' term='SELECT Basics'/><category scheme='http://www.blogger.com/atom/ns#' term='MS SQL Basics'/><title type='text'>Quick SQL Reference - SQL Basics</title><content type='html'>&lt;span style="font-family:times new roman;"&gt;In a relational database, data is stored in tables. An example table would relate Social Security Number, Name, and Address:&lt;/span&gt; &lt;span style="font-family: times new roman;font-size:78%;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;table style="width: 250px; height: 190px; font-family: times new roman;" border="1" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="6"&gt;   &lt;div align="left"&gt;&lt;span style="font-size:78%;"&gt;&lt;b&gt;EmployeeAddressTable&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;&lt;b&gt;SSN&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;&lt;b&gt;FirstName&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;&lt;b&gt;LastName&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;&lt;b&gt;Address&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;&lt;b&gt;City&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;&lt;b&gt;State&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;512687458&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;Joe&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;Smith &lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;83 First Street&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;Howard&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;Ohio &lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;758420012&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;Mary&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;Scott &lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;842 Vine Ave.&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;Losantiville&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;Ohio &lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;102254896&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;Sam&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;Jones &lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;33 Elm St.&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;Paris&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;New York &lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;876512563&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;Sarah&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;Ackerman &lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;440 U.S.   110&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;Upton&lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;span style="font-size:78%;"&gt;Michigan &lt;/span&gt;&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;br /&gt;Now, let's say you want to see the address of each employee. Use the SELECT statement, like so: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT FirstName, LastName, Address, City, State&lt;br /&gt;FROM EmployeeAddressTable; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;The following is the results of your &lt;i&gt;query&lt;/i&gt; of the database:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;table style="width: 338px; height: 204px; font-family: times new roman;" border="1" cellpadding="0"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;First Name&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;Last Name&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;Address&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;City&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;State&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;Joe&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Smith&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;83 First     Street &lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Howard&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Ohio&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;Mary&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Scott&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;842 Vine Ave. &lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Losantiville&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Ohio&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;Sam&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Jones&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;33 Elm St. &lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Paris&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;New York&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;Sarah&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Ackerman&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;440 U.S.   110 &lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Upton&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Michigan&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;br /&gt;To explain what you just did, you asked for the all of data in the EmployeeAddressTable, and specifically, you asked for the &lt;i&gt;columns&lt;/i&gt; called FirstName, LastName, Address, City, and State. Note that column names and table names do not have spaces...they must be typed as one word; and that the statement ends with a semicolon (;). The general form for a SELECT statement, retrieving all of the &lt;i&gt;rows&lt;/i&gt; in the table is:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT ColumnName, ColumnName, ...&lt;br /&gt;FROM TableName;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;To get all columns of a table without typing all column names, use:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT * FROM TableName; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Each database management system (DBMS) and database software has different methods for logging in to the database and entering SQL commands; see the local computer "guru" to help you get onto the system, so that you can use SQL. &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;Conditional Selection&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;To further discuss the SELECT statement, let's look at a new example table (for hypothetical purposes only):&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;table style="width: 338px; height: 238px; font-family: times new roman;" border="1" cellpadding="0"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td colspan="4"&gt;   &lt;div align="center"&gt;&lt;b&gt;EmployeeStatisticsTable&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="26%"&gt;   &lt;div&gt;&lt;b&gt;EmployeeIDNo&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;&lt;b&gt;Salary&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;&lt;b&gt;Benefits&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;&lt;b&gt;Position&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="26%"&gt;   &lt;div&gt;010&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;75000&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;15000 &lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;Manager&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="26%"&gt;   &lt;div&gt;105&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;65000&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;15000 &lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;Manager&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="26%"&gt;   &lt;div&gt;152&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;60000&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;15000 &lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;Manager&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="26%"&gt;   &lt;div&gt;215&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;60000&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;12500 &lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;Manager&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="26%"&gt;   &lt;div&gt;244&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;50000&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;12000 &lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;Staff&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="26%"&gt;   &lt;div&gt;300&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;45000&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;10000 &lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;Staff&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="26%"&gt;   &lt;div&gt;335&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;40000&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;10000 &lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;Staff&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="26%"&gt;   &lt;div&gt;400&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;32000&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;7500 &lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;Entry-Level&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="26%"&gt;   &lt;div&gt;441&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;28000&lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;7500 &lt;/div&gt;   &lt;/td&gt;   &lt;td width="25%"&gt;   &lt;div&gt;Entry-Level&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;Relational Operators&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;br /&gt;There are six Relational Operators in SQL, and after introducing them, we'll see how they're used:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;table style="font-family: times new roman;" border="1" cellpadding="0" width="283"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td width="36%"&gt;   &lt;div&gt;=&lt;/div&gt;   &lt;/td&gt;   &lt;td width="64%"&gt;   &lt;div&gt;Equal&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="36%"&gt;   &lt;div&gt;&lt;&gt;   &lt;/div&gt;&lt;/td&gt;   &lt;td width="64%"&gt;   &lt;div&gt;Not Equal &lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="36%"&gt;   &lt;div&gt;&lt; &lt;/div&gt;   &lt;/td&gt;   &lt;td width="64%"&gt;   &lt;div&gt;Less Than&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="36%"&gt;   &lt;div&gt;&gt; &lt;/div&gt;   &lt;/td&gt;   &lt;td width="64%"&gt;   &lt;div&gt;Greater Than&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="36%"&gt;   &lt;div&gt;&lt;=&lt;/div&gt;   &lt;/td&gt;   &lt;td width="64%"&gt;   &lt;div&gt;Less Than or Equal To&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="36%"&gt;   &lt;div&gt;&gt;=&lt;/div&gt;   &lt;/td&gt;   &lt;td width="64%"&gt;   &lt;div&gt;Greater Than or Equal To &lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;br /&gt;The &lt;i&gt;WHERE &lt;/i&gt;clause is used to specify that only certain rows of the table are displayed, based on the criteria described in that &lt;i&gt;WHERE clause&lt;/i&gt;. It is most easily understood by looking at a couple of examples. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;If you wanted to see the EMPLOYEEIDNO's of those making at or over $50,000, use the following: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT EMPLOYEEIDNO&lt;br /&gt;FROM EMPLOYEESTATISTICSTABLE&lt;br /&gt;WHERE SALARY &gt;= 50000; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Notice that the &gt;= (greater than or equal to) sign is used, as we wanted to see those who made greater than $50,000, or equal to $50,000, listed together. This displays: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;EMPLOYEEIDNO&lt;br /&gt;------------&lt;br /&gt;010&lt;br /&gt;105&lt;br /&gt;152&lt;br /&gt;215&lt;br /&gt;244 &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;The &lt;i&gt;WHERE&lt;/i&gt; description, SALARY &gt;= 50000, is known as a &lt;i&gt;condition&lt;/i&gt; (an operation which evaluates to True or False)&lt;i&gt;.&lt;/i&gt; The same can be done for text columns: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT EMPLOYEEIDNO&lt;br /&gt;FROM EMPLOYEESTATISTICSTABLE&lt;br /&gt;WHERE POSITION = 'Manager'; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;This displays the ID Numbers of all Managers. Generally, with text columns, stick to equal to or not equal to, and make sure that any text that appears in the statement is surrounded by single quotes ('). &lt;b&gt;&lt;i&gt;Note:&lt;/i&gt;&lt;/b&gt; Position is now an illegal identifier because it is now an unused, but reserved, keyword in the SQL-92 standard.  &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;More Complex Conditions: Compound Conditions / Logical Operators &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;The &lt;i&gt;AND&lt;/i&gt; operator joins two or more conditions, and displays a row only if that row's data satisfies &lt;b&gt;ALL&lt;/b&gt; conditions listed (i.e. all conditions hold true). For example, to display all staff making over $40,000, use: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT EMPLOYEEIDNO&lt;br /&gt;FROM EMPLOYEESTATISTICSTABLE&lt;br /&gt;WHERE SALARY &gt; 40000 AND POSITION = 'Staff'; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;The &lt;i&gt;OR&lt;/i&gt; operator joins two or more conditions, but returns a row if &lt;b&gt;ANY&lt;/b&gt; of the conditions listed hold true. To see all those who make less than $40,000 or have less than $10,000 in benefits, listed together, use the following query: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT EMPLOYEEIDNO&lt;br /&gt;FROM EMPLOYEESTATISTICSTABLE&lt;br /&gt;WHERE SALARY &lt;&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;AND &amp;amp; OR can be combined, for example: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT EMPLOYEEIDNO&lt;br /&gt;FROM EMPLOYEESTATISTICSTABLE&lt;br /&gt;WHERE POSITION = 'Manager' AND SALARY &gt; 60000 OR BENEFITS &gt; 12000; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;First, SQL finds the rows where the salary is greater than $60,000 and the position column is equal to Manager, then taking this new list of rows, SQL then sees if any of these rows satisfies the previous AND condition or the condition that the Benefits column is greater than $12,000. Subsequently, SQL only displays this second new list of rows, keeping in mind that anyone with Benefits over $12,000 will be included as the OR operator includes a row if either resulting condition is True. Also note that the AND operation is done first. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;To generalize this process, SQL performs the AND operation(s) to determine the rows where the AND operation(s) hold true (remember: all of the conditions are true), then these results are used to compare with the OR conditions, and only display those remaining rows where any of the conditions joined by the OR operator hold true (where a condition or result from an AND is paired with another condition or AND result to use to evaluate the OR, which evaluates to true if either value is true). Mathematically, SQL evaluates all of the conditions, then evaluates the AND "pairs", and then evaluates the OR's (where both operators evaluate left to right). &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;To look at an example, for a given row for which the DBMS is evaluating the SQL statement Where clause to determine whether to include the row in the query result (the whole Where clause evaluates to True), the DBMS has evaluated all of the conditions, and is ready to do the logical comparisons on this result: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;True AND False OR True AND True OR False AND False &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;First simplify the AND pairs: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;False OR True OR False &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Now do the OR's, left to right: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;True OR False&lt;br /&gt;True &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;The result is True, and the row passes the query conditions. Be sure to see the next section on NOT's, and the order of logical operations. I hope that this section has helped you understand AND's or OR's, as it's a difficult subject to explain briefly. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;To perform OR's before AND's, like if you wanted to see a list of employees making a large salary ($50,000) or have a large benefit package ($10,000), and that happen to be a manager, use parentheses: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT EMPLOYEEIDNO&lt;br /&gt;FROM EMPLOYEESTATISTICSTABLE&lt;br /&gt;WHERE POSITION = 'Manager' AND (SALARY &gt; 50000 OR BENEFITS &gt; 10000); &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;IN &amp;amp; BETWEEN&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;An easier method of using compound conditions uses &lt;i&gt;IN&lt;/i&gt; or &lt;i&gt;BETWEEN.&lt;/i&gt; For example, if you wanted to list all managers and staff: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT EMPLOYEEIDNO&lt;br /&gt;FROM EMPLOYEESTATISTICSTABLE&lt;br /&gt;WHERE POSITION IN ('Manager', 'Staff'); &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;or to list those making greater than or equal to $30,000, but less than or equal to $50,000, use: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT EMPLOYEEIDNO&lt;br /&gt;FROM EMPLOYEESTATISTICSTABLE&lt;br /&gt;WHERE SALARY BETWEEN 30000 AND 50000; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;To list everyone not in this range, try: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT EMPLOYEEIDNO&lt;br /&gt;FROM EMPLOYEESTATISTICSTABLE&lt;br /&gt;WHERE SALARY NOT BETWEEN 30000 AND 50000; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Similarly, NOT IN lists all rows excluded from the &lt;i&gt;IN&lt;/i&gt; list. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Additionally, NOT's can be thrown in with AND's &amp;amp; OR's, except that NOT is a unary operator (evaluates one condition, reversing its value, whereas, AND's &amp;amp; OR's evaluate two conditions), and that all NOT's are performed before any AND's or OR's. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;SQL Order of Logical Operations (each operates from left to right)&lt;/i&gt;&lt;/b&gt; &lt;/div&gt;  &lt;ol style="font-family: times new roman;" start="1" type="1"&gt;&lt;li&gt;NOT &lt;/li&gt;&lt;li&gt;AND &lt;/li&gt;&lt;li&gt;OR &lt;/li&gt;&lt;/ol&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;br /&gt;Using&lt;i&gt; LIKE&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Look at the EmployeeStatisticsTable, and say you wanted to see all people whose last names started with "S"; try: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT EMPLOYEEIDNO&lt;br /&gt;FROM EMPLOYEEADDRESSTABLE&lt;br /&gt;WHERE LASTNAME LIKE 'S%'; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;The percent sign (%) is used to represent any possible character (number, letter, or punctuation) or set of characters that might appear after the "S". To find those people with LastName's ending in "S", use '%S', or if you wanted the "S" in the middle of the word, try '%S%'. The '%' can be used for any characters in the same position relative to the given characters. NOT LIKE displays rows not fitting the given description. Other possibilities of using LIKE, or any of these discussed conditionals, are available, though it depends on what DBMS you are using; as usual, consult a manual or your system manager or administrator for the available features on your system, or just to make sure that what you are trying to do is available and allowed. This disclaimer holds for the features of SQL that will be discussed below. This section is just to give you an idea of the possibilities of queries that can be written in SQL. &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;br /&gt;Joins&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;In this section, we will only discuss &lt;i&gt;inner&lt;/i&gt; joins, and &lt;i&gt;equijoins&lt;/i&gt;, as in general, they are the most useful. For more information, try the SQL links at the bottom of the page. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Good database design suggests that each table lists data only about a single &lt;i&gt;entity&lt;/i&gt;, and detailed information can be obtained in a relational database, by using additional tables, and by using a &lt;i&gt;join&lt;/i&gt;. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;First, take a look at these example tables:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;AntiqueOwners&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;table style="width: 318px; height: 158px; font-family: times new roman;" border="1" cellpadding="0"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;OwnerID&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;OwnerLastName&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;OwnerFirstName&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;01&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Jones&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Bill&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Smith&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Bob&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;15&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Lawson&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Patricia&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;21&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Akins&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Jane&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;50&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Fowler&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Sam&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;div style="font-family: times new roman;"&gt;  &lt;hr align="left" size="2" width="75%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;br /&gt;Orders&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;table style="font-family: times new roman;" border="1" cellpadding="0"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;OwnerID&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;ItemDesired&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Table&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Desk&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;21&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Chair&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;15&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Mirror&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;div style="font-family: times new roman;"&gt;  &lt;hr align="left" size="2" width="50%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;br /&gt;Antiques&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;table style="font-family: times new roman;" border="1" cellpadding="0"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;SellerID&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;BuyerID&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;Item&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;01&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;50&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Bed&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;15&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Table&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;15&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Chair&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;21&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;50&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Mirror&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;50&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;01&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Desk&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;01&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;21&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Cabinet&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;21&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Coffee Table&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;15&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;50&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Chair&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;01&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;15&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Jewelry Box&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;21&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Pottery&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;21&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Bookcase&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;50&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;01&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Plant Stand&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;br /&gt;Keys&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;First, let's discuss the concept of &lt;i&gt;keys&lt;/i&gt;. A &lt;i&gt;primary key&lt;/i&gt; is a column or set of columns that uniquely identifies the rest of the data in any given row. For example, in the AntiqueOwners table, the OwnerID column uniquely identifies that row. This means two things: no two rows can have the same OwnerID, and, even if two owners have the same first and last names, the OwnerID column ensures that the two owners will not be confused with each other, because the unique OwnerID column will be used throughout the database to track the owners, rather than the names. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;A&lt;i&gt; foreign key&lt;/i&gt; is a column in a table where that column is a primary key of another table, which means that any data in a foreign key column must have corresponding data in the other table where that column is the primary key. In DBMS-speak, this correspondence is known as &lt;i&gt;referential integrity&lt;/i&gt;. For example, in the Antiques table, both the BuyerID and SellerID are foreign keys to the primary key of the AntiqueOwners table (OwnerID; for purposes of argument, one has to be an Antique Owner before one can buy or sell any items), as, in both tables, the ID rows are used to identify the owners or buyers and sellers, and that the OwnerID is the primary key of the AntiqueOwners table. In other words, all of this "ID" data is used to refer to the owners, buyers, or sellers of antiques, themselves, without having to use the actual names. &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;Performing a Join&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;The purpose of these &lt;i&gt;keys&lt;/i&gt; is so that data can be related across tables, without having to repeat data in every table--this is the power of relational databases. For example, you can find the names of those who bought a chair without having to list the full name of the buyer in the Antiques table...you can get the name by relating those who bought a chair with the names in the AntiqueOwners table through the use of the OwnerID, which &lt;i&gt;relates&lt;/i&gt; the data in the two tables. To find the names of those who bought a chair, use the following query: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT OWNERLASTNAME, OWNERFIRSTNAME&lt;br /&gt;FROM ANTIQUEOWNERS, ANTIQUES&lt;br /&gt;WHERE BUYERID = OWNERID AND ITEM = 'Chair'; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Note the following about this query...notice that both tables involved in the relation are listed in the FROM clause of the statement. In the WHERE clause, first notice that the ITEM = 'Chair' part restricts the listing to those who have bought (and in this example, thereby own) a chair. Secondly, notice how the ID columns are related from one table to the next by use of the BUYERID = OWNERID clause. Only where ID's match across tables and the item purchased is a chair (because of the AND), will the names from the AntiqueOwners table be listed. Because the joining condition used an equal sign, this join is called an &lt;i&gt;equijoin&lt;/i&gt;. The result of this query is two names: Smith, Bob &amp;amp; Fowler, Sam. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;i&gt;Dot notation&lt;/i&gt; refers to prefixing the table names to column names, to avoid ambiguity, as follows: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT ANTIQUEOWNERS.OWNERLASTNAME, ANTIQUEOWNERS.OWNERFIRSTNAME&lt;br /&gt;FROM ANTIQUEOWNERS, ANTIQUES&lt;br /&gt;WHERE ANTIQUES.BUYERID = ANTIQUEOWNERS.OWNERID AND ANTIQUES.ITEM = 'Chair'; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;As the column names are different in each table, however, this wasn't necessary. &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;DISTINCT&lt;/i&gt; and Eliminating Duplicates&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Let's say that you want to list the ID and names of &lt;b&gt;only&lt;/b&gt; those people who have sold an antique. Obviously, you want a list where each seller is only listed once--you don't want to know how many antiques a person sold, just the fact that this person sold one (for counts, see the Aggregate Function section below). This means that you will need to tell SQL to eliminate duplicate sales rows, and just list each person only once. To do this, use the &lt;i&gt;DISTINCT&lt;/i&gt; keyword. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;First, we will need an equijoin to the AntiqueOwners table to get the detail data of the person's LastName and FirstName. However, keep in mind that since the SellerID column in the Antiques table is a foreign key to the AntiqueOwners table, a seller will only be listed if there is a row in the AntiqueOwners table listing the ID and names. We also want to eliminate multiple occurrences of the SellerID in our listing, so we use &lt;i&gt;DISTINCT &lt;/i&gt;on the column where the repeats may occur (however, it is generally not necessary to strictly put the Distinct in front of the column name). &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;To throw in one more twist, we will also want the list alphabetized by LastName, then by FirstName (on a LastName tie). Thus, we will use the &lt;i&gt;ORDER BY&lt;/i&gt; clause: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT DISTINCT SELLERID, OWNERLASTNAME, OWNERFIRSTNAME&lt;br /&gt;FROM ANTIQUES, ANTIQUEOWNERS&lt;br /&gt;WHERE SELLERID = OWNERID&lt;br /&gt;ORDER BY OWNERLASTNAME, OWNERFIRSTNAME; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;In this example, since everyone has sold an item, we will get a listing of all of the owners, in alphabetical order by last name. For future reference (and in case anyone asks), this type of join is considered to be in the category of &lt;i&gt;inner joins. &lt;/i&gt;&lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;&lt;i&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/i&gt;&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;br /&gt;Aliases &amp;amp; &lt;i&gt;In&lt;/i&gt;/Subqueries&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;In this section, we will talk about &lt;i&gt;Aliases&lt;/i&gt;, &lt;i&gt;In&lt;/i&gt; and the use of subqueries, and how these can be used in a 3-table example. First, look at this query which prints the last name of those owners who have placed an order and what the order is, only listing those orders which can be filled (that is, there is a buyer who owns that ordered item): &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT OWN.OWNERLASTNAME Last Name, ORD.ITEMDESIRED Item Ordered&lt;br /&gt;FROM ORDERS ORD, ANTIQUEOWNERS OWN&lt;br /&gt;WHERE ORD.OWNERID = OWN.OWNERID&lt;br /&gt;AND ORD.ITEMDESIRED IN &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;(SELECT ITEM&lt;br /&gt;FROM ANTIQUES);&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;This gives: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Last Name Item Ordered&lt;br /&gt;--------- ------------&lt;br /&gt;Smith     Table&lt;br /&gt;Smith     Desk&lt;br /&gt;Akins     Chair&lt;br /&gt;Lawson    Mirror &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;There are several things to note about this query: &lt;/div&gt;  &lt;ol style="font-family: times new roman;" start="1" type="1"&gt;&lt;li&gt;First, the "Last      Name" and "Item Ordered" in the Select lines gives the      headers on the report. &lt;/li&gt;&lt;li&gt;The OWN &amp;amp; ORD are aliases; these are new names for the two tables listed in the FROM clause that are used as prefixes for all dot notations of column names in the query (see above). This eliminates ambiguity, especially in the equijoin WHERE clause where both tables have the column named OwnerID, and the dot notation tells SQL that we are talking about two different OwnerID's from the two different tables. &lt;/li&gt;&lt;li&gt;Note that the Orders table is listed first in the FROM clause; this makes sure listing is done off of that table, and the AntiqueOwners table is only used for the detail information (Last Name). &lt;/li&gt;&lt;li&gt;Most importantly, the AND in the WHERE clause forces the In Subquery to be invoked ("= ANY" or "= SOME" are two equivalent uses of IN). What this does is, the subquery is performed, returning all of the Items owned from the Antiques table, as there is no WHERE clause. Then, for a row from the Orders table to be listed, the ItemDesired must be in that returned list of Items owned from the Antiques table, thus listing an item only if the order can be filled from another owner. You can think of it this way: the subquery returns a &lt;i&gt;set&lt;/i&gt; of Items from which each ItemDesired in the Orders table is compared; the In condition is true only if the ItemDesired is in that returned set from the Antiques table. &lt;/li&gt;&lt;li&gt;Also notice, that in this case, that there happened to be an antique available for each one desired...obviously, that won't always be the case. In addition, notice that when the IN, "= ANY", or "= SOME" is used, that these keywords refer to any possible row matches, not column matches...that is, you cannot put multiple columns in the subquery Select clause, in an attempt to match the column in the outer Where clause to one of multiple possible column values in the subquery; only one column can be listed in the subquery, and the possible match comes from multiple &lt;i&gt;row&lt;/i&gt;      values in that &lt;i&gt;one&lt;/i&gt; column, not vice-versa. &lt;/li&gt;&lt;/ol&gt;  &lt;div style="font-family: times new roman;"&gt;Whew! That's enough on the topic of complex SELECT queries for now. Now on to other SQL statements. &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;Miscellaneous SQL Statements&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;Aggregate Functions&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;I will discuss five important &lt;i&gt;aggregate functions&lt;/i&gt;: SUM, AVG, MAX, MIN, and COUNT. They are called aggregate functions because they summarize the results of a query, rather than listing all of the rows. &lt;/div&gt;  &lt;ul style="font-family: times new roman;" type="disc"&gt;&lt;li&gt;SUM () gives the total of all the rows, satisfying any conditions, of the given column, where the given column is numeric. &lt;/li&gt;&lt;li&gt;AVG () gives the average of      the given column. &lt;/li&gt;&lt;li&gt;MAX () gives the largest      figure in the given column. &lt;/li&gt;&lt;li&gt;MIN () gives the smallest      figure in the given column. &lt;/li&gt;&lt;li&gt;COUNT(*) gives the number of      rows satisfying the conditions. &lt;/li&gt;&lt;/ul&gt;  &lt;div style="font-family: times new roman;"&gt;Looking at the tables at the top of the document, let's look at three examples: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT SUM(SALARY), AVG(SALARY)&lt;br /&gt;FROM EMPLOYEESTATISTICSTABLE; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;This query shows the total of all salaries in the table, and the average salary of all of the entries in the table. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT MIN(BENEFITS)&lt;br /&gt;FROM EMPLOYEESTATISTICSTABLE&lt;br /&gt;WHERE POSITION = 'Manager'; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;This query gives the smallest figure of the Benefits column, of the employees who are Managers, which is 12500. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT COUNT(*)&lt;br /&gt;FROM EMPLOYEESTATISTICSTABLE&lt;br /&gt;WHERE POSITION = 'Staff'; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;This query tells you how many employees have Staff status (3). &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;Views&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;In SQL, you might (check your DBA) have access to create views for yourself. What a view does is to allow you to assign the results of a query to a new, personal table, that you can use in other queries, where this new table is given the view name in your FROM clause. When you access a view, the query that is defined in your view creation statement is performed (generally), and the results of that query look just like another table in the query that you wrote invoking the view. For example, to create a view: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;CREATE VIEW ANTVIEW AS SELECT ITEMDESIRED FROM ORDERS; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Now, write a query using this view as a table, where the table is just a listing of all Items Desired from the Orders table: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT SELLERID&lt;br /&gt;FROM ANTIQUES, ANTVIEW&lt;br /&gt;WHERE ITEMDESIRED = ITEM; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;This query shows all SellerID's from the Antiques table where the Item in that table happens to appear in the Antview view, which is just all of the Items Desired in the Orders table. The listing is generated by going through the Antique Items one-by-one until there's a match with the Antview view. Views can be used to restrict database access, as well as, in this case, simplify a complex query. &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;br /&gt;Creating New Tables&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;All tables within a database must be created at some point in time...let's see how we would create the Orders table: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;CREATE TABLE ORDERS&lt;br /&gt;(OWNERID INTEGER NOT NULL,&lt;br /&gt;ITEMDESIRED CHAR(40) NOT NULL); &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;This statement gives the table name and tells the DBMS about each column in the table. &lt;b&gt;&lt;i&gt;Please note&lt;/i&gt;&lt;/b&gt; that this statement uses generic data types, and that the data types might be different, depending on what DBMS you are using. As usual, check local listings. Some common generic data types are: &lt;/div&gt;  &lt;ul style="font-family: times new roman;" type="disc"&gt;&lt;li&gt;Char(x) - A column of characters, where x is a number designating the maximum number of characters allowed (maximum length) in the column. &lt;/li&gt;&lt;li&gt;Integer - A column of whole      numbers, positive or negative. &lt;/li&gt;&lt;li&gt;Decimal(x, y) - A column of decimal numbers, where x is the maximum length in digits of the decimal numbers in this column, and y is the maximum number of digits allowed after the decimal point. The maximum (4,2) number would be 99.99. &lt;/li&gt;&lt;li&gt;Date - A date column in a      DBMS-specific format. &lt;/li&gt;&lt;li&gt;Logical - A column that can      hold only two values: TRUE or FALSE. &lt;/li&gt;&lt;/ul&gt;  &lt;div style="font-family: times new roman;"&gt;One other note, the NOT NULL means that the column must have a value in each row. If NULL was used, that column may be left empty in a given row. &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;br /&gt;Altering Tables&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Let's add a column to the Antiques table to allow the entry of the price of a given Item (Parentheses optional): &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;ALTER TABLE ANTIQUES ADD (PRICE DECIMAL(8,2) NULL); &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;The data for this new column can be updated or inserted as shown later. &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;br /&gt;Adding Data&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;To insert rows into a table, do the following: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;INSERT INTO ANTIQUES VALUES (21, 01, 'Ottoman', 200.00); &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;This inserts the data into the table, as a new row, column-by-column, in the pre-defined order. Instead, let's change the order and leave Price blank: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;INSERT INTO ANTIQUES (BUYERID, SELLERID, ITEM)&lt;br /&gt;VALUES (01, 21, 'Ottoman'); &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;br /&gt;Deleting Data&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Let's delete this new row back out of the database: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;DELETE FROM ANTIQUES&lt;br /&gt;WHERE ITEM = 'Ottoman'; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;But if there is another row that contains 'Ottoman', that row will be deleted also. Let's delete all rows (one, in this case) that contain the specific data we added before: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;DELETE FROM ANTIQUES&lt;br /&gt;WHERE ITEM = 'Ottoman' AND BUYERID = 01 AND SELLERID = 21; &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;br /&gt;Updating Data&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Let's update a Price into a row that doesn't have a price listed yet: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;UPDATE ANTIQUES SET PRICE = 500.00 WHERE ITEM = 'Chair'; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;This sets all Chair's Prices to 500.00. As shown above, more WHERE conditionals, using AND, must be used to limit the updating to more specific rows. Also, additional columns may be set by separating equal statements with commas. &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;br /&gt;Miscellaneous Topics&lt;br /&gt;&lt;br /&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;i&gt;Indexes&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Indexes allow a DBMS to access data quicker (&lt;i&gt;please note:&lt;/i&gt; this feature is nonstandard/not available on all systems). The system creates this internal data structure (the index) which causes selection of rows, when the selection is based on indexed columns, to occur faster. This index tells the DBMS where a certain row is in the table given an indexed-column value, much like a book index tells you what page a given word appears. Let's create an index for the OwnerID in the AntiqueOwners table: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;CREATE INDEX OID_IDX ON ANTIQUEOWNERS (OWNERID); &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Now on the names: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;CREATE INDEX NAME_IDX ON ANTIQUEOWNERS (OWNERLASTNAME, OWNERFIRSTNAME); &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;To get rid of an index, drop it: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;DROP INDEX OID_IDX; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;By the way, you can also "drop" a table, as well (careful!--that means that your table is deleted). In the second example, the index is kept on the two columns, aggregated together--strange behavior might occur in this situation...check the manual before performing such an operation. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Some DBMS's do not enforce primary keys; in other words, the uniqueness of a column is not enforced automatically. What that means is, if, for example, I tried to insert another row into the AntiqueOwners table with an OwnerID of 02, some systems will allow me to do that, even though we do not, as that column is supposed to be unique to that table (every row value is supposed to be different). One way to get around that is to create a unique index on the column that we want to be a primary key, to force the system to enforce prohibition of duplicates: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;CREATE UNIQUE INDEX OID_IDX ON ANTIQUEOWNERS (OWNERID); &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;GROUP BY &amp;amp; HAVING&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;One special use of GROUP BY is to associate an aggregate function (especially COUNT; counting the number of rows in each group) with groups of rows. First, assume that the Antiques table has the Price column, and each row has a value for that column. We want to see the price of the most expensive item bought by each owner. We have to tell SQL to &lt;i&gt;group&lt;/i&gt; each owner's purchases, and tell us the maximum purchase price: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT BUYERID, MAX(PRICE)&lt;br /&gt;FROM ANTIQUES&lt;br /&gt;GROUP BY BUYERID; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Now, say we only want to see the maximum purchase price if the purchase is over $1000, so we use the HAVING clause: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT BUYERID, MAX(PRICE)&lt;br /&gt;FROM ANTIQUES&lt;br /&gt;GROUP BY BUYERID&lt;br /&gt;HAVING PRICE &gt; 1000;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;More Subqueries&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Another common usage of subqueries involves the use of operators to allow a Where condition to include the Select output of a subquery. First, list the buyers who purchased an expensive item (the Price of the item is $100 greater than the average price of all items purchased): &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT BUYERID&lt;br /&gt;FROM ANTIQUES&lt;br /&gt;WHERE PRICE &gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;(SELECT AVG(PRICE) + 100&lt;br /&gt;FROM ANTIQUES);&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;The subquery calculates the average Price, plus $100, and using that figure, an OwnerID is printed for every item costing over that figure. One could use DISTINCT BUYERID, to eliminate duplicates. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;List the Last Names of those in the AntiqueOwners table, ONLY if they have bought an item: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT OWNERLASTNAME&lt;br /&gt;FROM ANTIQUEOWNERS&lt;br /&gt;WHERE OWNERID IN &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;(SELECT DISTINCT BUYERID&lt;br /&gt;FROM ANTIQUES);&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;The subquery returns a list of buyers, and the Last Name is printed for an Antique Owner if and only if the Owner's ID appears in the subquery list (sometimes called a &lt;i&gt;candidate list&lt;/i&gt;). &lt;i&gt;Note:&lt;/i&gt; on some DBMS's, equals can be used instead of IN, but for clarity's sake, since a set is returned from the subquery, IN is the better choice. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;For an Update example, we know that the gentleman who bought the bookcase has the wrong First Name in the database...it should be John: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;UPDATE ANTIQUEOWNERS&lt;br /&gt;SET OWNERFIRSTNAME = 'John'&lt;br /&gt;WHERE OWNERID = &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;(SELECT BUYERID&lt;br /&gt;FROM ANTIQUES&lt;br /&gt;WHERE ITEM = 'Bookcase');&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;First, the subquery finds the BuyerID for the person(s) who bought the Bookcase, then the outer query updates his First Name.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;Remember this rule about subqueries:&lt;/b&gt; when you have a subquery as part of a WHERE condition, the Select clause in the subquery must have columns that match in number and type to those in the Where clause of the outer query. In other words, if you have "WHERE ColumnName = (SELECT...);", the Select must have only one column in it, to match the ColumnName in the outer Where clause, &lt;i&gt;and&lt;/i&gt; they must match in type (both being integers, both being character strings, etc.). &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;EXISTS &amp;amp; ALL&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;EXISTS uses a subquery as a condition, where the condition is True if the subquery returns any rows, and False if the subquery does not return any rows; this is a nonintuitive feature with few unique uses. However, if a prospective customer wanted to see the list of Owners only if the shop dealt in Chairs, try: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT OWNERFIRSTNAME, OWNERLASTNAME&lt;br /&gt;FROM ANTIQUEOWNERS&lt;br /&gt;WHERE EXISTS &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;(SELECT *&lt;br /&gt;FROM ANTIQUES&lt;br /&gt;WHERE ITEM = 'Chair');&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;If there are any Chairs in the Antiques column, the subquery would return a row or rows, making the EXISTS clause true, causing SQL to list the Antique Owners. If there had been no Chairs, no rows would have been returned by the outside query. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;ALL is another unusual feature, as ALL queries can usually be done with different, and possibly simpler methods; let's take a look at an example query: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT BUYERID, ITEM&lt;br /&gt;FROM ANTIQUES&lt;br /&gt;WHERE PRICE &gt;= ALL &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;(SELECT PRICE&lt;br /&gt;FROM ANTIQUES);&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;This will return the largest priced item (or more than one item if there is a tie), and its buyer. The subquery returns a list of all Prices in the Antiques table, and the outer query goes through each row of the Antiques table, and if its Price is greater than or equal to every (or ALL) Prices in the list, it is listed, giving the highest priced Item. The reason "=" must be used is that the highest priced item will be equal to the highest price on the list, because this Item is in the Price list. &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;UNION &amp;amp; Outer Joins (briefly explained)&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;There are occasions where you might want to see the results of multiple queries together, combining their output; use UNION. To merge the output of the following two queries, displaying the ID's of all Buyers, plus all those who have an Order placed: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT BUYERID&lt;br /&gt;FROM ANTIQUES&lt;br /&gt;UNION&lt;br /&gt;SELECT OWNERID&lt;br /&gt;FROM ORDERS; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Notice that SQL requires that the Select list (of columns) must match, column-by-column, in data type. In this case BuyerID and OwnerID are of the same data type (integer). Also notice that SQL does automatic duplicate elimination when using UNION (as if they were two "sets"); in single queries, you have to use DISTINCT. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;The &lt;i&gt;outer join&lt;/i&gt; is used when a join query is "united" with the rows not included in the join, and are especially useful if constant text "flags" are included. First, look at the query: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT OWNERID, 'is in both Orders &amp;amp; Antiques'&lt;br /&gt;FROM ORDERS, ANTIQUES&lt;br /&gt;WHERE OWNERID = BUYERID&lt;br /&gt;UNION&lt;br /&gt;SELECT BUYERID, 'is in Antiques only'&lt;br /&gt;FROM ANTIQUES&lt;br /&gt;WHERE BUYERID NOT IN &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;(SELECT OWNERID&lt;br /&gt;FROM ORDERS);&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;The first query does a join to list any owners who are in both tables, and putting a tag line after the ID repeating the quote. The UNION merges this list with the next list. The second list is generated by first listing those ID's not in the Orders table, thus generating a list of ID's excluded from the join query. Then, each row in the Antiques table is scanned, and if the BuyerID is not in this exclusion list, it is listed with its quoted tag. There might be an easier way to make this list, but it's difficult to generate the informational quoted strings of text. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;This concept is useful in situations where a primary key is related to a foreign key, but the foreign key value for some primary keys is NULL. For example, in one table, the primary key is a salesperson, and in another table is customers, with their salesperson listed in the same row. However, if a salesperson has no customers, that person's name won't appear in the customer table. The outer join is used if the listing of &lt;b&gt;all&lt;/b&gt; salespersons is to be printed, listed with their customers, whether the salesperson has a customer or not--that is, no customer is printed (a logical NULL value) if the salesperson has no customers, but is in the salespersons table. Otherwise, the salesperson will be listed with each customer. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Another important related point about Nulls having to do with joins: the order of tables listed in the From clause is very important. The rule states that SQL "adds" the second table to the first; the first table listed has any rows where there is a null on the join column displayed; if the second table has a row with a null on the join column, that row from the table listed second does not get joined, and thus included with the first table's row data. This is another occasion (should you wish that data included in the result) where an outer join is commonly used. The concept of nulls is important, and it may be worth your time to investigate them further. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;ENOUGH QUERIES!!! you say?...now on to something completely different... &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;Embedded SQL--an ugly example (do not write a program like this...for purposes of argument ONLY)&lt;/i&gt;&lt;/b&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;/* -To get right to it, here is an example program that uses Embedded&lt;br /&gt;  SQL. Embedded SQL allows programmers to connect to a database and&lt;br /&gt;  include SQL code right in the program, so that their programs can&lt;br /&gt;  use, manipulate, and process data from a database.&lt;br /&gt; -This example C Program (using Embedded SQL) will print a report.&lt;br /&gt; -This program will have to be precompiled for the SQL statements,&lt;br /&gt;  before regular compilation.&lt;br /&gt; -The EXEC SQL parts are the same (standard), but the surrounding C&lt;br /&gt;  code will need to be changed, including the host variable&lt;br /&gt;  declarations, if you are using a different language.&lt;br /&gt; -Embedded SQL changes from system to system, so, once again, check&lt;br /&gt;  local documentation, especially variable declarations and logging&lt;br /&gt;  in procedures, in which network, DBMS, and operating system&lt;br /&gt;  considerations are crucial. */ &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;/************************************************/&lt;br /&gt;/* THIS PROGRAM IS NOT COMPILABLE OR EXECUTABLE */&lt;br /&gt;/* IT IS FOR EXAMPLE PURPOSES ONLY              */&lt;br /&gt;/************************************************/ &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;#include &lt;stdio.h&gt;&lt;/stdio.h&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;/* This section declares the host variables; these will be the&lt;br /&gt; variables your program uses, but also the variable SQL will put&lt;br /&gt; values in or take values out. */&lt;br /&gt;EXEC SQL BEGIN DECLARE SECTION;&lt;br /&gt;int BuyerID;&lt;br /&gt;char FirstName[100], LastName[100], Item[100];&lt;br /&gt;EXEC SQL END DECLARE SECTION; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;/* This includes the SQLCA variable, so that some error checking can be done. */&lt;br /&gt;EXEC SQL INCLUDE SQLCA; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;main() { &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;/* This is a possible way to log into the database */&lt;br /&gt;EXEC SQL CONNECT UserID/Password; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;/* This code either says that you are connected or checks if an error&lt;br /&gt; code was generated, meaning log in was incorrect or not possible. */&lt;br /&gt;if(sqlca.sqlcode) {&lt;br /&gt;  printf(Printer, "Error connecting to database server.\n");&lt;br /&gt;  exit();&lt;br /&gt;}&lt;br /&gt;printf("Connected to database server.\n"); &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;/* This declares a "Cursor". This is used when a query returns more&lt;br /&gt; than one row, and an operation is to be performed on each row&lt;br /&gt; resulting from the query. With each row established by this query,&lt;br /&gt; I'm going to use it in the report. Later, "Fetch" will be used to&lt;br /&gt; pick off each row, one at a time, but for the query to actually&lt;br /&gt; be executed, the "Open" statement is used. The "Declare" just&lt;br /&gt; establishes the query. */&lt;br /&gt;EXEC SQL DECLARE ItemCursor CURSOR FOR&lt;br /&gt;SELECT ITEM, BUYERID&lt;br /&gt;FROM ANTIQUES&lt;br /&gt;ORDER BY ITEM;&lt;br /&gt;EXEC SQL OPEN ItemCursor; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;/* +-- You may wish to put a similar error checking block here --+ */ &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;/* Fetch puts the values of the "next" row of the query in the host&lt;br /&gt; variables, respectively. However, a "priming fetch" (programming&lt;br /&gt; technique) must first be done. When the cursor is out of data, a&lt;br /&gt; sqlcode will be generated allowing us to leave the loop. Notice&lt;br /&gt; that, for simplicity's sake, the loop will leave on any sqlcode,&lt;br /&gt; even if it is an error code. Otherwise, specific code checking must&lt;br /&gt; be performed. */&lt;br /&gt;EXEC SQL FETCH ItemCursor INTO :Item, :BuyerID;&lt;br /&gt;while(!sqlca.sqlcode) { &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;/* With each row, we will also do a couple of things. First, bump the&lt;br /&gt; price up by $5 (dealer's fee) and get the buyer's name to put in&lt;br /&gt; the report. To do this, I'll use an Update and a Select, before&lt;br /&gt; printing the line on the screen. The update assumes however, that&lt;br /&gt; a given buyer has only bought one of any given item, or else the&lt;br /&gt; price will be increased too many times. Otherwise, a "RowID" logic&lt;br /&gt; would have to be used (see documentation). Also notice the colon&lt;br /&gt; before host variable names when used inside of SQL statements. */ &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;EXEC SQL UPDATE ANTIQUES&lt;br /&gt;SET PRICE = PRICE + 5&lt;br /&gt;WHERE ITEM = :Item AND BUYERID = :BuyerID; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;EXEC SQL SELECT OWNERFIRSTNAME, OWNERLASTNAME&lt;br /&gt;INTO :FirstName, :LastName&lt;br /&gt;FROM ANTIQUEOWNERS&lt;br /&gt;WHERE BUYERID = :BuyerID; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;    printf("%25s %25s %25s", FirstName, LastName, Item); &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;/* Ugly report--for example purposes only! Get the next row. */&lt;br /&gt;EXEC SQL FETCH ItemCursor INTO :Item, :BuyerID;&lt;br /&gt;} &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;/* Close the cursor, commit the changes (see below), and exit the&lt;br /&gt; program. */&lt;br /&gt;EXEC SQL CLOSE ItemCursor;&lt;br /&gt;EXEC SQL COMMIT RELEASE;&lt;br /&gt;exit();&lt;br /&gt;} &lt;/div&gt;  &lt;div style="font-family: times new roman;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;Common SQL Questions &amp;amp; Advanced Topics&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt; &lt;/div&gt;  &lt;ol style="font-family: times new roman;" start="1" type="1"&gt;&lt;li&gt;Why can't I just ask for the first three rows in a table? --Because in relational databases, rows are inserted in no particular order, that is, the system inserts them in an arbitrary order; so, you can only request rows using valid SQL features, like ORDER BY, etc. &lt;/li&gt;&lt;li&gt;What is this DDL and DML I hear about? --DDL (Data Definition Language) refers to (in SQL) the Create Table statement...DML (Data Manipulation Language) refers to the Select, Update, Insert, and Delete statements. Also, QML, referring to Select statements, stands for Query Manipulation Language. &lt;/li&gt;&lt;li&gt;Aren't database tables just files? --Well, DBMS's store data in files declared by system managers before new tables are created (on large systems), but the system stores the data in a special format, and may spread data from one table over several files. In the database world, a set of files created for a database is called a &lt;i&gt;tablespace&lt;/i&gt;. In general, on small systems,      everything about a database (definitions and all table data) is kept in      one file. &lt;/li&gt;&lt;li&gt;(Related question) Aren't database tables just like spreadsheets? --No, for two reasons. First, spreadsheets can have data in a cell, but a cell is more than just a row-column-intersection. Depending on your spreadsheet software, a cell might also contain formulas and formatting, which database tables cannot have (currently). Secondly, spreadsheet cells are often dependent on the data in other cells. In databases, "cells" are independent, except that columns are logically related (hopefully; together a row of columns describe an entity), and, other than primary key and foreign key constraints, each row in a table is independent from one another. &lt;/li&gt;&lt;li&gt;How do I import a text file of data into a database? --Well, you can't do it directly...you must use a utility, such as Oracle's SQL*Loader, or write a program to load the data into the database. A program to do this would simply go through each record of a text file, break it up into columns, and do an Insert into the database. &lt;/li&gt;&lt;li&gt;What web sites and computer books would you recommend for more information about SQL and databases? --First, look at the sites at the bottom of this page. I would especially suggest the following: &lt;a href="http://www.compapp.dcu.ie/databases/f017.html" _fcksavedurl="http://www.compapp.dcu.ie/databases/f017.html"&gt;DB Ingredients&lt;/a&gt;      (more theorical topics), &lt;a href="http://www-ccs.cs.umass.edu/db.html" _fcksavedurl="http://www-ccs.cs.umass.edu/db.html"&gt;DBMS      Lab/Links&lt;/a&gt; (comprehensive academic DBMS link listing), &lt;a href="http://www.muppetlabs.com/library/tech/tutorials.html" _fcksavedurl="http://www.muppetlabs.com/library/tech/tutorials.html"&gt;Tutorial Page&lt;/a&gt;      (listing of other tutorials), and &lt;a href="http://www.let.rug.nl/%7Es0367672/pm_int_e.htm" _fcksavedurl="http://www.let.rug.nl/%7Es0367672/pm_int_e.htm"&gt;miniSQL&lt;/a&gt; (more      information about the best known free DBMS). &lt;/li&gt;&lt;/ol&gt;  &lt;div style="font-family: times new roman;"&gt;Also, if you wish to practice SQL on an interactive site (using Java technologies), I highly recommend Frank Torres' site at &lt;a href="http://sqlcourse.com/" _fcksavedurl="http://sqlcourse.com/"&gt;http://sqlcourse.com&lt;/a&gt; and its new sequel (so to speak) site at &lt;a href="http://sqlcourse2.com/" _fcksavedurl="http://sqlcourse2.com/"&gt;http://sqlcourse2.com&lt;/a&gt;. Frank did an outstanding job with his site, and if you have a recent release browser, it's definitely worth a visit. In addition, point your browser to &lt;a href="http://www.topica.com/" _fcksavedurl="http://www.topica.com/"&gt;http://www.topica.com/&lt;/a&gt;, and subscribe to their SQL e-mail Tips of the Day...they are outstanding; Tim Quinlan goes into topics that I can't even begin to go into here, such index data structures (B-trees and B+-trees) and join algorithms, so advanced IT RDBMS pros will get a daily insight into these data management tools. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Unfortunately, there is not a great deal of information on the web about SQL; the list I have below is fairly comprehensive (definitely representative). As far as books are concerned, I would suggest (for beginners to intermediate-level) "Oracle: The Complete Reference" (multiple versions) from Oracle and "Understanding SQL" from Sybex for general SQL information. Also, I would recommend O'Reilly Publishing's books, and Joe Celko's writings for advanced users. For specific DBMS info (especially in the Access area), I recommend Que's "Using" series, and the books of Alison Balter. &lt;/div&gt;  &lt;ol style="font-family: times new roman;" start="7" type="1"&gt;&lt;li&gt;What is a &lt;i&gt;schema&lt;/i&gt;? --A schema is a logical set of tables, such as the Antiques database above...usually, it is thought of as simply "the database", but a database can hold more than one schema. For example, a &lt;i&gt;star schema&lt;/i&gt; is a set of tables where one large, central table holds all of the important information, and is linked, via foreign keys, to &lt;i&gt;dimension&lt;/i&gt;      tables which hold detail information, and can be used in a join to create      detailed reports. &lt;/li&gt;&lt;li&gt;I understand that Oracle offers a special keyword, Decode, that allows for some "if-then" logic. How does that work? -- Technically, Decode allows for conditional output based on the value of a column or function. The syntax looks like this (from the Oracle: Complete Reference series): &lt;/li&gt;&lt;/ol&gt;  &lt;div style="font-family: times new roman;"&gt;Select ...DECODE (Value, If1, Then1, [If 2, Then 2, ...,] Else) ...From ...; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;The Value is the name of a column, or a function (conceivably based on a column or columns), and for each If included in the statement, the corresponding Then clause is the output if the condition is true. If none of the conditions are true, then the Else value is output. Let's look at an example: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Select Distinct City,&lt;br /&gt;DECODE (City, 'Cincinnati', 'Queen City', 'New York', 'Big Apple', 'Chicago',&lt;br /&gt;'City of Broad Shoulders', City) AS Nickname&lt;br /&gt;From Cities; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;The output might look like this: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;City         Nickname&lt;br /&gt;------------ ------------------------------&lt;br /&gt;Boston       Boston&lt;br /&gt;Cincinnati   Queen City&lt;br /&gt;Cleveland    Cleveland&lt;span&gt;&lt;br /&gt;New York     Big Apple&lt;/span&gt; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;'City' in the first argument denotes the column name used for the test. The second, fourth, etc. arguments are the individual equality tests (taken in the order given) against each value in the City column. The third, fifth, etc. arguments are the corresponding outputs if the corresponding test is true. The final parameter is the default output if none of the tests are true; in this case, just print out the column value. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;TIP: If you want nothing to be output for a given condition, such as the default "Else" value, enter the value Null for that value, such as: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Select Distinct City,&lt;br /&gt;DECODE (City, 'Cincinnati', 'Queen City', 'New York', 'Big Apple', 'Chicago',&lt;br /&gt;'City of Broad Shoulders', Null) AS Nickname&lt;br /&gt;From Cities; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;If the City column value is not one of the ones mentioned, nothing is outputted, rather than the city name itself. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;City         Nickname&lt;br /&gt;------------ ----------&lt;br /&gt;Boston&lt;br /&gt;Cincinnati   Queen City&lt;br /&gt;Cleveland&lt;br /&gt;New   York     Big Apple&lt;br /&gt;&lt;/div&gt;  &lt;ol style="font-family: times new roman;" start="9" type="1"&gt;&lt;li&gt;You mentioned Referential Integrity before, but what does that have to do with this concept I've heard about, Cascading Updates and Deletes? --This is a difficult topic to talk about, because it's covered differently in different DBMS's. &lt;/li&gt;&lt;/ol&gt;  &lt;div style="font-family: times new roman;"&gt;For example, Microsoft SQL Server (7.0 &amp;amp; below) requires that you write "triggers" (see the Yahoo SQL Club link to find links that discuss this topic--I may include that topic in a future version of this page) to implement this. (A quick definition, though; a Trigger is a SQL statement stored in the database that allows you to perform a given query [usually an "Action" Query--Delete, Insert, Update] automatically, when a specified event occurs in the database, such as a column update, but anyway...) Microsoft Access (believe it or not) will perform this if you define it in the Relationships screen, but it will still burden you with a prompt. Oracle does this automatically, if you specify a special "Constraint" (see reference at bottom for definition, not syntax) on the keyed column. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;So, I'll just discuss the concept. First, see the discussion above on Primary and Foreign keys. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Concept: If a row from the primary key column is deleted/updated, if "Cascading" is activated, the value of the foreign key in those other tables will be deleted (the whole row)/updated. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;The reverse, a foreign key deletion/update causing a primary key value to be deleted/changed, may or may not occur: the constraint or trigger may not be defined, a "one-to-many" relationship may exist, the update might be to another existing primary key value, or the DBMS itself may or may not have rules governing this. As usual, see your DBMS's documentation. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;For example, if you set up the AntiqueOwners table to have a Primary Key, OwnerID, and you set up the database to delete rows on the Foreign Key, SellerID, in the Antiques table, on a primary key deletion, then if you deleted the AntiqueOwners row with OwnerID of '01', then the rows in Antiques, with the Item values, Bed, Cabinet, and Jewelry Box ('01' sold them), will all be deleted. Of course, assuming the proper DB definition, if you just updated '01' to another value, those Seller ID values would be updated to that new value too. &lt;/div&gt;  &lt;ol style="font-family: times new roman;" start="10" type="1"&gt;&lt;li&gt;Show me an example of an &lt;i&gt;outer      join.&lt;/i&gt; --Well, from the questions I receive, this is an extremely common example, and I'll show you both the Oracle and Access queries... &lt;/li&gt;&lt;/ol&gt;  &lt;div style="font-family: times new roman;"&gt;Think of the following Employee table (the employees are given numbers, for simplicity): &lt;/div&gt;  &lt;table style="font-family: times new roman;" border="1" cellpadding="0"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td&gt;   &lt;div&gt;Name&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Department&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;1&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;10&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;2&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;10&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;3&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;20&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;4&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;30&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;5&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;30&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;br /&gt;Now think of a department table:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;table style="font-family: times new roman;" border="1" cellpadding="0"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td&gt;   &lt;div&gt;Department&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;10&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;20&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;30&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;40&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;br /&gt;Now suppose you want to join the tables, seeing all of the employees and all of the departments together...you'll have to use an outer join which includes a null employee to go with Dept. 40. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;In the book, "Oracle 7: the Complete Reference", about outer joins, "think of the (+), which must immediately follow the join column of the table, as saying add an extra (null) row anytime there's no match". So, in Oracle, try this query (the + goes on Employee, which adds the null row on no match):&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Select E.Name, D.Department&lt;br /&gt;From Department D, Employee E&lt;br /&gt;Where E.Department(+) = D.Department; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;This is a left (outer) join, in Access: &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT DISTINCTROW Employee.Name, Department.Department&lt;br /&gt;FROM Department LEFT JOIN Employee ON Department.Department = Employee.Department; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;br /&gt;And you get this result:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;table style="font-family: times new roman;" border="1" cellpadding="0"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td&gt;   &lt;div&gt;Name&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Department&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;1&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;10&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;2&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;10&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;3&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;20&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;4&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;30&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;5&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;30&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt; &lt;/div&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td&gt;   &lt;div&gt;40&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;ol style="font-family: times new roman;" start="11" type="1"&gt;&lt;li&gt;What are some general tips you      would give to make my SQL queries and databases better and faster (&lt;i&gt;optimized&lt;/i&gt;)?      &lt;/li&gt;&lt;ul type="circle"&gt;&lt;li&gt;You should try, if you       can, to avoid expressions in Selects, such as SELECT ColumnA + ColumnB,       etc. The &lt;i&gt;query optimizer&lt;/i&gt; of the database, the portion of the DBMS that determines the best way to get the required data out of the database itself, handles expressions in such a way that would normally require more time to retrieve the data than if columns were normally selected, and the expression itself handled programmatically. &lt;/li&gt;&lt;li&gt;Minimize the number of       columns included in a Group By clause. &lt;/li&gt;&lt;li&gt;If you are using a       join, try to have the columns joined on (from both tables) indexed. &lt;/li&gt;&lt;li&gt;When in doubt, index. &lt;/li&gt;&lt;li&gt;Unless doing multiple counts or a complex query, use COUNT(*) (the number of rows generated by the query) rather than COUNT(Column_Name). &lt;/li&gt;&lt;/ul&gt;&lt;li&gt;What is a Cartesian product? --Simply, it is a join without a Where clause. It gives you every row in the first table, joined with every row in the second table. This is best shown by example: &lt;/li&gt;&lt;/ol&gt;  &lt;div style="font-family: times new roman;"&gt;SELECT *&lt;br /&gt;FROM AntiqueOwners, Orders; &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;This gives:&lt;br /&gt;&lt;/div&gt;  &lt;table style="width: 506px; height: 587px; font-family: times new roman;" border="1" cellpadding="0"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;AntiqueOwners.&lt;/b&gt;&lt;br /&gt;&lt;b&gt;OwnerID&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;AntiqueOwners.&lt;/b&gt;&lt;br /&gt;&lt;b&gt;OwnerLastName&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;AntiqueOwners.&lt;/b&gt;&lt;br /&gt;&lt;b&gt;OwnerFirstName&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;Orders.&lt;/b&gt;&lt;br /&gt;&lt;b&gt;OwnerID&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;&lt;b&gt;Orders.&lt;/b&gt;&lt;br /&gt;&lt;b&gt;ItemDesired&lt;/b&gt;&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;01&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Jones&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Bill&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Table&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;01&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Jones&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Bill&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Desk&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;01&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Jones&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Bill&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;21&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Chair&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;01&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Jones&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Bill&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;15&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Mirror&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Smith&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Bob&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Table&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Smith&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Bob&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Desk&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Smith&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Bob&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;21&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Chair&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Smith&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Bob&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;15&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Mirror&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;15&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Lawson&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Patricia&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Table&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;15&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Lawson&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Patricia&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Desk&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;15&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Lawson&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Patricia&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;21&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Chair&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;15&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Lawson&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Patricia&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;15&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Mirror&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;21&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Akins&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Jane&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Table&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;21&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Akins&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Jane&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Desk&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;21&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Akins&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Jane&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;21&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Chair&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;21&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Akins&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Jane&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;15&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Mirror&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;50&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Fowler&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Sam&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Table&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;50&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Fowler&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Sam&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;02&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Desk&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;50&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Fowler&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Sam&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;21&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Chair&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td&gt;   &lt;div&gt;50&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Fowler&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Sam&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;15&lt;/div&gt;   &lt;/td&gt;   &lt;td&gt;   &lt;div&gt;Mirror&lt;/div&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;br /&gt;The number of rows in the result has the number of rows in the first table times the number of rows in the second table, and is sometimes called a Cross-Join. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;If you think about it, you can see how joins work. Look at the Cartesian product results, then look for rows where the OwnerID's are equal, and the result is what you would get on an equijoin.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Of course, this is not how DBMS's actually perform joins because loading this result can take too much memory; instead, comparisons are performed in nested loops, or by comparing values in indexes, and then loading result rows. &lt;/div&gt;  &lt;ol style="font-family: times new roman;" start="13" type="1"&gt;&lt;li&gt;What is &lt;i&gt;normalization&lt;/i&gt;? --Normalization is a technique of database design that suggests that certain criteria be used when constructing a table layout (deciding what columns each table will have, and creating the key structure), where the idea is to eliminate redundancy of non-key data across tables. Normalization is usually referred to in terms of &lt;i&gt;forms&lt;/i&gt;, and I will introduce only the first three, even though it is somewhat common to use other, more advanced forms (fourth, fifth, Boyce-Codd; see documentation). &lt;/li&gt;&lt;/ol&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;i&gt;First Normal Form&lt;/i&gt; refers to moving data into separate tables where the data in each table is of a similar type, and by giving each table a primary key. &lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Putting data in &lt;i&gt;Second Normal Form&lt;/i&gt; involves removing to other tables data that is only dependent of a part of the key. For example, if I had left the names of the Antique Owners in the items table, that would not be in Second Normal Form because that data would be redundant; the name would be repeated for each item owned; as such, the names were placed in their own table. The names themselves don't have anything to do with the items, only the identities of the buyers and sellers.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;&lt;i&gt;Third Normal Form&lt;/i&gt; involves getting rid of anything in the tables that doesn't depend solely on the primary key. Only include information that is dependent on the key, and move off data to other tables that are independent of the primary key, and create a primary key for the new tables.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;There is some redundancy to each form, and if data is in &lt;i&gt;3NF &lt;/i&gt;(shorthand for 3rd normal form), it is already in &lt;i&gt;1NF &lt;/i&gt;and &lt;i&gt;2NF&lt;/i&gt;. In terms of data design then, arrange data so that any non-primary key columns are dependent only on the &lt;i&gt;whole primary key&lt;/i&gt;. If you take a look at the sample database, you will see that the way then to navigate through the database is through joins using common key columns.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div style="font-family: times new roman;"&gt;Two other important points in database design are using good, consistent, logical, full-word names for the tables and columns, and the use of full words in the database itself. On the last point, my database is lacking, as I use numeric codes for identification. It is usually best, if possible, to come up with keys that are, by themselves, self-explanatory; for example, a better key would be the first four letters of the last name and first initial of the owner, like JONEB for Bill Jones (or for tiebreaking purposes, add numbers to the end to differentiate two or more people with similar names, so you could try JONEB1, JONEB2, etc.). &lt;/div&gt;  &lt;ol style="font-family: times new roman;" start="14" type="1"&gt;&lt;li&gt;What is the difference      between a &lt;i&gt;single-row query&lt;/i&gt; and a &lt;i&gt;multiple-row query&lt;/i&gt; and why is it important to know the difference? --First, to cover the obvious, a single-row query is a query that returns one row as its result, and a multiple-row query is a query that returns more than one row as its result. Whether a query returns one row or more than one row is entirely dependent on the design (or &lt;i&gt;schema&lt;/i&gt;) of the tables of the database. As query-writer, you must be aware of the schema, be sure to include enough conditions, and structure your SQL statement properly, so that you will get the desired result (either one row or multiple rows). For example, if you wanted to be sure that a query of the AntiqueOwners table returned only one row, consider an equal condition of the primary key column, OwnerID. &lt;/li&gt;&lt;/ol&gt;  &lt;div style="font-family: times new roman;"&gt;Three reasons immediately come to mind as to why this is important. First, getting multiple rows when you were expecting only one, or vice-versa, may mean that the query is erroneous, that the database is incomplete, or simply, you learned something new about your data. Second, if you are using an update or delete statement, you had better be sure that the statement that you write performs the operation on the desired row (or rows)...or else, you might be deleting or updating more rows than you intend. Third, any queries written in Embedded SQL must be carefully thought out as to the number of rows returned. If you write a single-row query, only one SQL statement may need to be performed to complete the programming logic required. If your query, on the other hand, returns multiple rows, you will have to use the Fetch statement, and quite probably, some sort of looping structure in your program will be required to iterate processing on each returned row of the query. &lt;/div&gt;  &lt;ol style="font-family: times new roman;" start="15" type="1"&gt;&lt;li&gt;Tell me about a simple approach to relational database design. --This was sent to me via a news posting; it was submitted by John Frame and Richard Freedman; I offer a shortened version as advice, but I'm not responsible for it, and some of the concepts are readdressed in the next question... &lt;/li&gt;&lt;/ol&gt;  &lt;div style="font-family: times new roman;"&gt;First, create a list of important things (entities) and include those things you may not initially believe is important. Second, draw a line between any two entities that have any connection whatsoever; except that no two entities can connect without a 'rule'; e.g.: families have children, employees work for a department. Therefore put the 'connection' in a diamond, the 'entities' in squares. Third, your picture should now have many squares (entities) connected to other entities through diamonds (a square enclosing an entity, with a line to a diamond describing the relationship, and then another line to the other entity). Fourth, put descriptors on each square and each diamond, such as customer -- airline -- trip. Fifth, give each diamond and square any attributes it may have (a person has a name, an invoice has a number), but some relationships have none (a parent just owns a child). Sixth, everything on your page that has attributes is now a table, whenever two entities have a relationship where the relationship has no attributes, there is merely a foreign key between the tables. Seventh, in general you want to make tables not repeat data. So, if a customer has a name and several addresses, you can see that for every address of a customer, there will be repeated the customer's first name, last name, etc. So, record Name in one table, and put all his addresses in another. Eighth, each row (record) should be unique from every other one; Mr. Freedman suggests a 'auto-increment number' primary key, wh
