ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/AnywhereTS-MSSQL/trunk/AnywhereTS.DBSupport/DBConnector.cs
(Generate patch)

Comparing trunk/AnywhereTS.DBSupport/DBConnector.cs (file contents):
Revision 127 by william, Sat Jul 14 11:44:52 2012 UTC vs.
Revision 128 by william, Sat Jul 14 13:01:52 2012 UTC

--- trunk/AnywhereTS.DBSupport/DBConnector.cs	2012/07/14 11:46:04	127
+++ trunk/AnywhereTS.DBSupport/DBConnector.cs	2012/07/14 13:01:52	128
@@ -79,7 +79,8 @@ namespace AnywhereTS.DBSupport
             }
             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 @@ namespace AnywhereTS.DBSupport
             }
             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 @@ namespace AnywhereTS.DBSupport
             }
             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;
         }