Sunday, March 25, 2012

Adding a Delete functionality to my Shopping Cart

Hello,

I'm in the progress of developing a shopping cart system that operates with an SQL database in Visual Web Developer 2005. I've managed to successfully add items to the cart and display them, but I'm having trouble providing the user with the option of removing items from the cart.

My understanding so far is that I've got to adjust the DELETE SQL statement of the data source. At first I was thinking along the lines of a simple statement:

DELETE * FROM ShoppingCart WHERE CartID=@.CartID AND CategoryID=@.CategoryID AND ProductID=@.ProductID

However, I've realised that the parameters I need for this SQL query aren't automatically passed in when a user clicks the "Delete" text of the Delete field (at least I think this is the problem).

The error message which I'm getting when I try to remove an item from the cart is as follows:

Incorrect syntax near '*'.

If anyone could let me know where I'm going wrong and point me in the right direction I'd be really grateful.

Thank you,

Luke

Hi Luke,

There should not be an asterisk (*) in your DELETE statement. If you remove that you might have better luck.|||

Thanks very much for your help - I thought it might have been a really stupid mistake like that! Anyway everything is working fine now.

Thanks again,

Luke

No comments:

Post a Comment