.NET Logo
Welcome Guest Search | Active Topics | Members | Log In | Register

รบกวนอาจารย์ ช่วยดู error ของ BalloonShop ให้หน่อยค่ะ จะส่งงานแล้วค่ะ Options · View
Sikiriya
Posted: Thursday, February 21, 2008 12:49:33 PM
Rank: มือฝึกหัด
Groups: Member

Joined: 1/24/2008
Posts: 4

หลังจากเข้าไป log in และเลือกสินค้าตามปกติ ก็กดปุ่ม Place Order  ก็จะเจอ errore  ตรง status

 public CommerceLibOrderInfo(DataRow orderRow)

{Int32.Parse(orderRow["OrderID"].ToString());"DateCreated"].ToString();"DateShipped"].ToString();"Comments"].ToString();Status = Int32.Parse(orderRow["Status"].ToString());"AuthCode"].ToString();"Reference"].ToString();Membership.GetUser(new Guid(orderRow["CustomerID"].ToString()));HttpContext.Current.Profile as ProfileCommon)new SecureCard(CustomerProfile.CreditCard);

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.FormatException: Input string was not in a correct format.

Source Error:

Line 391:        DateShipped = orderRow["DateShipped"].ToString();
Line 392:        Comments = orderRow["Comments"].ToString();
Line 393:        Status = Int32.Parse(orderRow["Status"].ToString());
Line 394:        AuthCode = orderRow["AuthCode"].ToString();
Line 395:        Reference = orderRow["Reference"].ToString();

Source File: f:\Sirikanya AspNet 2 Learning\BalloonShop\App_Code\CommerceLibAccess.cs    Line: 393

Stack Trace:

[FormatException: Input string was not in a correct format.]
   System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2755599
   System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +112
   System.Int32.Parse(String s) +20
   CommerceLibOrderInfo..ctor(DataRow orderRow) in f:\Sirikanya AspNet 2 Learning\BalloonShop\App_Code\CommerceLibAccess.cs:393
   CommerceLibAccess.GetOrder(String orderID) in f:\Sirikanya AspNet 2 Learning\BalloonShop\App_Code\CommerceLibAccess.cs:648
   CommerceLib.OrderProcessor..ctor(String orderID) in f:\Sirikanya AspNet 2 Learning\BalloonShop\App_Code\CommerceLib\OrderProcessor.cs:28
   Checkout.placeOrderButton_Click(Object sender, EventArgs e) in f:\Sirikanya AspNet 2 Learning\BalloonShop\Checkout.aspx.cs:145
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

 

Server Error in '/BalloonShop' Application.

Input string was not in a correct format.

 

ลอง hard code ด้วยการกำหนดให้ status=1 ก็ผ่านจุดนี้ไปได้นะคะ แต่ก็ไปติด ตรง credit card อีก รบกวนอาจารย์ช่วยเรื่องแรกก่อนนะคะ เดี๋ยวเรื่อง credit card ค่อยแก้ก็ได้ค่ะ

 

fronzen
Posted: Sunday, September 07, 2008 9:52:05 PM
Rank: มือสมัครเล่น
Groups: Member

Joined: 4/22/2008
Posts: 18

แปลง string เป็น integer แบบนี้ได้ด้วยเหรอครับ

ลองแบบนี้ไหมครับ

status = val(orderRow("Status").tostring)

ball
Posted: Sunday, September 07, 2008 10:07:59 PM

Rank: อาจารย์
Groups: Administration

Joined: 12/1/2007
Posts: 462
Location: Bangkok

ก่อนอื่นเช็ค order เก่าๆ ก่อนนะครับว่า Status เป็น null รึเปล่า ถ้าเป็น null ให้เปลี่ยนเป็น 0 ซะ

และลองดูที่ Default Value ที่ Status สิว่าเป็น 0 รึเปล่า และต้องไม่ Allow Null ด้วยนะ



Imagination is more Important than Knowledge... /A.Einstein
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.


Sponsored by