Hi all,
I have a page where i want to cache a dataset for 30 seconds. When the dataset is not in Cache the page loads fine and it shows my data. Reloading the page, all the data binded to the grid dissapears. I know that the cached data set is in memory and it contains the same number of rows as the dataset would, but for some reason the data does not appear and i have no idea why, could someone have a look at my code and see if anything jumps out at them??????
Thanks,
Rob
---------------------------------------
I have a page where i want to cache a dataset for 30 seconds. When the dataset is not in Cache the page loads fine and it shows my data. Reloading the page, all the data binded to the grid dissapears. I know that the cached data set is in memory and it contains the same number of rows as the dataset would, but for some reason the data does not appear and i have no idea why, could someone have a look at my code and see if anything jumps out at them??????
Code:
Private Sub BindWebData(ByVal index As Integer, ByVal sort As String)
'Set sort item in sort text box, used for header formatting
txtSort.Text = index & ", " & Trim(Mid(sort, sort.IndexOf(" ") + 2, 4))
'Get Invoices DataSet
'Create new dataset object to hold data returned from Web Service
'Dim ds As New DataSet
Dim dsName As String = "InvoiceDataSet" & CType(Context.User.Identity, CustomIdentity).Code
If Cache(dsName) Is Nothing Then
ds = GetInvoicesDataSet()
'===Absolute expiration of Debtor DataSet Cache===
Cache.Insert(dsName, ds, Nothing, _
DateTime.Now.AddSeconds(30), _
Cache.NoSlidingExpiration)
Else
ds = CType(Cache(dsName), DataSet)
End If
'Do DataSet Sorting
Dim dv As New DataView
dv = ds.Tables(0).DefaultView
dv.Sort = sort
dgInvoices.DataSource = dv
dgInvoices.DataBind()
End Sub
Thanks,
Rob
---------------------------------------