0
我想從獲取數據集中的最小日期查找最小的日期,但該代碼並不在不同時期賦予最小日期。請給我建議一些方式..Asp.Net。從數據集
Report.StartDate = DateTime.Parse(ds.Tables[0].Compute("MIN([" + c.ColumnMap + "])", "").ToString());
我想從獲取數據集中的最小日期查找最小的日期,但該代碼並不在不同時期賦予最小日期。請給我建議一些方式..Asp.Net。從數據集
Report.StartDate = DateTime.Parse(ds.Tables[0].Compute("MIN([" + c.ColumnMap + "])", "").ToString());
試試這個代碼 -
DateTime minDate = DateTime.MaxValue;
DateTime maxDate = DateTime.MinValue;
foreach (string dateString in StringDates)
{
DateTime date = DateTime.Parse(dateString);
if (date < minDate)
minDate = date;
if (date > maxDate)
maxDate = date;
}
OR
//Retrieve Minimum Date
var MinDate = (from d in dataRows select d.Date).Min();
//Retrieve Maximum Date
var MaxDate = (from d in dataRows select d.Date).Max();