-2
您好,我开发了下面的代码来保存Global.asax
文件中的数据集。要消耗文件,现在它工作正常。从global.asax文件调用存储过程
以类似的方式,我怎样才能调用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
你可以用你在任何代码背后调用它的方式调用它。你到底在做什么? – Oded 2012-07-13 12:29:09
我昨天回答了... [阅读此](http://www.codeproject.com/Articles/15403/Calling-Stored-procedures-in-ADO-NET) – bluevector 2012-07-13 12:32:19
我明白你们对我说的话,但我的global.asax文件与vb.net代码,它不是写在一个类继承任何其他基类,任何方式,谢谢你,我已经解决这个与你的建议。之前,我现在想的太多了,无法实现下面的答案代码。 – 2012-07-13 15:22:24