<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ASP.NET Debugging : Linq</title><link>http://blogs.msdn.com/tom/archive/tags/Linq/default.aspx</link><description>Tags: Linq</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>ASP.NET Troubleshooting</title><link>http://blogs.msdn.com/tom/archive/2009/03/24/asp-net-troubleshooting.aspx</link><pubDate>Tue, 24 Mar 2009 19:31:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9504630</guid><dc:creator>Tom</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/tom/comments/9504630.aspx</comments><wfw:commentRss>http://blogs.msdn.com/tom/commentrss.aspx?PostID=9504630</wfw:commentRss><wfw:comment>http://blogs.msdn.com/tom/rsscomments.aspx?PostID=9504630</wfw:comment><description>&lt;p&gt;So with how long ASP.NET has been out for now, I am really curious to know how people go about tracking down issues in their project.&lt;/p&gt;  &lt;p&gt;I’d like to know things like:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;How do you know there is a problem&lt;/li&gt;    &lt;li&gt;What tools do you use to confirm that the problem really is a problem&lt;/li&gt;    &lt;li&gt;How do you gather data about the problem&lt;/li&gt;    &lt;li&gt;How do you determine if the problem is your code or something else (like the network, hard drive failure, etc)&lt;/li&gt;    &lt;li&gt;If the problem is your code, how do you ensure your fix resolves the problem (how do you test the fix)&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;If there are any others, I’d also like to hear them.&lt;/p&gt;  &lt;p&gt;Also, if you do anything in the Cloud now, I’d love to hear how you troubleshoot that.&amp;#160; And it can be from any cloud service provider.&lt;/p&gt;  &lt;p&gt;And have any of these things changed with some of the new ways to program that have come out.&amp;#160; For example, AJAX, MVC, Silverlight, IE8, jQuery, etc.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9504630" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/tom/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://blogs.msdn.com/tom/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://blogs.msdn.com/tom/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.msdn.com/tom/archive/tags/IE8/default.aspx">IE8</category><category domain="http://blogs.msdn.com/tom/archive/tags/MVC/default.aspx">MVC</category><category domain="http://blogs.msdn.com/tom/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Linq/default.aspx">Linq</category><category domain="http://blogs.msdn.com/tom/archive/tags/jQuery/default.aspx">jQuery</category></item><item><title>Linq exception</title><link>http://blogs.msdn.com/tom/archive/2009/02/25/linq-exception.aspx</link><pubDate>Wed, 25 Feb 2009 18:44:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9444215</guid><dc:creator>Tom</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/tom/comments/9444215.aspx</comments><wfw:commentRss>http://blogs.msdn.com/tom/commentrss.aspx?PostID=9444215</wfw:commentRss><wfw:comment>http://blogs.msdn.com/tom/rsscomments.aspx?PostID=9444215</wfw:comment><description>&lt;p&gt;If you have done much programming with Linq and using the relationships between tables, you may come across the following exception:&lt;/p&gt;  &lt;pre&gt;System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException&lt;br /&gt;Operation is not valid due to the current state of the object.&lt;/pre&gt;

&lt;p&gt;This is basically telling you that you have a Relationship between two tables and you are trying to update the link to point to something else.&lt;/p&gt;

&lt;p&gt;In my case, I had something like:&lt;/p&gt;

&lt;p&gt;Table1&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;ID
    &lt;br /&gt;nvarchar&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Table2&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;ID
    &lt;br /&gt;Table1ID&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And I was setting Table1ID, which maps to Table1’s ID to 0.&amp;#160; So if you want to delete an entry, just remove the row in Table1 and Table2 will be updated with the delete.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9444215" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/tom/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Exceptions/default.aspx">Exceptions</category><category domain="http://blogs.msdn.com/tom/archive/tags/Linq/default.aspx">Linq</category></item><item><title>Linq features to make smaller code</title><link>http://blogs.msdn.com/tom/archive/2008/12/12/linq-features-to-make-smaller-code.aspx</link><pubDate>Fri, 12 Dec 2008 17:50:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9202359</guid><dc:creator>Tom</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/tom/comments/9202359.aspx</comments><wfw:commentRss>http://blogs.msdn.com/tom/commentrss.aspx?PostID=9202359</wfw:commentRss><wfw:comment>http://blogs.msdn.com/tom/rsscomments.aspx?PostID=9202359</wfw:comment><description>&lt;p&gt;I have been working on some code that involves using Linq to query a database and came across something that I thought was really useful.&amp;#160; So here is the situation:&lt;/p&gt;  &lt;p&gt;We have a query that we want to be able to sort in multiple ways.&amp;#160; This will allow the user to click on columns and sort by it.&amp;#160; That kind of thing.&amp;#160; The first way that I did this was to do something like the following:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (sortmethod.CompareTo(&lt;span class="str"&gt;&amp;quot;date&amp;quot;&lt;/span&gt;) == 0)
{
    var c = from p &lt;span class="kwrd"&gt;in&lt;/span&gt; db.ProductSales
            from t &lt;span class="kwrd"&gt;in&lt;/span&gt; db.Products
           &lt;span class="kwrd"&gt;where&lt;/span&gt; (t.Id == p.ProductId)
           group t by t into g
           orderby g.Count() descending
           select g;
} &lt;span class="kwrd"&gt;else&lt;/span&gt; {
    var c = from p &lt;span class="kwrd"&gt;in&lt;/span&gt; db.ProductSales
            from t &lt;span class="kwrd"&gt;in&lt;/span&gt; db.Products
           &lt;span class="kwrd"&gt;where&lt;/span&gt; (t.Id == p.ProductId)
           group t by t into g
           orderby g.Key
           select g;
}&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;This can get very long if you have multiple things that someone can sort by.&amp;#160; So after doing some digging around, I found an alternative way that you can do this which is much shorter and much easier to follow:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;var c = from p &lt;span class="kwrd"&gt;in&lt;/span&gt; db.ProductSales
            from t &lt;span class="kwrd"&gt;in&lt;/span&gt; db.Products
            &lt;span class="kwrd"&gt;where&lt;/span&gt; (t.Id == p.ProductId)
            group t by t into g
            select g;

