📄 userhome.aspx
字号:
<%@ Page Language="VB" MasterPageFile="~/user.master" Title="Untitled Page" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">
Dim sqlcon As New SqlConnection
Dim sql1 As New SqlDataAdapter
Dim ds As New DataSet
Dim demp1 As DataTable
Dim dr1 As DataRow
Dim cmd2 As New SqlCommand
Protected Sub btbook1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
sqlcon = New SqlConnection("Data Source=.; database =BookStore;Integrated Security=True")
sql1.SelectCommand = New SqlCommand
sql1.SelectCommand.Connection = sqlcon
sql1.SelectCommand.CommandText = "select * from tbaddcart"
Dim prod As String
Dim name As String
Dim type As String
Dim status As String
prod = "Influencer - The Power To Change Anything"
name = "Kerry Patterson"
Dim price As String
price = "550"
type = "Book"
status = "Not Purchased"
sql1.Fill(ds, "tbaddcart")
demp1 = ds.Tables("tbaddcart")
dr1 = ds.Tables("tbaddcart").NewRow
dr1.Item(0) = Session("username")
dr1.Item(1) = prod
dr1.Item(2) = price
dr1.Item(3) = name
dr1.Item(4) = type
ds.Tables("tbaddcart").Rows.Add(dr1)
sql1.InsertCommand = New SqlCommand
sql1.InsertCommand.Connection = sqlcon
sql1.InsertCommand.CommandText = "insert into tbaddcart(CustomerId, ProductName, ProductPrice,Author,Type,Status) values('" & Session("username") & "','" & prod & "','" & price & "','" & name & "','" & type & "','" & status & "')"
sql1.Update(dr1.Table)
MsgBox("* Product has been added to cart", MsgBoxStyle.Information, "Product Added")
sqlcon.Close()
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
customer_name.Text = Session("username")
End Sub
Protected Sub btbook2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
sqlcon = New SqlConnection("Data Source=.; database =BookStore;Integrated Security=True")
sql1.SelectCommand = New SqlCommand
sql1.SelectCommand.Connection = sqlcon
sql1.SelectCommand.CommandText = "select * from tbaddcart"
Dim prod As String
Dim name As String
Dim type As String
Dim status As String
prod = "7th Heaven"
name = "James Patterson"
Dim price As String
price = "237"
type = "Book"
status = "Not Purchased"
sql1.Fill(ds, "tbaddcart")
demp1 = ds.Tables("tbaddcart")
dr1 = ds.Tables("tbaddcart").NewRow
dr1.Item(0) = Session("username")
dr1.Item(1) = prod
dr1.Item(2) = price
dr1.Item(3) = name
dr1.Item(4) = type
ds.Tables("tbaddcart").Rows.Add(dr1)
sql1.InsertCommand = New SqlCommand
sql1.InsertCommand.Connection = sqlcon
sql1.InsertCommand.CommandText = "insert into tbaddcart(CustomerId, ProductName, ProductPrice,Author,Type,Status) values('" & Session("username") & "','" & prod & "','" & price & "','" & name & "','" & type & "','" & status & "')"
sql1.Update(dr1.Table)
MsgBox("* Product has been added to cart", MsgBoxStyle.Information, "Product Added")
sqlcon.Close()
End Sub
Protected Sub btbook3_Click(ByVal sender As Object, ByVal e As System.EventArgs)
sqlcon = New SqlConnection("Data Source=.; database =BookStore;Integrated Security=True")
sql1.SelectCommand = New SqlCommand
sql1.SelectCommand.Connection = sqlcon
sql1.SelectCommand.CommandText = "select * from tbaddcart"
Dim type As String
Dim prod As String
Dim name As String
Dim status As String
prod = "Blink"
name = "Malcolm Gladwell"
Dim price As String
price = "301"
type = "Book"
status = "Not Purchased"
sql1.Fill(ds, "tbaddcart")
demp1 = ds.Tables("tbaddcart")
dr1 = ds.Tables("tbaddcart").NewRow
dr1.Item(0) = Session("username")
dr1.Item(1) = prod
dr1.Item(2) = price
dr1.Item(3) = name
dr1.Item(4) = type
ds.Tables("tbaddcart").Rows.Add(dr1)
sql1.InsertCommand = New SqlCommand
sql1.InsertCommand.Connection = sqlcon
sql1.InsertCommand.CommandText = "insert into tbaddcart(CustomerId, ProductName, ProductPrice,Author,Type,Status) values('" & Session("username") & "','" & prod & "','" & price & "','" & name & "','" & type & "',,'" & status & "')"
sql1.Update(dr1.Table)
MsgBox("* Product has been added to cart", MsgBoxStyle.Information, "Product Added")
sqlcon.Close()
End Sub
Protected Sub btbook4_Click(ByVal sender As Object, ByVal e As System.EventArgs)
sqlcon = New SqlConnection("Data Source=.; database =BookStore;Integrated Security=True")
sql1.SelectCommand = New SqlCommand
sql1.SelectCommand.Connection = sqlcon
sql1.SelectCommand.CommandText = "select * from tbaddcart"
Dim status As String
Dim type As String
Dim prod As String
Dim name As String
prod = "Paths Of Glory"
name = "Jeffrey Archer"
Dim price As String
price = "133"
type = "Book"
status = "Not Purchased"
sql1.Fill(ds, "tbaddcart")
demp1 = ds.Tables("tbaddcart")
dr1 = ds.Tables("tbaddcart").NewRow
dr1.Item(0) = Session("username")
dr1.Item(1) = prod
dr1.Item(2) = price
dr1.Item(3) = name
dr1.Item(4) = type
ds.Tables("tbaddcart").Rows.Add(dr1)
sql1.InsertCommand = New SqlCommand
sql1.InsertCommand.Connection = sqlcon
sql1.InsertCommand.CommandText = "insert into tbaddcart(CustomerId, ProductName, ProductPrice,Author,Type,Status) values('" & Session("username") & "','" & prod & "','" & price & "','" & name & "','" & type & "','" & status & "')"
sql1.Update(dr1.Table)
MsgBox("* Product has been added to cart", MsgBoxStyle.Information, "Product Added")
sqlcon.Close()
End Sub
Protected Sub btbook5_Click(ByVal sender As Object, ByVal e As System.EventArgs)
sqlcon = New SqlConnection("Data Source=.; database =BookStore;Integrated Security=True")
sql1.SelectCommand = New SqlCommand
sql1.SelectCommand.Connection = sqlcon
sql1.SelectCommand.CommandText = "select * from tbaddcart"
Dim status As String
Dim type As String
Dim prod As String
Dim name As String
prod = "The Secret"
name = "Rhonda Byrne"
Dim price As String
price = "390"
type = "Book"
status = "Not Purchased"
sql1.Fill(ds, "tbaddcart")
demp1 = ds.Tables("tbaddcart")
dr1 = ds.Tables("tbaddcart").NewRow
dr1.Item(0) = Session("username")
dr1.Item(1) = prod
dr1.Item(2) = price
dr1.Item(3) = name
dr1.Item(4) = type
ds.Tables("tbaddcart").Rows.Add(dr1)
sql1.InsertCommand = New SqlCommand
sql1.InsertCommand.Connection = sqlcon
sql1.InsertCommand.CommandText = "insert into tbaddcart(CustomerId, ProductName, ProductPrice,Author,Type,Status) values('" & Session("username") & "','" & prod & "','" & price & "','" & name & "','" & type & "','" & status & "')"
sql1.Update(dr1.Table)
MsgBox("* Product has been added to cart", MsgBoxStyle.Information, "Product Added")
sqlcon.Close()
End Sub
Protected Sub btbook6_Click(ByVal sender As Object, ByVal e As System.EventArgs)
sqlcon = New SqlConnection("Data Source=.; database =BookStore;Integrated Security=True")
sql1.SelectCommand = New SqlCommand
sql1.SelectCommand.Connection = sqlcon
sql1.SelectCommand.CommandText = "select * from tbaddcart"
Dim status As String
Dim type As String
Dim prod As String
Dim name As String
prod = "The Monk Who Sold His(Ferrari)"
name = "Robin Sharma"
Dim price As String
price = "185"
type = "Book"
status = "Not Purchased"
sql1.Fill(ds, "tbaddcart")
demp1 = ds.Tables("tbaddcart")
dr1 = ds.Tables("tbaddcart").NewRow
dr1.Item(0) = Session("username")
dr1.Item(1) = prod
dr1.Item(2) = price
dr1.Item(3) = name
dr1.Item(4) = type
ds.Tables("tbaddcart").Rows.Add(dr1)
sql1.InsertCommand = New SqlCommand
sql1.InsertCommand.Connection = sqlcon
sql1.InsertCommand.CommandText = "insert into tbaddcart(CustomerId, ProductName, ProductPrice,Author,Type,Status) values('" & Session("username") & "','" & prod & "','" & price & "','" & name & "','" & type & "','" & status & "')"
sql1.Update(dr1.Table)
MsgBox("* Product has been added to cart", MsgBoxStyle.Information, "Product Added")
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -