跳到主要內容

[ASP.NET] 攔劫SQL EXEC. TIMEOUT

今天系統突然遇到SQL執行TIMEOUT的問題,
程式如何CATCH這個問題,很簡單,運用"SQLException"就可以了,語法如下
            try
            {
                command.Connection.Open();
                command.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                for (int i = 0; i < ex.Errors.Count; i++)
                {
                    errorMessages.Append("Index #" + i + "\n" +
                        "Message: " + ex.Errors[i].Message + "\n" +
                        "Error Number: " + ex.Errors[i].Number + "\n" +
                        "LineNumber: " + ex.Errors[i].LineNumber + "\n" +
                        "Source: " + ex.Errors[i].Source + "\n" +
                        "Procedure: " + ex.Errors[i].Procedure + "\n");
                }
                Console.WriteLine(errorMessages.ToString());
            }

switch ( sqlException.Number )
        {
            case -2:   // Client Timeout
            case 701:  // Out of Memory
            case 1204: // Lock Issue 

            case 1205: // >>> Deadlock Victim

            case 1222: // Lock Request Timeout
            case 8645: // Timeout waiting for memory resource 
            case 8651: // Low memory condition 
            ...
        }

  




留言

這個網誌中的熱門文章

台大教授的網站

陳少傑教授 http://soclab.ee.ntu.edu.tw/http2005/ CAD System Lab 軟硬體共同設計 (Hardware-Software Co-Design) Introduction to Electronic Design Automation 計算機結構 (Computer Architecture) 陳耀文教授 Introduction to Digital systems, Spring 1998 Introduction to VLSI Design, Fall 2000 Physical Design for Nanometer ICs, Spring 2007 Algorithms, Fall 2007 NTU SOC VSLI-EDA

好用的TinyMCE編輯器,安裝、相關說明及問題如下

安裝/相關說明參考位置: http://www.ezluk.org/Posts/example/28 http://blog.nlhs.tyc.edu.tw/post/2/63 http://big5.yesky.com/b5/homepage.yesky.com/72/2616072.shtml http://siusun.best-view.net/blog/index.php?op=ViewArticle&articleId=64&blogId=1 所有可用的按鈕列表 http://www.inpeck.com/TinyMceManual/reference_buttons.html 遇到一個問題:textarea欄位無法驗證,解決如下: tinyMCE.triggerSave(); //手動save 參考位置: http://www.blueshop.com.tw/board/show.asp?subcde=BRD20050906055416BA0