The query with NULL value has small bug: when compare with NULL, we must pass null keyword, not a parameter which has null value. See example:
Code: Select all
PartDataContext db = new PartDataContext();
string parent = null;
// it not works
var r1 = db.Dealers.Where(p => p.ParentCode == parent); // 0 result
// it works
var r2 = db.Dealers.Where(p => p.ParentCode == null); // has result