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


 


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



All times are GMT -4. The time now is 09:49 PM.


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