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: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 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 May 15th, 2008, 04:15 PM
LAM LAM is offline
Registered User
 
Join Date: Sep 2006
Location: Miami, Florida, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default AddEditProduct.aspx

Hi Guys!

I just needed to add couple of fields to the products table. I modified all classes involved in handling products, but problems started to appear as soon as I started to modify the AddEditProduct.aspx page. More precisely, when I modified the DetailsView and the ObjectDataSource.

This is the error that I get, and believe me, before I decided to post this message, I tried everything imaginable!

ObjectDataSource 'objCurrProduct' could not find a non-generic method 'UpdateProduct' that has parameters: ID, DepartmentID, Title, Description, SKU, UnitPrice, DiscountPercentage, UnitsInStock, SmallImageUrl, FullImageUrl, UnitCost.

I browsed the entire web (and beyond) and none of the proposed solutions seem to work. This is driving me nuts! Please help!!


LAM.
  #2 (permalink)  
Old May 15th, 2008, 05:05 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Your objCurrProduct ObjectDataSource is looking for an UpdateProduct method with a certain signature, and it cannot find one. It derives the necessary signature from the <UpdateParameters>.

Take a look at the <UpdateParamerers> section under your ObjectDataSource. If you changed your UpdateProduct method, you need to change the <UpdateParamters> to match.

  #3 (permalink)  
Old May 15th, 2008, 07:09 PM
LAM LAM is offline
Registered User
 
Join Date: Sep 2006
Location: Miami, Florida, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Hi Lee, and thanks for answering so quickly.

I decided to post this message after hours (if not days) of trying all sorts of things. Among those things, are the UpdateProduct method and the <UpdateParameters>. Everything seems to match perfectly, and still I cannot get to the source of the error.

Let me include the parameters list for the <UpdateParameters> as well as the signature of the UpdateProduct method.


<UpdateParameters>
           <asp:Parameter Name="id" Type="Int32" />
           <asp:Parameter Name="departmentID" Type="Int32" />
           <asp:Parameter Name="title" Type="String" />
           <asp:Parameter Name="description" Type="String" />
           <asp:Parameter Name="uniCost" Type="Decimal" />
           <asp:Parameter Name="sku" Type="String" />
           <asp:Parameter Name="unitPrice" Type="Decimal" />
           <asp:Parameter Name="discountPercentage" Type="Int32" />
           <asp:Parameter Name="unitsInStock" Type="Int32" />
           <asp:Parameter Name="smallImageUrl" Type="String" />
           <asp:Parameter Name="fullImageUrl" Type="String" />
       </UpdateParameters>




public static int InsertProduct(int departmentID, string title,
         string description, decimal unitCost, string sku, decimal unitPrice, int discountPercentage,
         int unitsInStock, string smallImageUrl, string fullImageUrl)



I also decided to include the property, just in case someone may be wondering if it was part of the class:

      private decimal _unitCost = 0.0m;
      public decimal UnitCost
      {
          get { return _unitCost; }
          set { _unitCost = value; }
      }


LAM.
  #4 (permalink)  
Old May 15th, 2008, 07:24 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Are you perhaps confusing Inserting with Updating?

You posted your InsertProduct method. The error, however, deals with the UpdateProduct method, which is something altogether different.

  #5 (permalink)  
Old May 15th, 2008, 07:28 PM
LAM LAM is offline
Registered User
 
Join Date: Sep 2006
Location: Miami, Florida, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Lee Dumond
 Are you perhaps confusing Inserting with Updating?

You posted your InsertProduct method. The error, however, deals with the UpdateProduct method, which is something altogether different.

Sorry, I posted insert but I meant Update. Here is the one:

public static bool UpdateProduct(int id, int departmentID, string title,
        string description, decimal uniCost, string sku, decimal unitPrice, int discountPercentage,
        int unitsInStock, string smallImageUrl, string fullImageUrl)



LAM.
  #6 (permalink)  
Old May 15th, 2008, 09:23 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Can you post your whole ObjectDataSource?

  #7 (permalink)  
Old May 15th, 2008, 09:30 PM
LAM LAM is offline
Registered User
 
Join Date: Sep 2006
Location: Miami, Florida, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Lee Dumond
 Can you post your whole ObjectDataSource?
Yes, I am including it below.

