Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 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
  #1 (permalink)  
Old March 15th, 2008, 11:01 AM
Registered User
 
Join Date: Dec 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Input String was not a correct format

Hi, I have modify the code and found that the code on page 501 have "Input String was not a correct format" error when running the shopping cart page.:(

below is the code in red color, my datbase Product table price field is money which same as book sample.



Partial Class ShopItem
    Inherits System.Web.UI.Page

    Protected Sub btnAddToCart_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnAddToCart.Click

        Dim Price As Double = Double.Parse(CType(DataList1.Controls(0).FindContr ol("PriceLabel"), Label).Text)
        Dim ProductName As String = CType(DataList1.Controls(0).FindControl("NameLabel "), Label).Text
        Dim Imagelink As String = CType(DataList1.Controls(0).FindControl("Imagelink "), Label).Text
        Dim ProductID As Integer = CInt(Request.QueryString("ProductID"))

        ' create the cart if it doesn't already exist
        If Profile.Cart Is Nothing Then
            Profile.Cart = New SW.Commerce.SWShoppingCart()
        End If

        ' insert the item
        ' if the item already exists in the cart, 1 will be added to the quantity

        Profile.Cart.Insert(ProductID, Price, 1, ProductName, Imagelink)

        ' return back to the main shop page
        Server.Transfer("default.aspx")
    End Sub
End Class




Similar Threads
Thread Thread Starter Forum Replies Last Post
Input string was not in a correct format Dwizz VB.NET 2002/2003 Basics 8 April 29th, 2010 05:56 AM
Input string was not in a correct format. Silfverduk VB.NET 2002/2003 Basics 1 May 20th, 2006 04:58 AM
input string was not in a correct format kunal.net VS.NET 2002/2003 1 October 11th, 2005 12:18 AM
Input string was not in a correct format Dwizz VB.NET 2002/2003 Basics 2 April 4th, 2005 11:03 AM





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