Just wanted to share that a common mistake using Linq2SQL is to use the "equals operator" if you want to find a row that has null-values in certain columns.
Wrong:
From table in context.Table where (searchValue == table.Column)
Results in "from Table where Column=null"
Right:
From table in context.Table where (Object.Equals(searchValue, table.Column))
Results in "from Table where Column is null";
Happy Linqing!
PS: the reason I am using Linq2Sql and not Linq2Entities because of the current lack of disconnected entities support. I tried it but it was way too time consuming to use the conceptual layer as a business/object layer.
Showing posts with label Linq. Show all posts
Showing posts with label Linq. Show all posts
Monday, October 20, 2008
Tuesday, July 1, 2008
Linq Examples (Cheat Sheet)
Just came across this webpage from Microsoft where you can find 101 neatly categorized Linq examples:
Happy Linking!
Happy Linking!
Subscribe to:
Posts (Atom)