1

在我的网页中,它应该显示一个带有表记录的gridview,我尝试添加一个缓存,以便网格将从缓存中获取记录(如果存在),如果不存在,则会转到数据库本身。

虽然当我加载页面时出现此错误:

Could not load file or assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

这是我的代码,我很乐意收到任何可能的帮助:

 protected void Page_Load(object sender, EventArgs e)
        {
            //if (Page.IsPostBack)
            DataCache cache = new DataCache("default");
            DataSet result = (DataSet) cache.Get("table");
            if (result == null)
            {
                string connString = SqlAzureDataSource.ConnectionString;
                SqlDataAdapter adp = new SqlDataAdapter("SELECT * FROM Students", connString);
                DataSet ds = new DataSet();
                adp.Fill(ds);
                cache.Put("table", ds);
                GridView1.DataSource = ds;
                GridView1.DataBind();
            }
            else
            {
                GridView1.DataSource = result;
                GridView1.DataBind();
            }
        }
4

0 回答 0