Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2
This is the forum to discuss the Wrox book Professional ASP.NET 2.0 Server Control and Component Development by Dr. Shahram Khosravi; ISBN: 9780471793502
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 2nd, 2015, 01:27 PM
Registered User
Points: 55, Level: 1
Points: 55, Level: 1 Points: 55, Level: 1 Points: 55, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2014
Location: Colorado
Posts: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Default Chap 17 Code1 Books Not saving

All,

I have not seen this problem from anyone else, or errata on the problem so I'm entering it here for anyone who is trying to get the code working.

In Code1 the Books.cs file seems to have been copied from a more advanced version of the code that allows for more data to be collected such as "Price" and "Publisher". However, the table in the database doesn't support those values; only "Title" and "Author". To correct the Books.cs file so that it will save updates made in the table, make the following changes:

1. Do a search for all instances of "Price" and "Publisher" and remove them, (don't forget to remove commas that are associated with these values along with any other identifiers such as "string"). In the ExecuteCommand function there are additional lines of code associated with these values that should also be removed. If you wish, you can just rem them out if your not sure which lines to keep and which to get rid of; though it should be fairly obvious.

2. Locate all instances of "AuthorID" and change them to "Author". In addition change the "int" identifier for "Author" to "string" as this is not an integer value. There is one location, in the ExecuteCommand function where "SqlDbType.int" should be changed to "SqlDbType.VarChar" as SQL doesn't use "string".

3. In ExecuteCommand, There are two references to SqlParameters (an array) an they are being established as a size of 4 and 5. These need to be reduced by two since you are no longer trying to send "Price" and "Publisher".

That's all you should need to do. Run the web page and you should now be able to Edit the data and perform an Update. Let me know if this still doesn't work or you're having other problems.

Mark
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chap 17 Code1 CustomTable error mbedell1@msn.com BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 0 December 2nd, 2015 01:02 PM
Chap 17: Email not working tomche BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 August 17th, 2009 09:57 AM
Chap 17: Email not working tomche BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 0 August 15th, 2009 10:09 AM
Chap 17 error: only content controls... Torq BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 0 September 8th, 2007 11:03 AM
Chap 17, page 609, error -- stumped HartfordDeveloper BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 December 8th, 2005 11:52 PM



All times are GMT -4. The time now is 05:14 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.