zoukankan      html  css  js  c++  java
  • 简单缓存 datatable

                DataTable dt = new DataTable();

                if (Cache["mytablecache"] == null)
                {
                    using (SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=LocalDB;Integrated Security=True"))
                    {
                        con.Open();
                        SqlDataAdapter adapter = new SqlDataAdapter("SELECT top 100 * FROM [Money_CostDetail]", con);
                        adapter.Fill(dt);
                    }
                    Cache.Insert("mytablecache", dt, null, DateTime.UtcNow.AddMinutes(1), TimeSpan.Zero);
                }
                else
                {
                    dt = Cache["mytablecache"as DataTable;
                }
  • 相关阅读:
    洛谷 P4484
    洛谷 P4900
    Codeforces 1500D
    Codeforces 1322D
    2021.9.30 Codeforces 中档题四道
    BZOJ 3729
    洛谷 P6276
    Codeforces 1511G
    C语言 typedef
    C语言 回调函数 callback
  • 原文地址:https://www.cnblogs.com/zlfucku/p/2363828.html
Copyright © 2011-2022 走看看