2013-11-28 67 views
0

我在我的方法中使用了try catch,並且我收到了此消息「無法評估表達式,因爲代碼已經優化或者本機框架位於調用堆棧頂部」,但方法執行成功(數據保存在數據庫中)。 這裏是我的代碼:方法成功但返回錯誤

  try 
      { 
       //saving EmailMoney Table and Transactions Table 
       string EmailMoneyCode = HelperClasses.Globals.RandomString(20); 
       LogicLayer.Entities.Transaction NewTransaction = new LogicLayer.Entities.Transaction(); 

       NewTransaction.EmailMoneyTransaction.EmailRecipientID = Convert.ToInt32(ddlRecipients.SelectedValue); 
       NewTransaction.EmailMoneyTransaction.EmailMoneyGeneratedCode = EmailMoneyCode; 

       NewTransaction.SourceAccountID = VirtualAccountIDFrom; 
       NewTransaction.SourceCurrencyID = CurrencyIDFrom; 
       NewTransaction.SourceAmount = AmountToWithdraw; 
       NewTransaction.ReceivingAmount = Amount; 
       NewTransaction.Fee = FeeConverted; 
       NewTransaction.SubTransactionType = DataLayer.Enums.RefSubTransactionType.EmailTransfer; 

       NewTransaction.Save(); 
       UpdateVABalance(VirtualAccountIDFrom, AmountToWithdraw); 
       Response.Redirect("EmailMoney.aspx?notif=1"); 
      } 
      catch (Exception ex) 
      { 
       divNotif.Attributes["class"] = "notibar msgerror"; 
       divNotif.InnerHtml = "<a class=\"close\"></a><p>" + ex.Message + "</p>"; 
       return; 
      } 

我該如何解決這個問題。提前致謝。

+4

您應該移除'try catch'並查看拋出異常的位置。 –

+0

究竟哪裏(哪條線)你得到錯誤? –

+0

@KingKing我刪除了try catch,沒有錯誤,並且該方法成功執行.. – aianLee

回答

相關問題