--- trunk/AnywhereTS.DBSupport/SqlMdfConnector.cs 2012/07/14 09:08:55 119 +++ 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 { @@ -28,21 +30,13 @@ namespace AnywhereTS.DBSupport 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) + protected override bool ClientRunScript(string strFile, 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(); - } - } + Server server = new Server(new ServerConnection(this.connection)); + server.ConnectionContext.ExecuteNonQuery(strFile); return true; } catch (Exception ex) |