How to implement a shopping cart using vb

session , sql , dropdownlist , shopping cart Johannesburg, South Africa
  • 8 years ago

    hi I have an apllication that I coded in vb and using sql2005 as a database it is more or less of an online giftshop and it needs a shoppoing cart I have found the shoppng cart but it uses an access database the dropdownlist displays products from the table "Products" and then upon clicking any one of the products the price of that product is displayed in a label and its image is displayed by the side. can anyone please assist me in converting this code so that it can use sql instead of access or is it possible for me to use both?

    Protected Sub Page_Load(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then ddlProducts.DataBind() End If SelectedProduct = Me.GetSelectedProduct() lblName.Text = SelectedProduct.Name lblShortDescription.Text = SelectedProduct.ShortDescription lblLongDescription.Text = SelectedProduct.LongDescription lblUnitPrice.Text = FormatCurrency(SelectedProduct.UnitPrice) imgProduct.ImageUrl = "Images/Products/" _ & SelectedProduct.ImageFile End Sub

    Private Function GetSelectedProduct() As Product
        Dim dvProduct As DataView = CType( _
            AccessDataSource1.Select(DataSourceSelectArguments.Empty), DataView)
        dvProduct.RowFilter = "ProductID = '" & ddlProducts.SelectedValue & "'"
        Dim Product As New Product
        Product.ProductID = dvProduct(0)("ProductID").ToString
        Product.Name = dvProduct(0)("Name").ToString
        Product.ShortDescription = dvProduct(0)("ShortDescription").ToString
        Product.LongDescription = dvProduct(0)("LongDescription").ToString
        Product.UnitPrice = CDec(dvProduct(0)("UnitPrice"))
        Product.ImageFile = dvProduct(0)("ImageFile").ToString
        Return Product
    End Function
    

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“C++ : Where friends have access to your private members.” - Gavin Russell Baker