2
Listing A: Using the cache |
Dim dt As DataTable If Me.Cache("Categories") Is Nothing Then Dim wd As WebData = Utils.CreateWebData() dt = wd.GetCategoriesTable() Me.Cache.Insert("Categories", dt, Nothing, _ DateTime.Now.Add(New TimeSpan(0, 6, 0, 0, 0)), TimeSpan.Zero) Else dt = CType(Me.Cache("Categories"), DataTable) End If selCategory.DataSource = dt selCategory.DataValueField = "CategoryID" selCategory.DataTextField = "CategoryName" selCategory.DataBind() |