| |
|||
Если да, то из базы данных извлекаются данные о товарах, заказанных посетителем:
("Select ShoppingCartltemID, ProductName, " _ & "Quantity, Price, Shipping From " _ & "ShoppingCartltems Where " _ & "CustomerlD = " & Session("CustomerlD") _ & " Order By ProductName" _ , DBConn)
"ShoppingCart")
& "нет товаров."
DSPageData.Tables("ShoppingCart").DefaultView dgShoppingCart.DataBind
("Select Sum(Price) as PriceSum, " _ & "Sum(Shipping) as ShippingSum From " _ & "ShoppingCartltems Where " _ & "CustomerlD = " & Session("CustomerlD") _ , DBConn)
"Totals")
& FormatCurrency(DSPageData.Tables("Totals"). _ Rows(O).ItemC'PriceSum") ) IblShippingTotal.Text = "Доставка: " _ & FormatCurrency(DSPageData.Tables("Totals"). _ Rows(O).Item("ShippingSum")) IblGrandTotal.Text = "Всего: " _ & FormatCurrency(DSPageData.Tables("Totals"). _ Rows(0).Item("PriceSum") +_ DSPageData.Tables("Totals"). _ Rows(0).Itern("ShippingSum"))
& "нет товаров."
Dim DBConn as OleDbConnection Dim DBDelete As New OleDbCommand Dim DBCommand As OleDbDataAdapter Dim DSPageData as New DataSet DBConn = New OleDbConnection("Provider-sqloledb;" _ & "server=localhost;" _ & "Initial Catalog=INETC15;" & "User Id=sa;" _ & "Password=yourpassword;") DBDelete.CommandText = "Delete from ShoppingCartltems " _ & "Where ShoppingCartltemID = " _ & E.Item.Cells(4).Text DBDelete.Connection = DBConn DBDelete.Connection.Open DBDelete.ExecuteNonQuery() DBConn = New OleDbConnection("Provider=sqloledb;" _ & "server=localhost;" _ & "Initial Catalog-INETCIS;" & "User Id=sa;" _ & "Password=yourpassword;") DBCoimnand = New OleDbDataAdapter _ ("Select ShoppingCartltemID, ProductName, " _ & "Quantity, Price, Shipping From " _ & "ShoppingCartltems Where " _ & "CustomerlD = " S Session("CustomerlD") _ & " Order By ProductName" _ , DBConn) DBCommand.Fill(DSPageData, _ "ShoppingCart") dgShoppingCart.DataSource = _ DSPageData.Tables("ShoppingCart").DefaultView dgShoppingCart.DataBind if DSPageData.Tables("ShoppingCart").Rows.Count = 0 Then IblPriceTotal.Text = "В Вашей корзине " _ & "нет товаров." IblShippingTotal.Text = "" IblGrandTotal.Text = "" Else DBCommand = New OleDbDataAdapter _ ("Select Sum(Price) as PriceSum, " _ & "Sum(Shipping) as ShippingSum From " _ & "ShoppingCartltems Where " _ & "CustomerlD = " & Session("CustomerlD") _ , DBConn) DBCommand.Fill(DSPageData, _ "Totals") IblPriceTotal.Text = "Итого: " _ & FormatCurrency(DSPageData.Tables ("Totals"). _ Rows(O).Item("PriceSum")) IblShippingTotal.Text = "Доставка: " _ & FormatCurrency(DSPageData.Tables("Totals"). _ Rows(O).Item("ShippingSum")) IblGrandTotal.Text = "Всего: " _' & FormatCurrency(DSPageData.Tables("Totals"). _ Rows(0).Item("PriceSum") +_ DSPageData.Tables("Totals"). _ Rows(O).Item("ShippingSum")) End If End Sub |
|||