2012年3月24日星期六

Moncler Coats

, the page is loaded ,Moncler Coats,use the class to make a cached item dependent on two files . Sub Page_Load ( sender As Object ,e As EventArgs Dim Source As DataView ) Source = Cache ( " ;XMLDataSet" ;If Source Is Nothing Dim ) DS As New DataSet Dim FS As FileStream Dim Reader As StreamReader Dim txtDep As CacheDependency Dim xmlDep As CacheDependency Dim aggDep As AggregateCacheDependency FS = New FileStream ( Server.
MapPath ( " ;authors.xml" ;FileMode.Open ) ,Vibram Shoes,Reader = New ,FileAccess.Read ) StreamReader ( FS ) DS.ReadXml ( Reader ) FS.Close ( New ) Source = DataView ( ds.Tables ( 0) ) two CacheDependency objects ,Vibram Fiver Finger Shoes,one to a text file and the other to an XML file a CacheDependency array .
with these two objects as items In the array txtDep = New CacheDependency ( Server.MapPath ( " ;Storage.txt" ;xmlDep = New CacheDependency ( ) ) Server.MapPath ( " ;authors.
xml" ;Dim DepArray ( ) ) ) As CacheDependency = {txtDep ,Fiver Finger Shoes,xmlDep} an AggregateCacheDependency object and use the Add method to add the array to it . AggDep = New AggregateCacheDependency ( aggDep.
Add ) ( DepArray ) Call the GetUniqueId method to generate ID for each dependency in the array . Msg1.Text = aggDep.GetUniqueId ( ) Add the new data set to the cache with on both files in the array .
Cache.Insert ( " ;XMLDataSet" ;Source ,If ,aggDep ) aggDep.HasChanged = True Then chngMsg.Text = " ;The dependency changed at: " ;& ;DateTime.Now Else chngMsg.Text = " ;The dependency change D last at: " ;& ;aggDep.
UtcLastModified.ToString If cacheMsg1.Text = " End ( ) ;Dataset created explicitly" ;Else cacheMsg1.Text = " ;Dataset retrieved from cache" ;End If MyLiteral.Text = Source.
Table.TableName MyDataGrid.DataSource = Source MyDataGrid.DataBind ( ) End Sub Public Sub btn_Click ( sender As Object ,e As EventArgs ) If ( MyTextBox.Text = String . Empty ) Then msg2.
Text = " ;You have not changed the text file." ;Else msg2.Text = " ;You added " ;& ;MyTextBox.Text & ;" ;" ; an .Instance of the StreamWriter class to write text to a file .
Dim SW As StreamWriter SW = File.CreateText ( Server.MapPath ( " ;Storage.txt" ;) ) some text to the file . Sw.Write ( " ;You entered: " ) ;sw.WriteLine ( MyTextBox.
Text ) arbitrary objects to the file as needed . Sw.Write ( " Text added ;at : " ;sw.WriteLine ( DateTime.Now ) sw.WriteLine ( " ) ;------------------- " ;sw.
Related articles:

没有评论:

发表评论