📄 default.aspx.vb
字号:
Imports System.Data.SqlClient
Imports System.Data
Partial Public Class _default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
BindGrid()
End If
End Sub
Private Sub BindGrid()
Dim ds As New DataSet
Dim cn As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings.Item("dfs_ITracker_dbConnectionString").ToString)
cn.Open()
Dim sb As New StringBuilder
With sb
.Append("select * ")
.Append("from inventory ")
.Append("where inventory.inv_qty <= inventory.inv_ReorderPt ")
End With
Dim cmd As New SqlCommand(sb.ToString, cn)
cmd.CommandType = CommandType.Text
Dim da As New SqlDataAdapter(cmd)
da.Fill(ds)
gvReorderAlerts.DataSource = ds.Tables(0)
gvReorderAlerts.DataBind()
End Sub
Private Sub gvReorderAlerts_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvReorderAlerts.RowCommand
If e.CommandName = "Select" Then
Response.Redirect("~/Details.aspx?id=" & CType(e.CommandSource, GridView).DataKeys(CInt(e.CommandArgument)).Value.ToString)
End If
End Sub
Private Sub _default_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
Me.MasterPageFile = System.Configuration.ConfigurationManager.AppSettings("MasterPageName")
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -