保存:Cache["DataSet"] = ds;
读取:
DataSet ds = new DataSet();
ds = (DataSet)Cache["DataSet"];

解决方案 »

  1.   

    but the server could destroy Cache object if it wants to, so you need to be ready to create it from scratch if it happensCache lives on the server side
      

  2.   

    我感觉在使用cache的时候,dataset还是保存在客户端的,或者说是用一个hidden类型的input 标签保存在页面上的,就是那个viewstate,这样导致页面文件变的很大,速度也会变慢。效果和用viewstate是一样的,不知道对不对。我的解决方法就是把那个dataset 定义成static 的,这样就可以保存了!
      

  3.   

    保寸:(ds是DATASET对象)
    Cache.Insert("search", ds, new CacheDependency(Server.MapPath(path)),Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration);
    读取:
     DataSet ds = (DataSet)Cache["search"];