samples/asp.net/edit.aspx.vb

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data
Imports System.Data.SqlClient

Public Class edit
    Inherits System.Web.UI.Page

    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    End Sub

    Protected WithEvents btnUpdate As System.Web.UI.WebControls.Button
    Protected WithEvents lblMessage As System.Web.UI.WebControls.Label
    Protected WithEvents txtOrderID As System.Web.UI.WebControls.TextBox
    Protected WithEvents dropCustomers As System.Web.UI.WebControls.DropDownList
    Protected WithEvents txtShipCity As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtShipAddress As System.Web.UI.WebControls.TextBox
    Protected WithEvents Label2 As System.Web.UI.WebControls.Label
    Protected WithEvents Label3 As System.Web.UI.WebControls.Label
    Protected WithEvents Label4 As System.Web.UI.WebControls.Label
    Protected WithEvents Label5 As System.Web.UI.WebControls.Label

    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        InitializeComponent()
    End Sub

    Dim sql As String
    Dim cn As SqlConnection
    Dim cmd As SqlCommand
    Dim read As SqlDataReader

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        cn = New SqlConnection("server=localhost;database=northwind;uid=sa;pwd=;")
        If Not Page.IsPostBack Then
            LoadData()
        End If
    End Sub

    Sub LoadData()
        sql = "SELECT OrderID, ShipAddress, ShipCity, CustomerID FROM Orders WHERE OrderID=" + Request.QueryString("OrderID")
        cmd = New SqlCommand(sql, cn)
        cn.Open()
        read = cmd.ExecuteReader()
        read.Read()
        txtOrderID.Text = read.Item(0)
        txtShipAddress.Text = read.Item(1)
        txtShipCity.Text = read.Item(2)
        Dim remember = read.Item(3)
        read.close()

        sql = "SELECT CustomerID, CompanyName FROM Customers"
        cmd = New SqlCommand(sql, cn)
        dropCustomers.DataSource = cmd.ExecuteReader()
        dropCustomers.DataBind()
        cn.Close()
        dropCustomers.SelectedValue = remember
    End Sub
后面还有 18 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。