/[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 09:08:55	119
+++ trunk/AnywhereTS.DBSupport/DBConnector.cs	2012/07/14 09:40:33	121
@@ -97,12 +97,17 @@
         public virtual void CreateConnection(out Exception ErrorInfo)
         {
             ErrorInfo = null;
+            string connetionString = string.Empty;
             try
-            {
-                string connetionString = null;
+            {                
                 connetionString = GetConnectionString();
-                connection = new DBConnection();
-                connection.ConnectionString = connetionString;
+                using (log4net.NDC.Push(string.Format("connetionString={0}", connetionString)))
+                {
+                    Logging.DatabaseLog.Debug("Creating Connection");
+                    connection = new DBConnection();
+                    connection.ConnectionString = connetionString;
+                    Logging.DatabaseLog.Debug("Created Connection");
+                }
             }
             catch (SqlException ex)
             {
@@ -126,11 +131,18 @@
         public virtual void OpenConnection(out Exception ErrorInfo)
         {
             ErrorInfo = null;
+            string connetionString = string.Empty;
             try
             {
                 //this.CloseConnection(out ErrorInfo);
-                connection.Open();
-                this.ConnectionIsOpen = true;
+                connetionString = GetConnectionString();
+                using (log4net.NDC.Push(string.Format("connectionString={0}", connetionString)))
+                {
+                    Logging.DatabaseLog.Debug("Opening Connection");
+                    connection.Open();
+                    this.ConnectionIsOpen = true;
+                    Logging.DatabaseLog.Debug("Opened Connection");
+                }
             }
             //catch (SqlException ex) { Console.WriteLine(ex.ToString()); ErrorInfo = ex;  throw ErrorInfo;}
             catch (SqlException ex)

 

  ViewVC Help
Powered by ViewVC 1.1.22