&lt;span class="kwrd"&gt;switch&lt;/span&gt; (sortmethod)
{
    &lt;span class="kwrd"&gt;case&lt;/span&gt; &lt;span class="str"&gt;&amp;quot;date&amp;quot;&lt;/span&gt;:
        c = c.OrderByDescending(g =&amp;gt; g.Count());
        &lt;span class="kwrd"&gt;break&lt;/span&gt;;
    &lt;span class="kwrd"&gt;default&lt;/span&gt;:
        c = c.OrderBy(g =&amp;gt; g.Key);
        &lt;span class="kwrd"&gt;break&lt;/span&gt;;
}&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;As you can see, this now allows us to just do the sorting based on what the user wants but the rest of the query doesn’t have to be redone.&amp;#160; This can save a lot of code and effort for development and testing.&amp;#160; Plus, you can imagine if there is a change to the database, in the first method, you would have to change the Linq query for each sort.&amp;#160; Where in the second method, you change it once and that is all.&lt;/p&gt;

&lt;p&gt;Hope this is useful and happy coding.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9202359" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/tom/archive/tags/Code/default.aspx">Code</category><category domain="http://blogs.msdn.com/tom/archive/tags/Linq/default.aspx">Linq</category></item><item><title>Linq – Do we need another way to access databases?</title><link>http://blogs.msdn.com/tom/archive/2008/10/20/linq-do-we-need-another-way-to-access-databases.aspx</link><pubDate>Mon, 20 Oct 2008 13:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9006790</guid><dc:creator>Tom</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/tom/comments/9006790.aspx</comments><wfw:commentRss>http://blogs.msdn.com/tom/commentrss.aspx?PostID=9006790</wfw:commentRss><wfw:comment>http://blogs.msdn.com/tom/rsscomments.aspx?PostID=9006790</wfw:comment><description>&lt;p&gt;This was the question that was burning on my mind when I first heard about Linq.&amp;#160; I was skeptical and didn’t think it was something that we needed.&amp;#160; But after having started to use this new language, I have quickly become a believer.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb308959.aspx"&gt;Linq&lt;/a&gt; stands for language-integrated query and that is exactly what it is, it allows for rich metadata, compile-time syntax checking, static typing and IntelliSense on things that used to be imperative code.&amp;#160; This is not only a huge win from the error perspective, but also from the ease of use one.&lt;/p&gt;  &lt;p&gt;For example, here is a sample query which includes populating an array to store the data:&lt;/p&gt;  &lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4"&gt;   &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;     &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&amp;#160;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt; app {&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;  &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Main() {&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] names = { &lt;span style="color: #006080"&gt;&amp;quot;Burke&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;Connor&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;Frank&amp;quot;&lt;/span&gt;, &lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;                       &lt;span style="color: #006080"&gt;&amp;quot;Everett&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;Albert&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;George&amp;quot;&lt;/span&gt;, &lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;                       &lt;span style="color: #006080"&gt;&amp;quot;Harris&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;David&amp;quot;&lt;/span&gt; };&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&amp;#160;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    IEnumerable&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt; query = from s &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; names &lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;                               &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; s.Length == 5&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;                               orderby s&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;                               select s.ToUpper();&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&amp;#160;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; item &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; query)&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;      Console.WriteLine(item);&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;  }&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;}&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;You can see where we query the data, you just simply do something like “&lt;strong&gt;from s in names where s.Length == 5 orderby s select s.ToUpper();&lt;/strong&gt;”&amp;#160; This clearly is close enough to SQL that anyone with experience with SQL programming will understand it and get used to doing this, but this means that if there is a typo, or any other problem in the query, you will find it at compile time.&lt;/p&gt;

&lt;h3&gt;Linq to SQL&lt;/h3&gt;

&lt;p&gt;For SQL, there are some specific things built into Linq.&amp;#160; You can read all about it &lt;a href="http://msdn.microsoft.com/en-us/library/bb425822.aspx"&gt;here&lt;/a&gt;.&amp;#160; The main thing to know is that there is a &lt;strong&gt;DataContext&lt;/strong&gt; object which does most of the interaction for you.&amp;#160; If you are in Visual Studio and create a Linq to SQL object in there,&amp;#160; you can point it to any/all of your tables and then access them in a very Object Oriented manner.&amp;#160; And when you are done changing/inserting things into the database, simply call &lt;strong&gt;DataContextInstance.SubmitChanges()&lt;/strong&gt; and it will take care of updating things.&lt;/p&gt;

&lt;p&gt;This is a very powerful and intuitive language and I am just starting to wrap my head around it.&amp;#160; Hope that this makes you want to try it out also and see what you think.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9006790" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/tom/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/tom/archive/tags/Linq/default.aspx">Linq</category></item></channel></rss>