Thursday, November 3, 2011
Get the max nullable date from sql table in linq
private static DateTime GetLastMigratedFilesDBLastRunDate()
{
DataMigratedFilesDataContext migratedFilesDataContext = new DataMigratedFilesDataContext();
var lastExportRunDate = (from p in migratedFilesDataContext.RunDetails
select (DateTime?)(p.LastExportRunDate)).Max();
if (lastExportRunDate.HasValue)
return Convert.ToDateTime(lastExportRunDate);
else
return Convert.ToDateTime("1900-01-01");
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment