Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 10th, 2007, 06:30 AM
Authorized User
 
Join Date: Feb 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Updating Products in the WebShop

Hello to all, I'm using a gridview to get a list of products for a selected product category (from a DDL control). The gridview shows all the products as it should, and a select link for each product.

When I select a product it is openned up in a Form View control on the same page below the gridview in the "Edit" template mode. I changed the default mode in the Form View Properties to "edit".

The edit mode contains the default links at the bottom "Update" and "Cancel". After making a change to the price of the selected product and clicking the update link I noticed that I changed every product in the DB to the selected product as well as added an additional product of the same. In other words I started with 35 different products and tried to update one of them and now I have 36 of the same product.

Questions:

1. Could this be because I'm updating to a MSSQL 2000 DB?

2. How can I rewrite the code in VB to only update the selected product and not the entire product table?

Robert

 
Old March 10th, 2007, 09:28 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

This sounds like a missing WHERE clause in your SQL statement, although it's weird that you get a new item as well.

Can you post the relevant code?

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old March 10th, 2007, 11:24 PM
Authorized User
 
Join Date: Feb 2007
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes you are correct. There was a missing WHERE clause for the Update statement in the stored procedure "insertupdatesinglerecord". Adding "WHERE Id = @ Id" fixes this problem.

I think it was also adding a new one because it didn't have one. An, Id that is.

Thanks

Robert






Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding products to webshop not working. mcarol44 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 21 July 28th, 2011 09:09 AM
Updating products quantity when order item insert Tawanda BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 June 7th, 2007 02:30 PM
Catalog for the products FT BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 May 19th, 2007 05:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.