Also I wanted to mention that I already tried setting OldValuesParameterFormatString={0} (in the properties window) and still not working. (Here is why I mentioned this: http://msdn.microsoft.com/en-us/library/bb332381.aspx)

Here is my ObjectDataSource:

<asp:ObjectDataSource ID="objCurrProduct" runat="server" DeleteMethod="DeleteProduct"
   SelectMethod="GetProductByID" TypeName="MB.TheBeerHouse.BLL.Store.Product" InsertMethod="InsertProduct" UpdateMethod="UpdateProduct">
      <DeleteParameters>
         <asp:Parameter Name="id" Type="Int32" />
      </DeleteParameters>
      <SelectParameters>
          <asp:QueryStringParameter Name="productID" QueryStringField="ID" Type="Int32" />
      </SelectParameters>
       <InsertParameters>
           <asp:Parameter Name="departmentID" Type="Int32" />
           <asp:Parameter Name="title" Type="String" />
           <asp:Parameter Name="description" Type="String" />
           <asp:Parameter Name="unitCost" Type="Decimal" />
           <asp:Parameter Name="sku" Type="String" />
           <asp:Parameter Name="unitPrice" Type="Decimal" />
           <asp:Parameter Name="discountPercentage" Type="Int32" />
           <asp:Parameter Name="unitsInStock" Type="Int32" />
           <asp:Parameter Name="smallImageUrl" Type="String" />
           <asp:Parameter Name="fullImageUrl" Type="String" />
       </InsertParameters>
       <UpdateParameters>
           <asp:Parameter Name="id" Type="Int32" />
           <asp:Parameter Name="departmentID" Type="Int32" />
           <asp:Parameter Name="title" Type="String" />
           <asp:Parameter Name="description" Type="String" />
           <asp:Parameter Name="unitCost" Type="Decimal" /> <asp:Parameter Name="sku" Type="String" />
           <asp:Parameter Name="unitPrice" Type="Decimal" />
           <asp:Parameter Name="discountPercentage" Type="Int32" />
           <asp:Parameter Name="unitsInStock" Type="Int32" />
           <asp:Parameter Name="smallImageUrl" Type="String" />
           <asp:Parameter Name="fullImageUrl" Type="String" />

       </UpdateParameters>
   </asp:ObjectDataSource>


Here is the error one more time:

ObjectDataSource 'objCurrProduct' could not find a non-generic method 'UpdateProduct' that has parameters: ID, DepartmentID, Title, Description, UnitCost, SKU, UnitPrice, DiscountPercentage, UnitsInStock, SmallImageUrl, FullImageUrl

LAM.
  #8 (permalink)  
Old May 15th, 2008, 09:48 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Your UpdateProduct method seems to have uniCost instead of unitCost as a parameter. Could that be it?

  #9 (permalink)  
Old May 15th, 2008, 09:53 PM
LAM LAM is offline
Registered User
 
Join Date: Sep 2006
Location: Miami, Florida, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Lee Dumond
 Your UpdateProduct method seems to have uniCost instead of unitCost as a parameter. Could that be it?
For a moment I wish that that was the problem, but again, it was an error when copying... I have the correct spelling in my code. I checked line-by-line.

If you take a look at the link that I posted in my previous message, the guy from the tutorial, reproduces the same error and posts the solution. Unfortunately it is not working in my case. I do not know what else to do.

LAM.
  #10 (permalink)  
Old May 15th, 2008, 10:48 PM
LAM LAM is offline
Registered User
 
Join Date: Sep 2006
Location: Miami, Florida, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Lee Dumond
 Your UpdateProduct method seems to have uniCost instead of unitCost as a parameter. Could that be it?
Apparently the problem is solved. You were right!!! I had uniCost (no "t" in unit) as a parameter in the UpdateProduct method. I was looking at other overload of the same method that had the correct unitCost parameter.

Anyway, shouldn't .net care about the type of the parameter (string, int, etc) and the position (method signature) instead of the actual name of the parameter??

Thanks so much for your help!!! I really appreciate it.

Take care.





LAM.
 


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
New.aspx works but login.aspx fails Validation nigelhamilton BOOK: ASP.NET Website Programming Problem-Design-Solution 8 September 13th, 2004 02:29 AM
New.aspx works but not Login.aspx ? reidcor BOOK: ASP.NET Website Programming Problem-Design-Solution 2 May 24th, 2004 10:32 AM
new to ASPX wesamo ASP.NET 1.0 and 1.1 Basics 2 April 19th, 2004 11:50 PM
HowTo Pass Form data from Page1.aspx to Page2.aspx dati ASP.NET 1.0 and 1.1 Basics 6 January 27th, 2004 05:57 AM



All times are GMT -4. The time now is 01:52 AM.


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