[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.caching

Cache the data from the MS DAL and its table adapter

INVENTORYGUY @ DATA-PROFITS

11/3/2008 6:36:00 PM

Hello, Thanks in advance for helpful responses, links, examples.
I am looking for a discussion and avaialbe links for the following.
Using VS 2008, VB.net, the MSoft DAL and a stored proc to make the table
adapter that has three paramters that are all int values. What is the best
way to set up and use the Cache API ?
The resulting data is used to populate a graph and a table.
This is for a web part, we dont use share point but it is the same control
code.
The three paramters can be chg by the user; example chg from 1 wk to review
three weeks. There are a litaney of links and articles, few using VB.net
that include use of the MS DAL and paramters that are fed to the DAL.

Initially this sounds quite easy but as I have tried to put it into code I
have failed at every attempt. Your help is greatly appreciated.
Mike, Atlanta GA
1 Answer

INVENTORYGUY @ DATA-PROFITS

11/6/2008 3:54:00 PM

0

We used the Northwinds DB, and a Products table adapter, a query to return
product info based on the paramter categoryID. We used the ASP.Net How To
video Cache Pt2 as a model - with an xml data...this is commented out...here
is our code...it runs, but I do not belive it runs correctly. Not sure but
think we need to save a datatable...ideas are apprecaited...

Imports NorthwindsTableAdapters
Partial Class CacheAPIprods
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then

Dim ds As ProductsTableAdapter
ds = CType(Cache("prods"), ProductsTableAdapter)

If ds Is Nothing Then
ds = New ProductsTableAdapter
Cache.Insert("prods", ds)
Trace.Warn("prods read from DB")

Else
Trace.Warn("prods read from cache")
End If

dg1.DataSource = ds.GetProductsByCategoryID(1)
dg1.DataBind()
End If
End Sub

'Dim ds As Data.DataSet
'ds = CType(Cache("names"), Data.DataSet)

'If ds Is Nothing Then
' Dim path As String = "c:\websites\cache2\names.xml"
' ds = New Data.DataSet()
' ds.ReadXml(path)

' Dim cd As New CacheDependency(path)
' Cache.Insert("names", ds, cd)
' Trace.Warn("Names read from XML file")

'Else
' Trace.Warn("Names read from cache")
'End If

'dg1.DataSource = ds
'dg1.DataBind()

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Cache.Remove("prods")
Response.Redirect("cacheapiprods.aspx")
End Sub
End Class


"INVENTORYGUY @ DATA-PROFITS" wrote:

> Hello, Thanks in advance for helpful responses, links, examples.
> I am looking for a discussion and avaialbe links for the following.
> Using VS 2008, VB.net, the MSoft DAL and a stored proc to make the table
> adapter that has three paramters that are all int values. What is the best
> way to set up and use the Cache API ?
> The resulting data is used to populate a graph and a table.
> This is for a web part, we dont use share point but it is the same control
> code.
> The three paramters can be chg by the user; example chg from 1 wk to review
> three weeks. There are a litaney of links and articles, few using VB.net
> that include use of the MS DAL and paramters that are fed to the DAL.
>
> Initially this sounds quite easy but as I have tried to put it into code I
> have failed at every attempt. Your help is greatly appreciated.
> Mike, Atlanta GA