winform簡略緩存類實例。本站提示廣大學習愛好者:(winform簡略緩存類實例)文章只能為提供參考,不一定能成為您想要的結果。以下是winform簡略緩存類實例正文
本文實例講述了winform簡略緩存類。分享給年夜家供年夜家參考。詳細以下:
public partial class Form3 : Form { //緩存類 System.Web.Caching.Cache cache; public Form3() { InitializeComponent(); string SQL = "select top 1000 * from infomation"; DataTable datatable = DBHelper.GetDataTable(SQL, ConnType.Menu); dataGridView1.DataSource = datatable; cache = System.Web.HttpRuntime.Cache; cache.Insert("infomation", datatable); } private void button1_Click(object sender, EventArgs e) { if (cache != null) { DataTable table = cache["infomation"] as DataTable; dataGridView2.DataSource = table; } } }
願望本文所述對年夜家的C#法式設計有所贊助。