????? ????? ????? ??? ????? ?????? ?????? ??????? ?????? ?? ASP.NET ???????? Visual Basic .NET

?????? ????????? ?????? ?????????
???? ???????: 312358 - ??? ???????? ???? ????? ????? ??? ???????.
??? ????? ??? ???????. ????? "??? ??" ??? ??? ??????? ??? ????.
????? ???? | ?? ????

?? ??? ??????

??????

??????? ??? ???? ???? ????? ?????? ????? ??? ????? ?????? ??????? ?????? ???????? ?? ??? ??????? ASP.NET.

???? ??? ?????? ?? ????? ???? DataSet ?? ????? ??????? ???? ?? ????? ????? ??? ???? ??? ????? ????? ??????? ?????? ?????? ?????? ??? ??????? ????? ??. ?????? ??? ??????? ?????? ?????? ?? ?????? ????? ??????? ?????? ???????? ?????? ????? ??? ????? ?? ???????? ??? ???? ???? ??? "REFERENCES" ?? ??? ???????.

Back to the top

???????

???? ??????? ??????? ??????? ?????? ??? ????? ?????? ???????? ?????? ? ??? ??????? ???? ???????:
  • Microsoft Windows 2000 ?? Microsoft Windows XP.
  • ????? ??????? ?????? Microsoft (IIS).
  • ???? ??? Microsoft .NET.
  • ???? Microsoft SQL.
Back to the top

????? ????? ??? ASP.NET ???????? Visual Basic .NET

???? ??????? ?????? ????? ??? ASP.NET ???? ???? DataCacher
  1. ??? ????? Microsoft Visual Studio .NET.
  2. ?? ??????? ???? ??? ??? ???? ?? ???? ??? ???????.
  3. ?? ???? ?????? ????? ???? ??? ????? Project ? ???? ??? ?????? Visual Basic. ??? ????? ? ???? ??? ????? ??? ASP.NET.
  4. ?? ?????? ??????? ?????? # WebApplication ??? ??????? ??????: DataCacher. ?? ???? ??????? ???? ???? ????? ??? ?????? http://localhost. ???? ???? ?????? ???:
    http://localhost/DataCacher
Back to the top

????? ????? ???

?????? ?????? ??? ???? ?? ?????????? ???? ??? "????? ???" ?????? ?? ??? ???????.
  1. ????? WebForm ???? ???? DataCacheSample.aspx ??? ??????? ?? Visual Studio .NET. ?????? ????? ???? ??????? ???????:
    1. ???? ??? ?????? ?????? ??? ???? ??????? ?? "?????? ??????" ? ??? ??? ????? ?? ???? ??? ????? WebForm ????.
    2. ??? WebForm DataCacheSample.aspx ? ?? ???? ??? ???.
  2. ?? Visual Studio .NET ??????? ????????? (IDE) ???? ??????? ??? ????? ????? "?????".
  3. ????? ?? WebForm ??? ??????:
    1. ???? ?? WebForm ??? ??????.
    2. ??? ???? WebForm. ????? ????? ?????? ??? CreateNewOrCached ?????? ??????? Text ??? ????? ???? ?? ??????.
  4. ????? ?? WebForm ????:
    1. ???? ?? WebForm ??? ??? ?????? ???? ??? ???? CreateNewOrCached.
    2. ??? ???? WebForm ????? ????? ?????? ??? RemoveEntry ?? ?? ?????? ??????? Text ??? RemoveEntry.
  5. ????? ????? WebForm:
    1. ???? ????? WebForm ?????? ?? ???? ???????.
    2. ??? ??????? WebForm ? ????? ????? ?????? ??? CacheStatus ?? ?? ?????? ????? ??????? Text.
  6. ????? DataGrid:
    1. ???? ???? ???? WebForm DataGrid ??????. ???????? ??????? ???? ????????? DataGrid1.
Back to the top

?? ?????? ????????? ????????

