cachehelper调用时总是出错时为什么,提示是:System.NullReferenceException: 未将对象引用设置到对象的实例。郁闷了很久了.
public static Cache cache = new Cache();
public static void Insert(string key, object obj, double Minutes)
{
if (obj != null)
{
cache.Insert(key, obj, null, DateTime.Now.AddMinutes(Minutes), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
}
}
DataSet ds;
if (Cache["Rss"] == null)
{
string sqlStr = "select top 50 co.id,co.title,co.time,co.content,ca.category from [content] co,[category] ca where co.cateid=ca.id order by co.id desc";
ds = SQLHelper.Query(sqlStr);
CacheHelper.CacheInsertAddMinutes("Rss", ds, 10);
}
错误是:异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。