Hello everyone I'm currently having 2 issues with the code below:
Upon return of result1 I'm trying to complete a check to see if it is != null and if it is't it will begin to delete the records selected. The issue is that even when result1 returns nothing and defaults the if statement doesn't pick this up so I guess I'm missing something but what?
I'm wishing to return only values which are over 10 mintues old (this will later be scaled to 12 hours) to do this I'm checking against a.DateTime which is a DateTime value stored in a database. However if i use the <= or >= operators it doesn't work so again what am I missing?
DateTime dateTime = DateTime.Now.Subtract(new TimeSpan(0, 0, 10, 0)); var result1 = (from a in cpuInfo where a.DateTime <= dateTime select a).DefaultIfEmpty(null); if (result1 != null) { foreach (TblCPUInfo record1 in result1) { localDB.TblCPUInfo.DeleteOnSubmit(record1); localDB.SubmitChanges(); } }