【发布时间】:2016-03-28 15:59:10
【问题描述】:
我已将此数据表保存在缓存中
DataTable dataTable = ReportsBLL.GetProducts() as DataTable;
HttpContext.Current.Cache["productinfokey"] = dataTable;
System.Web.HttpContext.Current.Cache.Insert("productinfokey", dataTable, null, DateTime.Now.AddHours(1), System.Web.Caching.Cache.NoSlidingExpiration);
有时我需要将数据表过滤为
dataTable.Select("CreateDate >= " + DateTime.Now.AddMonths(-3) + " and CreateDate <= " + DateTime.Now + "")
但是如何按这些属性过滤数据,因为这种方式会给我错误
Syntax error: Missing operand after '05' operator.
从
填充的数据表 DataTable table = new DataTable();
try
{
SqlCommand cmd = (SqlCommand).Database.Connection.CreateCommand();
cmd.CommandText = "[dbo].[Report_Get]";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@parmCategory", parmCategory);
try
{
Connection.Open();
var reader = cmd.ExecuteReader();
table.Load(reader);
return table;
}
catch { /*some other code*/ }
}
catch { /*some other code*/ }
这里出了什么问题,我该如何解决?
【问题讨论】:
-
语法描述为here。
标签: asp.net asp.net-mvc linq datatable datatables