本文整理匯總了VB.NET中System.Web.UI.ControlCachePolicy類的典型用法代碼示例。如果您正苦於以下問題:VB.NET ControlCachePolicy類的具體用法?VB.NET ControlCachePolicy怎麽用?VB.NET ControlCachePolicy使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ControlCachePolicy類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: GetAvailableItems
' 導入命名空間
Imports System.Data.SqlClient
Partial Class SimpleControl
Inherits System.Web.UI.UserControl
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
ItemsRemaining.Text = GetAvailableItems().ToString()
CacheTime.Text = DateTime.Now.ToLongTimeString()
End Sub
Private Function GetAvailableItems() As Integer
Dim sqlConnection As SqlConnection
Dim sqlCommand As SqlCommand
Dim items As Integer
sqlConnection = New SqlConnection("Initial Catalog=Northwind;Data Source=localhost;Integrated Security=SSPI;")
sqlCommand = sqlConnection.CreateCommand()
sqlCommand.CommandType = Data.CommandType.StoredProcedure
sqlCommand.CommandText = "GetRemainingItems"
sqlConnection.Open()
items = CInt(sqlCommand.ExecuteScalar())
sqlConnection.Close()
Return items
End Function
End Class