///////////////////////////
/////////
Method 1
DataTable dt = new DataTable();
DataTable dt2 = dt.Clone();
var rows = dt.Select().Where(p => (Convert.ToDateTime(p["DateTime"]).Date >=
System.DateTime.Now.AddDays(-50)) && (Convert.ToDateTime(p["DateTime"]) <=
System.DateTime.Now.Date));
foreach (var row in rows)
dt2.ImportRow(row);
/////////
Method 2
DataTable dtn = new DataTable();
dtn = dt.Clone();
dtn = dt.Select().Where(p =>
(Convert.ToDateTime(p["DateTime"]).Date >= System.DateTime.Now.AddDays(-50)) &&
(Convert.ToDateTime(p["DateTime"]) <= System.DateTime.Now.Date)).CopyToDataTable();
/////////
Method 3
DataTable dt3 = new DataTable();
dt3 = dt.Clone();
var reRows = dt.Select().Where(m => ((DateTime)m["DateTime"]).Date >=
DateTime.Now.Date);
if (reRows.Any())
dt3 = reRows.CopyToDataTable();
No comments:
Post a Comment