Hi, I am new to ASP.Net with VB and am working on a personal project to create a basic shopping site...<BR><BR>So far I can add products to my cart and delete from it but I need one little erorr correcting piece of code.<BR><BR>When the user adds an item it creates a new record with the values of ProgramID, OrderID and Qty. Now ProgramID and OrderID will be a compsite primary key.<BR><BR>The only problem is: if a user adds a product i.e. ProgramID: 1 under OrderID: 1 and Qty: 1, if they then go back to the page and try to add another copy they will duplicate the ProgramID of 1 and OrderID of 1 which we cant do.<BR><BR>I need some way of testing to see if ProgramID the user is requesting AND if the OrderID the user is using matches/conflicts with a record already in the database, then if it does the current Qty will be added with the Qty that has just been requested, if it doesn&#039;t conflict then a new record will be created.<BR><BR>I thought of doing this with an IF statement but the one I have tried doesn&#039;t work. you can view the code I am using at this address: http://www.monkie.net/addtocart.txt<BR><BR>In pseudo code it would be something like this:<BR><BR>IF ProductID = PrCode AND OrderID = sOrderID THEN ...<BR>ELSE...<BR>END IF<BR><BR>[Where PrCode and sOrderID are variables on the page and ProductID and OrderID are fields in the database.]<BR><BR>I would be grateful for any help, thanks.