我有一个view
数据,我只需要检索过去 7 天的数据。如果我使用 sql 查询,我知道有一个功能。但我正在使用 Linq。
这是我的代码:
try
{
var query = (from bwl in mg.BarcodeWithLocation
select new
{
RequestID = bwl.RequestID,
Barcode = bwl.Barcode,
adrid = bwl.AdrID,
name = bwl.Name,
street = bwl.Street,
houseno = bwl.HouseNo,
postal = bwl.Postal,
city = bwl.City,
country = bwl.Country,
latitudetxt = bwl.Latitude == "" ? "Location Unknown" : "View Map Location",
latitude = bwl.Latitude,
longitude = bwl.Longitude,
date = bwl.ReceivedDate
});
this.Grid.DataSource = query;
this.Grid.DataBind();
}
catch (Exception exception)
{
Console.WriteLine("ERROR in GetNoLocationScan() method. Error Message : " + exception.Message);
}
谁能告诉我如何在 Linq 中做到这一点?