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

October 5th, 2007, 04:29 AM
|
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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)
|
|

October 5th, 2007, 12:51 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

October 8th, 2007, 03:49 AM
|
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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:
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
|
|
|

October 8th, 2007, 04:10 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

October 8th, 2007, 04:23 AM
|
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

October 8th, 2007, 04:30 AM
|
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
i've added the following code:
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?
|
|

October 8th, 2007, 04:36 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

October 8th, 2007, 05:11 AM
|
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|
 |