/[AnywhereTS-MSSQL]/trunk/AnywhereTS.DBSupport/DBConnector.cs
ViewVC logotype

Diff of /trunk/AnywhereTS.DBSupport/DBConnector.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/AnywhereTS.DBSupport/DBConnector.cs	2012/07/14 11:44:52	125
+++ trunk/AnywhereTS.DBSupport/DBConnector.cs	2012/07/14 13:01:52	128
@@ -79,7 +79,8 @@
             }
             catch (SqlException ex)
             {
-                using (log4net.NDC.Push(string.Format("SqlException: ID={0} MESSAGE={1}{2}Diagnostics:{2}{3}", ex.Number.ToString(), ex.Message, System.Environment.NewLine, ex.ToString())))
+                SqlException e = (ex.GetBaseException() as SqlException);
+                using (log4net.NDC.Push(string.Format("SqlException: ID={0} MESSAGE={1}{2}Diagnostics:{2}{3}", e.Number.ToString(), e.Message, System.Environment.NewLine, e.ToString())))
                 {
                     Logging.DatabaseLog.Error(string.Format("Failed to create command instance using command: {0}", command));
                 }
@@ -87,7 +88,8 @@
             }
             catch (Exception ex)
             {
-                using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", ex.GetType().Name, ex.Message, System.Environment.NewLine, ex.ToString())))
+                Exception e = ex.GetBaseException();
+                using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", e.GetType().Name, e.Message, System.Environment.NewLine, e.ToString())))
                 {
                     Logging.DatabaseLog.Error(string.Format("Failed to create command instance using command: {0}", command));
                 }
@@ -327,19 +329,21 @@
             }
             catch (SqlException ex)
             {
-                using (log4net.NDC.Push(string.Format("SqlException: ID={0} MESSAGE={1}{2}Diagnostics:{2}{3}", ex.Number.ToString(), ex.Message, System.Environment.NewLine, ex.ToString())))
+                SqlException e = (ex.GetBaseException() as SqlException);
+                using (log4net.NDC.Push(string.Format("SqlException: ID={0} MESSAGE={1}{2}Diagnostics:{2}{3}", e.Number.ToString(), e.Message, System.Environment.NewLine, e.ToString())))
                 {
                     Logging.DatabaseLog.Error(string.Format("Failed to run script: {0}{1}", System.Environment.NewLine, strFile));
                 }
-                ErrorInfo = ex;
+                ErrorInfo = ex; throw ErrorInfo;
             }
             catch (Exception ex)
             {
-                using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", ex.GetType().Name, ex.Message, System.Environment.NewLine, ex.ToString())))
+                Exception e = ex.GetBaseException();
+                using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", e.GetType().Name, e.Message, System.Environment.NewLine, e.ToString())))
                 {
                     Logging.DatabaseLog.Error(string.Format("Failed to run script: {0}{1}", System.Environment.NewLine, strFile));
                 }
-                ErrorInfo = ex;
+                ErrorInfo = ex; throw ErrorInfo;
             }
             return false;
         }

 

  ViewVC Help
Powered by ViewVC 1.1.22