Wrox Programmer Forums
|
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
 
Old August 2nd, 2008, 03:57 PM
Registered User
 
Join Date: Aug 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Webshop - Overload resolution failed

Many thanks for your truly inspiring book.
Unfortunately have one problem in Webshop application.
Following code generates "Overload resolution failed because no accessible 'New' accepts this number of arguments"
myConnection.Open()
                Using myReader As SqlDataReader = _
                      myCommand.ExecuteReader(CommandBehavior.CloseConne ction)
                    While myReader.Read()
                        theProduct = New Product( _
                  myReader.GetInt32(myReader.GetOrdinal("ProductId") ), _
                            categoryId)
                  theProduct.Title = myReader.GetString(myReader.GetOrdinal("Title"))
                   productList.Add(theProduct)
                    End While
                    myReader.Close()

Any idea why?
 
Old August 3rd, 2008, 03:31 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Glad you like the book so much.

Did you make any changes to the code? This is supposed to work. The code you posted creates a new product by passing two arguments (the productId and the categoryId to the constructor. The Product class has this constructor:
Code:
Public Sub New(ByVal productId As Integer, ByVal theCategoryId As Integer)
  Me._id = productId
  Me._categoryId = theCategoryId
End Sub
So, the code you posted should work provided you haven't modified the Product class constructor in App_Code\BusinessLogic\Product.vb.

Hope this helps,

Imar



---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 8 Overload Constructor KMac BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 9 July 13th, 2007 04:22 AM
Overload for specialization? Raconteur Visual Basic 2005 Basics 2 May 7th, 2007 10:49 AM
Unary operator overload and inheritance Jonax C++ Programming 8 February 27th, 2006 08:50 AM
subtraction operator overload arnie6 C++ Programming 0 April 19th, 2005 07:57 AM
can we overload 'as' keyword g_natarajan_mca General .NET 0 August 30th, 2004 07:42 AM





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