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

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

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

--- trunk/AnywhereTS.DBSupport/SqlMdfConnector.cs	2012/07/13 22:56:50	89
+++ trunk/AnywhereTS.DBSupport/SqlMdfConnector.cs	2012/07/14 11:14:09	123
@@ -2,6 +2,8 @@
 using System.Collections.Generic;
 using System.Text;
 using System.Data.SqlClient;
+using Microsoft.SqlServer.Management.Common;
+using Microsoft.SqlServer.Management.Smo;
 
 namespace AnywhereTS.DBSupport
 {
@@ -25,7 +27,23 @@
 
         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);
+        }
+
+        protected override bool ClientRunScript(string strFile, out Exception ErrorInfo)
+        {
+            ErrorInfo = null;
+            try
+            {
+                Server server = new Server(new ServerConnection(this.connection));
+                server.ConnectionContext.ExecuteNonQuery(strFile);
+                return true;
+            }
+            catch (Exception ex)
+            {
+                ErrorInfo = ex;
+                return false;
+            }
         }
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22