-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