Adding Product Data

Though the ProductEditor.aspx Web form can now be used to update product information, there's still no way to add new products into the database. In this section, you'll see how to modify the existing Product Editor to also handle the case where a user needs to enter a new product. You could create an entirely new screen to handle product additions, but because this new screen would be very similar to the existing Product Editor, it makes sense to just modify the existing code to handle both cases.

The stored procedure Product_Add in Listing 22.5 performs the actual addition of new product data into the database. Notice that the parameters are nearly the same as for the Product_Update stored procedure in Listing 22.1. However, ...

Get Sams Teach Yourself ADO.NET in 24 Hours now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.