????? ??? ??? ????? ???? ????? ??????? ?????? ?????? ??????? ????? ??????? ?????? ? ?????? ????? ????? ??????? ???????:
  1. ???? ??? ?????? ?????? ??? ???? .aspx ??? ?? ???? ??? ??? ????????? ???????? ??? ??? ?????.
  2. ????? ?????? ??????? ??????? ??? ????? ????? ????? ?????:
    Imports System.Data.SqlClient
    Imports System.Web.Caching
    						
    ?????? ??? ?? ??? ????? ????? ?? ??? ??? ???? ????? ???? ?????? ??????? ?????? ????? ?????.
  3. ??????? ??? ????? ????? "?????".
  4. ???? ????? ??????? ??? ?? CreateNewOrCached ???? ??? ????? CreateNewOrCached_Click. ?? ?????? ???????? ???????? ??????? ??? ????? CreateNewOrCached_Click.

    ?????? ????? ??? ???????? ???????? ????? Pubs ???? SQL ?????? ????????.
         Private Sub CreateNewOrCached_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateNewOrCached.Click
            ' Create a DataSet object from the cache entry with the
            ' CacheDataSetEmployees key.
            Dim CacheDataSetEmployees As Object = CType(Cache.Get("CacheDataSetEmployees"), DataSet)
    
            ' Verify if the object is null.
            If (CacheDataSetEmployees Is Nothing) Then
    
                ' Set a value for the cache entry that serves as the 
                ' key for the dependency.
                Cache("SqlPubsEmployees") = "SomeValue"
    
                ' Create the array of cache key item names.
                Dim keys() As String = {"SqlPubsEmployees"}
    
    
                Dim ds As DataSet = New DataSet()
                ' Create the connection and pass in the ConnectionString.
                Dim MySqlConn As SqlConnection = New SqlConnection("Server=localhost;Database=Pubs;uid=sa;pwd=")
                ' Create the Data Adapter and pass the command text and 
                ' connection to use.
                Dim MySda As SqlDataAdapter = New SqlDataAdapter("SELECT TOP 10 * FROM Employee", MySqlConn)
                ' Populate the DataTable "Employees" in the DataSet.
                MySda.Fill(ds, "Employee")
                ' Set the DataGrid's DataSource to the "Employee" DataTable.
                DataGrid1.DataSource = ds.Tables("Employee")
    
                ' Create a dependency object referencing the array of cache 
                ' keys (keys).
                Dim MyDependency As New CacheDependency(Nothing, keys)
    
                ' Insert the DataSet into Cache with a dependency on 
                ' MyDependency
                Cache.Insert("CacheDataSetEmployees", ds, MyDependency)
                MySqlConn.Close()
    
                ' Display the status of the DataSet/Cache Entry.
                CacheStatus.Text = "New Version Created"
    
    
            Else
    
                ' Display the status of the DataSet/Cache Entry.
                CacheStatus.Text = "Cached Version Used"
                ' Set the DataSource to the cached version of the DataSet.
                DataGrid1.DataSource = CacheDataSetEmployees
            End If
    
            ' Bind the DataGrid to the DataSource.
            DataGrid1.DataBind()
    
        End Sub
    						
    ????? ???????????_????_??????? ?? ????????? ???????? ??????? ????? ???? ???? ?? SQL Server.
  5. ??????? ??? ????? ????? "?????" ?? DataCacheSample.aspx ??????.
  6. ???? ????? ??????? ??? ?? RemoveEntry ???? ??? ????? RemoveEntry_Click.
  7. ?? ?????? ????????? ???????? ??????? ??? ????? RemoveEntry_Click:
    Private Sub RemoveEntry_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemoveEntry.Click
            ' Remove the cache item listed in the CacheKeys array (keys).
            Cache.Remove("SqlPubsEmployees")
    
            ' Display the status of the cache item.
            CacheStatus.Text = "Cache Item Removed"
    End Sub
    					
  8. ?? ??????? ???? ???? ??? ??? ???? ???? ?? WebForm ???????? ???????? ??????? ??????.
  9. ????? ???????: ?? ??????? ???? ?? IDE .NET Studio Visual ???? ??? ????? ????.
Back to the top

????????? ????????

  1. ???? ??? ?????? ?????? ??? ?????? DataCacheSample.aspx ?? "?????? ??????" ??? ?? ???? ??? ??? ?? ??????.
  2. ???? ??? ???? CreateNewOrCached. ???? ????? CacheStatus????? ????? ???? ?? ??? ????? ???? ???? DataGrid.

    ???????:
    • ???? ??????? ????? ????? ???? ??????? CacheStatus ??? ????? ????? ??????? ?????? CacheDataSetEmployees ?? ???? ???? ????? ??????? ???? ???? ??? ????? ?????. ?? ??? ??????? ??? ????? DataSet ????? ?????? DataGridDataSet ?? ??? ????? DataSet ??? ????? ??????? ?????? ???????? ????? ????? ??????? ?????? CacheDataSetEmployees.
    • ??? ????? ???? CacheDependency ???? ???? MyDependency. ??? ??? ?????? MyDependency ??? ??????? ???? CacheDataSetEmployees ????? ??? ??????? ??? ????? ??????? ?????? ?????? ??????? ??????? ?????. ??? ????? ?? ?? ???? ??? ??????? ????? ??? ????? ???????? ? ????? ????? ??????? ????? ???? ?? ???????? ??? ????? ??????? ?????? ?????? ??? ??? ?? ?????? ??????.
  3. ???? ??? ???? CreateNewOrCached ??? ????.

    ???? ?? ???? ????? CacheStatus????????? ??????? ?????? ??????. ???? ??? ??? ????????? ??????? ?????? DataSet. ?????? ?? ?? ??? ?? ???????? ??????? ?????? ????? ??? ??????? ???????? ?? ????? ?????? Pubs ???????? ???? ??????? SQL ?? ???? ????. ??? ????? ????? ???? ??? ???? CreateNewOrCached ??? ????. ???? ??? ???? ????????? ???? ???????. ???? ??? RemoveEntry ?? ???? ??? CreateNewOrCached ??? ???? ?????? ????????? ???? ?? ??????? ??? ????? ????????.
  4. ???? ??? ???? RemoveEntry.

    ???? ?? ???? ????? CacheStatus????? ???? ????? ??????? ??????. ??? ????? ???? ????? ??????? ?????? ?????? SqlPubsEmployees ?????? ??????? ??????? Cache.Remove ?? ????? RemoveEntry_Click. ??? ??? ???? ????? ??? ??? ????? ????? ??????? ?????? ?????? ??? ?????? MyDependency ????? ??? ???????. ???? ????? ?????? CacheDataSetEmployees ???? ?? ?????? ???????? ????? ????? ?????? MyDependency ?????? ??????? ?????? ??.
  5. ???? ??? CreateNewOrCached ??? ????.

    ?????? ???? ????? CacheStatus ?? ????? ????? ????. ??? ????? DataSet based on ?? ?? ??? ??????? ?? ????? ??????? ?????? ??? ??? ?????.

    ???? ????? ?? ??? ??? ???? ?????? DataGrid ??? ????????(SSP) ???????? ??? ??? ????? ?????? DataSet ?? ????? ??????? ??????. ????? ??? ??? ?? ??? ????? ??????? EnableViewState ??? True ???? ???????. ????? ??? ???? ???? ?????? ?? ?? ????? ?????? ????? ????? ??????? ?????? ?? ????????? ????????. ????? ???? ???? ?? ???? ???? ?????? ?? ?? ????? ? ????? EnableViewState ??? ???.
