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

Comparing trunk/AnywhereTS.DBSupport/SqlMdfConnector.cs (file contents):
Revision 89 by william, Fri Jul 13 22:56:50 2012 UTC vs.
Revision 119 by william, Sat Jul 14 09:08:55 2012 UTC

--- trunk/AnywhereTS.DBSupport/SqlMdfConnector.cs	2012/07/13 22:56:50	89
+++ trunk/AnywhereTS.DBSupport/SqlMdfConnector.cs	2012/07/14 09:08:55	119
@@ -25,7 +25,31 @@ namespace AnywhereTS.DBSupport
 
         new public static string GetConnectionString()
         {
-            return string.Format(@"Data Source={0}\{1};;AttachDbFilename=|DataDirectory|\{2};Integrated Security=SSPI", DBServerAddress, DBServerInstance, DBDatabase);
+            return string.Format(@"Data Source={0}\{1};AttachDbFilename=|DataDirectory|\{2};Integrated Security=SSPI", DBServerAddress, DBServerInstance, DBDatabase);
+        }
+
+        public override bool ClientRunScript(string[] strCommands, out Exception ErrorInfo)
+        {
+            ErrorInfo = null;
+            try
+            {
+                foreach (string strCmd in strCommands)
+                {
+                    if (strCmd.Length > 0)
+                    {
+                        Logging.DatabaseLog.DebugFormat("Current Command: {0}{1}", System.Environment.NewLine, strCmd);
+                        // Substitute database directory with the decided one.
+                        SqlCommand command = this.CreateCommandInstance(strCmd, new List<SqlParameter>(), out ErrorInfo);
+                        command.ExecuteNonQuery();
+                    }
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                ErrorInfo = ex;
+                return false;
+            }
         }
     }
 }