Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 Search this Thread Display Modes
  #1 (permalink)  
Old October 5th, 2007, 04:29 AM
Authorized User
 
Join Date: Oct 2007
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default Webshop adding tables.

I am working on the Webshop project.

I want to add a column in the product database (actualy 2)
A "Author" Colomn
And a "Grade" Column

But what code do i have to add to make this work i just want to show this information in the products gridview and detailed view.

(Sorry for my bad English)
(I'm really new to asp.net so sorry for the n00b question)
  #2 (permalink)  
Old October 5th, 2007, 12:51 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

The best way to do this is to see how the current Product class works. You can, for example, search the whole web site for PictureUrlSmall. Everywhere you see this property, duplicate the code for the Author and Grade columns. This involves pages in the site and in the Management folder and classes in the App_Data folder.

Then make the same changes in the various stored procedures that are used in the database.

Does this help?

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
  #3 (permalink)  
Old October 8th, 2007, 03:49 AM
Authorized User
 
Join Date: Oct 2007
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello imar
Thank you for the fast reply

i've edited all the files and scanned them for the pictureUrlSmall

and also al the Database files

But i get the following error:


 
Quote:
quote: Author
Quote:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: Author

Source Error:

Line 162: Catch ex As Exception
Line 163: ' Pass up the error; it will be caught by the code in the Global.asax and the generic error page set up in web.config.
Line 164: Throw
Line 165: End Try
Line 166: Return productList


Source File: C:\Documents and Settings\Christian\Mijn documenten\Visual Studio 2005\WebSites\Nieuwe map\WebShop\App_Code\DataAccess\ShopManagerDB.vb Line: 164
  #4 (permalink)  
Old October 8th, 2007, 04:10 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Sounds like you haven't modified the stored procedures in the database to include the new columns. Without those columns in the procedures, GetOrdinal in GetProducts will throw the error you mentioned.

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
  #5 (permalink)  
Old October 8th, 2007, 04:23 AM
Authorized User
 
Join Date: Oct 2007
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey indeed you where right

but now i have the following problem

I am trying to insert a new product
so ive copied the function of the price textbox and delete the range validator.
and pasted a author field here.

so i am filling in some data and i get send to the default page without errors the only thing is he doesn't send the data?

you have any id why not?

And youre book is so asome it really helped me out

  #6 (permalink)  
Old October 8th, 2007, 04:28 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hard to tell without seeing any code. Could you post the *relevant* parts of the code file?

Groeten,

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
  #7 (permalink)  
Old October 8th, 2007, 04:30 AM
Authorized User
 
Join Date: Oct 2007
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i've added the following code:

 
Quote:
quote:<tr>
Quote:
        <td class="Label" valign="top">
          Author:
        </td>
        <td>
          <asp:TextBox ID="AuthorTextBox" runat="server" Text='<%# Bind("Author") %>' Width="300px" />
          <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="AuthorTextBox" ErrorMessage="Please enter the author" Display="Dynamic"></asp:RequiredFieldValidator>
        </td>
      </tr>


And now it doesn't add any product.
Wich code do you want to see more?

  #8 (permalink)  
Old October 8th, 2007, 04:36 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

I don't know. This looks like it should; I see no reason why this wouldn't work.

Try setting a breakpoint in FormView1_ItemInserting, debug the app and see what code gets called.

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
  #9 (permalink)  
Old October 8th, 2007, 05:11 AM
Authorized User
 
Join Date: Oct 2007
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I cant add a breakpoint?

Ive double checked all the files but can't find any reason why it doesnt work all of a sudden :S

i was trying to add a breakpoint in the addproduct.aspx file but i dont have the breakpoint function here?

EDIT:
ive commeted the author insert function but it still doesnt validate?

really weard actually
  #10 (permalink)  
Old October 8th, 2007, 05:19 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

You need to set breakpoints in the code behind.....

---------------------------------------
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
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
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
Adding Color and Size parameters to WEBSHOP Cart. DJPrice BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 March 10th, 2008 01:39 PM
Adding update feature to Webshop mcarol44 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 January 4th, 2008 12:53 PM
delay in adding tables kondapally Crystal Reports 0 January 12th, 2005 02:27 PM



All times are GMT -4. The time now is 12:15 PM.


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