Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shopping cart

Status
Not open for further replies.

180689

Programmer
Jan 12, 2011
2
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
 
this code is tighly coupled to an access database. the number of problems I see with this are numerous. I would keep searching for a better shopping cart that meets your needs.

problems with this snippet of code.
1. must use access
2. using ms access in a web environment
3. inefficient queries
4. use of data source controls
5. no error checking



Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top