<?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>Nulls - LINQ to DataSets Part 3</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx</link><description>In previous posts I have spent time talking about LINQ to DataSet, and how it can help you write better code, and how you can write some very interesting queries with DataSet. Today I am going to talk more about nulls, which is one of the areas in which</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Nulls - LINQ to DataSets Part 3</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#1670243</link><pubDate>Tue, 13 Feb 2007 20:43:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1670243</guid><dc:creator>onovotny</dc:creator><description>&lt;p&gt;What kind of extensibility will there be in the LINQ to SQL implementation?&lt;/p&gt;
&lt;p&gt;So far, nothing I've seen shows that you can use CTE's or Full-Text functions directly from LINQ code. &amp;nbsp;It would be very useful if there was a mechanism where additional functions could be added to expression tree that could add additional SQL calls. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Is there any way to do this?&lt;/p&gt;
</description></item><item><title>re: Nulls - LINQ to DataSets Part 3</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#1670689</link><pubDate>Tue, 13 Feb 2007 22:17:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1670689</guid><dc:creator>Frans Bouma</dc:creator><description>&lt;p&gt;I asked a question yesterday about your part 2 of the entity data model. You didn't reply. Could you please answer my question? thanks :)&lt;/p&gt;
</description></item><item><title>re: Nulls - LINQ to DataSets Part 3</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#1670719</link><pubDate>Tue, 13 Feb 2007 22:23:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1670719</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;I think your VB syntax is incorrect. Shouldn't it be:&lt;/p&gt;
&lt;p&gt;Dim query = From dataRow In orderDataTable _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Where IIF(dataRow.IsNull(&amp;quot;OrderDate&amp;quot;), False, dataRow.Field(Of DateTime)(&amp;quot;OrderDate&amp;quot;).Year = 2006) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select dataRow.Field(Of Integer)(&amp;quot;OrderID&amp;quot;)&lt;/p&gt;
</description></item><item><title>re: Nulls - LINQ to DataSets Part 3</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#1671889</link><pubDate>Wed, 14 Feb 2007 02:25:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1671889</guid><dc:creator>Erick Thompson</dc:creator><description>&lt;p&gt;Beth, &lt;/p&gt;
&lt;p&gt;Thanks for the catch! The code should be updated soon.&lt;/p&gt;
&lt;p&gt;Frans,&lt;/p&gt;
&lt;p&gt;The author of that post will respond to your comment on that post, but if you have any LINQ to DataSet related questions, please post!&lt;/p&gt;
</description></item><item><title>re: Nulls - LINQ to DataSets Part 3</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#1676829</link><pubDate>Wed, 14 Feb 2007 18:36:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1676829</guid><dc:creator>Frans Bouma</dc:creator><description>&lt;p&gt;I don't have any dataset related questions, or perhaps it's related, but what I really want the ADO.NET vNext team to comment on are 2 things:&lt;/p&gt;
&lt;p&gt;1) the 'where is what executed' problem. See:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.thedatafarm.com/blog/2007/02/13/TheShadowySideOfLINQToSQL.aspx"&gt;http://www.thedatafarm.com/blog/2007/02/13/TheShadowySideOfLINQToSQL.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It contains a Linq query which actually doesn't result in a single query but in a query which results are evaluated in-memory, which isn't expected at all, and thus will result in a lot of queries. &amp;nbsp;(point 2 in that blog). When is what executed in the db and when is what executed in-memory, which could trigger lazy loading or other slow constructs. To me, if Linq doesn't have a solution for this, it's dead in the water as too many people will be bitten by it sooner or later. It should be deterministic where what is executed (e.g. in-memory with a function or in the db with a query predicate/fragment)&lt;/p&gt;
&lt;p&gt;2) the explicit specification of a subquery instead of a join. Take northwind, and the employee - order - customer relations. Now, there are 8 or 9 employees in the db, a few hundred orders and 89 or so customers. If I want all employees who have accepted an order from a customer in Germany, I can do that with JOINs or with subqueries. The fact is, with JOINs, I get a lot of duplicates for the employee data (due to the 1:n relation), and I can't use DISTINCT for the select, as Employee contains a blob field. It therefore will be very slow as the data has to be filtered on the client (o/r mapper core) and with subqueries this isn't the case, the code is very fast. The thing is though: how to specify in Linq that a subquery has to be used instead? For northwind, it might be still acceptable, but if I have 500,000 orders and 150,000 customers, I won't be very happy with the join approach. &lt;/p&gt;
&lt;p&gt;Again, if Linq can't express this, it won't be that useful for a lot of applications. It would be great to see how to address these two points in Linq code. &lt;/p&gt;
&lt;p&gt;Thanks. &lt;/p&gt;
</description></item><item><title>re: Nulls - LINQ to DataSets Part 3</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#1676930</link><pubDate>Wed, 14 Feb 2007 19:04:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1676930</guid><dc:creator>RKJ</dc:creator><description>&lt;p&gt;Could anyone please provide an example of using ExceptRows function in a sql query ? &lt;/p&gt;
&lt;p&gt;ExceptRows &lt;/p&gt;
&lt;p&gt;Public Function ExceptRows( _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;first as IEnumerable(Of DataRow), _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;second as IEnumerable(Of DataRow)) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;as IEnumerable(of DataRow) &lt;/p&gt;
&lt;p&gt;For example please use the following query: Replace operator &amp;quot;&amp;lt;&amp;gt;&amp;quot; with Except Rows and &amp;quot;=&amp;quot; with EqualRows.&lt;/p&gt;
&lt;p&gt;Dim RetTable As DataTable = (From o In (From A In Elite _&lt;/p&gt;
&lt;p&gt;Select A), P In Person _&lt;/p&gt;
&lt;p&gt;Where LTrim(RTrim(o.Field(Of String)(&amp;quot;TimeKeeperNumber&amp;quot;))) = LTrim(RTrim(P.Field(Of String)(&amp;quot;TimeKeeperNumber&amp;quot;))) _&lt;/p&gt;
&lt;p&gt;And UCase(LTrim(RTrim(o.Field(Of String)(&amp;quot;Email_Address&amp;quot;)))) &amp;lt;&amp;gt; UCase(LTrim(RTrim(P.Field(Of String)(&amp;quot;Email_Address&amp;quot;)))) _&lt;/p&gt;
&lt;p&gt;Select TimeKeeperNumber := o.Field(Of String)(&amp;quot;TimeKeeperNumber&amp;quot;), _&lt;/p&gt;
&lt;p&gt;Last_Name := P.Field(Of String)(&amp;quot;Person_Last_Name&amp;quot;)).ToDataTable()&lt;/p&gt;
</description></item><item><title>re: Nulls - LINQ to DataSets Part 3</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#1678308</link><pubDate>Wed, 14 Feb 2007 23:37:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1678308</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Frans, &lt;/p&gt;
&lt;p&gt;Re: 2) What I want to know is if that same issue comes up when querying the Entity Data Model. I see using LINQ to the EDM more than directly like LINQ to SQL. &lt;/p&gt;
&lt;p&gt;And I'd like to hear what kind of guidance is Microsoft going to give regarding using LINQ to SQL directly vs. the Entity Framework? With LINQ to EDM I can't yet see where LINQ to SQL should be used except for really small, trivial applications.&lt;/p&gt;
</description></item><item><title>Querying DataSets – Introduction to LINQ to DataSet</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#1685715</link><pubDate>Thu, 15 Feb 2007 23:51:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1685715</guid><dc:creator>ADO.NET team blog</dc:creator><description>&lt;p&gt;Greetings fellow data junkies! My name is Erick Thompson, a PM at Microsoft who is working on driving&lt;/p&gt;
</description></item><item><title>Type safety - LINQ to DataSets Part 2</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#1685720</link><pubDate>Thu, 15 Feb 2007 23:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1685720</guid><dc:creator>ADO.NET team blog</dc:creator><description>&lt;p&gt;Back in the first post of this LINQ to DataSet series, I spent some time talking about what LINQ to DataSet&lt;/p&gt;
</description></item><item><title>re: Nulls - LINQ to DataSets Part 3</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#1696613</link><pubDate>Sat, 17 Feb 2007 20:10:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1696613</guid><dc:creator>DiegoV</dc:creator><description>&lt;p&gt;Hello Erick, It is good to have something to read while the February CTP (or is it a March CTP?) gets out!&lt;/p&gt;
&lt;p&gt; I happen to use Visual Basic a lot, and just wanted to comment:&lt;/p&gt;
&lt;p&gt;1. The short-circuited behavior of IIF is new to Orcas, but the operator has been part of the language for many years (only it was just like a normal function call that evaluated all parameters). For what I know this is still subject to change in the final version (&lt;a rel="nofollow" target="_new" href="http://www.panopticoncentral.net/archive/2006/12/29.aspx"&gt;http://www.panopticoncentral.net/archive/2006/12/29.aspx&lt;/a&gt;) &lt;/p&gt;
&lt;p&gt;2. I think the use of ANDALSO and IIF is a matter of taste, but I personally like more ANDALSO in this case :) &lt;/p&gt;
&lt;p&gt;3. I prefer not to compare a Boolean function like IsNull() to true or false as you do in your code, but again, it is matter of taste. Perhaps my problem is that I have seen really ugly code do things like that :)&lt;/p&gt;
&lt;p&gt;Now, for a couple of questions: &lt;/p&gt;
&lt;p&gt;1. With Field&amp;lt;T&amp;gt;() returning nullable types you mean that it is also safe to use something like Field&amp;lt;T&amp;gt;(name).HasValue if T is a value type?&lt;/p&gt;
&lt;p&gt;2. Is it going to be possible to change the settings of the Typed DataSet generator to get fields with nullable types in Orcas?&lt;/p&gt;
&lt;p&gt;Thanks for your post. &lt;/p&gt;
</description></item><item><title>New and Notable 142</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#1705824</link><pubDate>Sun, 18 Feb 2007 19:16:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1705824</guid><dc:creator>Sam Gentile</dc:creator><description>&lt;p&gt;Data/ADO.NET Orcas Two from the ADO.NET team: Entity Client and Nulls - LINQ to DataSets Part 3 Software&lt;/p&gt;
</description></item><item><title>re: Nulls - LINQ to DataSets Part 3</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#1776049</link><pubDate>Thu, 01 Mar 2007 01:38:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1776049</guid><dc:creator>Erick Thompson</dc:creator><description>&lt;p&gt;Diego,&lt;/p&gt;
&lt;p&gt;Thanks for the great comments! FTYI, The Feb/March CTP is now out, so take a look!&lt;/p&gt;
&lt;p&gt;ANDALSO is definitely an option, and I can see why people like that more. However, I've found that a lot of people aren't familiar with ANDALSO, and they get stuck on the short circuiting part of it.&lt;/p&gt;
&lt;p&gt;For your questions, if you use Field&amp;lt;T&amp;gt; you can definitely use HasValue to check for a null value, which is yet another way you can write these queries.&lt;/p&gt;
&lt;p&gt;As for the Typed DataSet returning nullable types, that is something we're looking at doing for RTM. &lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;Erick&lt;/p&gt;
</description></item><item><title>re: Nulls - LINQ to DataSets Part 3</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#2759043</link><pubDate>Mon, 21 May 2007 05:07:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2759043</guid><dc:creator>Bill McCarthy</dc:creator><description>&lt;p&gt;The syntax around IIf is completely wrong. &amp;nbsp;IIf is a function with the syntax of :&lt;/p&gt;
&lt;p&gt;Function IIf(expression As Booleam, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; returnTrue As Object, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; returnFalse As Object)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; As Object&lt;/p&gt;
&lt;p&gt;So when you pass to IIf a statment such as :&lt;/p&gt;
&lt;p&gt;Dim query = From dataRow In orderDataTable _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Where IIF(dataRow.IsNull(&amp;quot;OrderDate&amp;quot;), False, dataRow.Field(Of DateTime)(&amp;quot;OrderDate&amp;quot;).Year = 2006) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Select dataRow.Field(Of Integer)(&amp;quot;OrderID&amp;quot;)&lt;/p&gt;
&lt;p&gt;it means that the parameters otthe function all get evaluated, including :&lt;/p&gt;
&lt;p&gt;dataRow.Field(Of DateTime)(&amp;quot;OrderDate&amp;quot;).Year = 2006&lt;/p&gt;
&lt;p&gt;even when dataRow.IsNull(&amp;quot;OrderDate&amp;quot;) is true.&lt;/p&gt;
&lt;p&gt;This is a language limitation that will be addressed in Orcas with the new If tenrary operator. &amp;nbsp; The correct code will be:&lt;/p&gt;
&lt;p&gt;Dim query = From dataRow In orderDataTable _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Where If(dataRow.IsNull(&amp;quot;OrderDate&amp;quot;), False, dataRow.Field(Of DateTime)(&amp;quot;OrderDate&amp;quot;).Year = 2006) _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Select dataRow.Field(Of Integer)(&amp;quot;OrderID&amp;quot;)&lt;/p&gt;
</description></item><item><title>re: Nulls - LINQ to DataSets Part 3</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#6184439</link><pubDate>Wed, 14 Nov 2007 00:44:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6184439</guid><dc:creator>Patrick</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have a typed Dataset with two related data tables that I am joining together on a single relation. I want to then put the result [of the select] back into a third data table. This seems to be quite difficult! Can you suggest a method for achieving this?&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var joined = from p in dset.Donations.AsEnumerable()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; join e in dset.Name_and_Address on p.Member_ID equals e.Member_ID&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; select new { Donation_ID = p.Field&amp;lt;int&amp;gt;(&amp;quot;Donation ID&amp;quot;), Member_ID = p.Field&amp;lt;int&amp;gt;(&amp;quot;Member ID&amp;quot;),&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Date = p.Field&amp;lt;DateTime&amp;gt;(&amp;quot;Date&amp;quot;), Amount = p.Field&amp;lt;double&amp;gt;(&amp;quot;Amount&amp;quot;),&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Title = e.Field&amp;lt;string&amp;gt;(&amp;quot;Title&amp;quot;), Initials = e.Field&amp;lt;string&amp;gt;(&amp;quot;Initials&amp;quot;),&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Surname = e.Field&amp;lt;string&amp;gt;(&amp;quot;Surname&amp;quot;) };&lt;/p&gt;
&lt;p&gt;The source data may contain DBNull.&lt;/p&gt;
</description></item><item><title>re: Nulls - LINQ to DataSets Part 3</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#8037259</link><pubDate>Wed, 05 Mar 2008 01:37:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8037259</guid><dc:creator>Travis Riffle</dc:creator><description>&lt;p&gt;I just wanted to say this is exactly what I was looking for... &amp;nbsp;not testing IsNull was what was causing my exception problems in my datatable.&lt;/p&gt;
&lt;p&gt;Good info!&lt;/p&gt;
</description></item><item><title>re: Nulls - LINQ to DataSets Part 3</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#8763323</link><pubDate>Tue, 22 Jul 2008 11:21:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8763323</guid><dc:creator>pramod.gupta</dc:creator><description>&lt;p&gt;How do i &amp;nbsp;write a dynamic Linq query with Group Join over Two DataTables. &lt;/p&gt;
&lt;p&gt;Constraint columns can be more than one.&lt;/p&gt;
</description></item><item><title>re: Nulls - LINQ to DataSets Part 3</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#8844085</link><pubDate>Fri, 08 Aug 2008 22:15:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8844085</guid><dc:creator>Gabriel Bogea Perez</dc:creator><description>&lt;p&gt;Hey, what if I want to use a column from a Typed Dataset in an OrderBy and this column may have nulls? How to deal with this?&lt;/p&gt;
&lt;p&gt;var query = from row in dataTable.AsEnumerable()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where row.IdCompany == 5&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; orderby row.Age&lt;/p&gt;
&lt;p&gt;I get an error saying that the column Age is DBNull, which is expected since the Property in the DataTable throws an exception when you try to cast the null value.&lt;/p&gt;
&lt;p&gt;In this case Age may be null. I have also tried this:&lt;/p&gt;
&lt;p&gt;var query = from row in dataTable.AsEnumerable()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where row.IdCompany == 5&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; orderby row[&amp;quot;Age&amp;quot;]&lt;/p&gt;
&lt;p&gt;but it fails in the CompareTo method.&lt;/p&gt;
&lt;p&gt;Any ideas?&lt;/p&gt;
</description></item><item><title>re: Nulls - LINQ to DataSets Part 3</title><link>http://blogs.msdn.com/adonet/archive/2007/02/13/nulls-linq-to-datasets-part-3.aspx#8964638</link><pubDate>Thu, 25 Sep 2008 09:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8964638</guid><dc:creator>shankar</dc:creator><description>&lt;p&gt;Hi ,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I just want to build the where clause of the query dynamicaly. Kindly help me out&lt;/p&gt;
</description></item></channel></rss>