I have the following code in a function. The goal is to check to see if a record exists in the UD table. I have it writing some statements out to a file as part of my debug process. When I execute this code I see the before if and after if messages but I don’t get the found something one. It acts like it returns something (so it is not null) but then there is nothing there? What am I missing?
var ttester = Db.UD33.Where(o=>o.Company == Session.CompanyID && o.Key2 == jpJobNum && o.Date01 == jpDate);
sw.WriteLine(“before if”);
if (ttester != null)
{
sw.WriteLine(“after if”);
// foreach (var tt in ttester)
if (ttester.Any())
{
sw.WriteLine(“found something” );
}
}