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
!--removed tag-->
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).