📄 order.aspx.vb
字号:
Imports System.Data.SqlClient
Imports System.Data
Public Class order
Inherits System.Web.UI.Page
Dim into As String = ConfigurationSettings.AppSettings("ConnectionString")
Dim com As New SqlCommand
Dim com1 As New SqlCommand
Dim con1 As SqlConnection = New SqlConnection(into)
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
Protected WithEvents TextBox5 As System.Web.UI.WebControls.TextBox
Protected WithEvents Label5 As System.Web.UI.WebControls.Label
Protected WithEvents TextBox4 As System.Web.UI.WebControls.TextBox
Protected WithEvents Label4 As System.Web.UI.WebControls.Label
Protected WithEvents TextBox3 As System.Web.UI.WebControls.TextBox
Protected WithEvents Label6 As System.Web.UI.WebControls.Label
Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
Protected WithEvents Label2 As System.Web.UI.WebControls.Label
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Label7 As System.Web.UI.WebControls.Label
Protected WithEvents Label8 As System.Web.UI.WebControls.Label
Protected WithEvents Label9 As System.Web.UI.WebControls.Label
Protected WithEvents Hyperlink11 As System.Web.UI.WebControls.HyperLink
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Label3 As System.Web.UI.WebControls.Label
Dim con As SqlConnection = New SqlConnection(into)
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents ImageButton1 As System.Web.UI.WebControls.ImageButton
Protected WithEvents HyperLink6 As System.Web.UI.WebControls.HyperLink
Protected WithEvents HyperLink5 As System.Web.UI.WebControls.HyperLink
Protected WithEvents HyperLink4 As System.Web.UI.WebControls.HyperLink
Protected WithEvents HyperLink3 As System.Web.UI.WebControls.HyperLink
Protected WithEvents HyperLink1 As System.Web.UI.WebControls.HyperLink
Protected WithEvents HyperLink2 As System.Web.UI.WebControls.HyperLink
'注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
con.Open()
com.CommandText = "select orderid 订单号,itemid 商品号,quentity 数量,untiprice 单价,totalprice 总价 from lineitem where orderid= '" & Session("orderid") & "'"
com.Connection = con
Dim da As New SqlClient.SqlDataAdapter(com.CommandText, con)
Dim ds As New DataSet
da.Fill(ds)
DataGrid1.DataSource = ds
DataGrid1.DataBind()
con.Close()
con.Open()
con1.Open()
com.CommandText = "select sum(totalprice) from lineitem where orderid=" & Session("orderid") & ""
Dim sum As String = com.ExecuteScalar()
com.Connection = con
com1.CommandText = "select cost from ordercost"
com1.Connection = con
Dim myreader As SqlDataReader = com1.ExecuteReader()
myreader.Read()
TextBox1.Text = Session("orderid")
TextBox2.Text = 200343128 'Session("username")
TextBox3.Text = Today
TextBox4.Text = sum + myreader(0)
TextBox5.Text = "正在配货"
con.Close()
con.Open()
com.CommandText = "insert into orders values(" & TextBox1.Text & ",'" & TextBox2.Text & "','" & TextBox3.Text & "'," & TextBox4.Text & ",0)"
com.Connection = con
com.ExecuteNonQuery()
con.Close()
con1.Close()
Label8.Text = "欢迎" & Session("username")
Label8.Visible = True
Button1.Visible = True
End Sub
Private Sub ImageButton1_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
Response.Redirect("webform1.aspx")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Session("userpower") = -1
Session("username") = ""
Label8.Visible = False
Button1.Visible = False
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -