您好我已经开发了以下代码来将数据集保存在Global.asax
文件中。要在webpage.aspx.vb
文件中使用它,现在它工作正常。
以类似的方式,我如何调用存储过程Global.asax
?
请帮忙,在此先感谢您!
Shared _cache As Cache = Nothing
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
_cache = Context.Cache
RefreshCache(Nothing, Nothing, 0)
End Sub
Private Shared Sub RefreshCache(ByVal key As String, ByVal item As Object, ByVal reason As CacheItemRemovedReason)
Dim adapter As New SqlDataAdapter("SELECT * FROM dbo.table where logid = 1", "server=server;database=database;uid=userid;pwd=password")
Dim ds As New DataSet()
adapter.Fill(ds, "Quotations")
Dim onRemove As CacheItemRemovedCallback
onRemove = New CacheItemRemovedCallback(AddressOf RefreshCache)
_cache.Insert("Quotes", ds, New CacheDependency("C:\AspNetSql\Quotes.Quotations"), Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.[Default], onRemove)
End Sub