?? ?????? ??????? ?? ?????? ????? ????? ??????? ?????? (?? ??? ??????? ?????? ??????) ???? ?????? ????? ??????? ?????? ????? ???? ?? ????? ???? ????? ??????? ??????. ??? ??? ????? ??? ??? ????????? ??????? ?? ????? ??????? ?????? ??????? ????? (?? ??? ??????? CacheDataSetEmployees) ?????? ???? ?? ?????? ???????? ??? ??????? ?? ????? ??????? ??????. ???? react ???? ?? ????? ??? ??? ?? ???????. ????? ?? ????????? ??? ?????? ??????????? ???? ??? "???????" ?????? ?? ??? ???????.

Back to the top

??????? ????? ????????

  • ??? ?? ???? ????? ???????? ???????? ?? ???? ?????? ????? ??????? ?????? ???????? ?? ??????? ??????? ????? ??????? ??????. ??? ?? ??? ??????? ???? ??? ??????? ??????? ??? ??? ???????? ?? ????? ??????? ?????? ???? ????--??? ???? ??????? ??? ???? ???????? ?? ????? ???????? ???????? ????? ???? ?????? ??? ??? ????? ?????? ??? ??? ????? ????? ??????? ???? ??? ????.
  • ???? ?????? ????? ??????? ?????? ??? ?? ????? ???? ??? ??? ????????? ?? ???? CacheDependency.
  • ?? ???? ????? ???? ?? ????? ??????? ?????? ?? ??? ???? ????? ?? ?????? ???????? ?????? ?? ???? ???? ??? ??????? ???? ??? ????? ?????? ?? ????? ??????? ??????.
Back to the top

?????

?????? ??? ??????? ??? CacheItemRemovedCallback ?? ?????? ???? Microsoft ?????? ??? ?????:
????? CacheItemRemovedCallback
http://msdn2.microsoft.com/en-us/library/system.web.caching.cacheitemremovedcallback(vs.71).aspx
??????????? CacheItemRemovedCallback ????? ?? ????? ??????? ????????? ??? ????? ???? ????? ??????? ?????? ?? ????? ??????? ??????.

?????? ??? ??????? ??? ??? CacheDependency ?? ?????? ???? Microsoft ?????? ??? ?????:
??? CacheDependency
http://msdn2.microsoft.com/en-us/library/system.web.caching.cachedependency(vs.71).aspx
????? ??? CacheDependency ?????? ????? ??????? ?????? ??? ??????? ?? ???????? ?? ?????? ???????? ?????? ?? ????? ??????? ?????? ????? ????????.

?????? ??? ???? ???? ?????? ??? ???????? ??????? ?????? ???????? ???????? ?? ASP.NET ? ?? ?????? ???? Microsoft ?????? ??? ?????:
????? ????? ??? ????? ??????? ??????
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaddingitemstocache.asp
?????? ??? ??????? ??????? ???? ??? ???? ????????? ????????? ??????? ?? "????? ??????? ?? Microsoft:
305140INFO: ASP.NET ???????
307225???? ???? ??? ??????? ?????? ASP.NET
Back to the top

???????

???? ???????: 312358 - ????? ??? ??????: 28/???? ??????/1435 - ??????: 4.5
????? ???
  • Microsoft ASP.NET 1.0
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft ASP.NET 1.1
  • Microsoft Visual Basic .NET 2003 Standard Edition
????? ??????: 
kbnosurvey kbarchive kbmt kbcaching kbdatabase kbhowtomaster KB312358 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????312358

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com