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

Comparing trunk/AnywhereTS.DBSupport/MSSQLConnector.cs (file contents):
Revision 122 by william, Sat Jul 14 09:08:55 2012 UTC vs.
Revision 123 by william, Sat Jul 14 11:14:09 2012 UTC

# Line 2 | Line 2
2   using System.Collections.Generic;
3   using System.Text;
4   using System.Data.SqlClient;
5 + using Microsoft.SqlServer.Management.Common;
6 + using Microsoft.SqlServer.Management.Smo;
7  
8   namespace AnywhereTS.DBSupport
9   {
# Line 9 | Line 11 | namespace AnywhereTS.DBSupport
11      {
12          public MsSqlConnector(string DBServerAddress, string DBServerInstance, string DBDatabase) : base(DBServerAddress, DBServerInstance, DBDatabase) { }
13  
14 <        public override bool ClientRunScript(string[] strCommands, out Exception ErrorInfo)
14 >
15 >        protected override bool ClientRunScript(string strFile, out Exception ErrorInfo)
16          {
17              ErrorInfo = null;
18              try
19              {
20 <                foreach (string strCmd in strCommands)
21 <                {
19 <                    if (strCmd.Length > 0)
20 <                    {
21 <                        Logging.DatabaseLog.DebugFormat("Current Command: {0}{1}",System.Environment.NewLine, strCmd);
22 <                        // Substitute database directory with the decided one.
23 <                        SqlCommand command = this.CreateCommandInstance(strCmd, new List<SqlParameter>(), out ErrorInfo);
24 <                        command.ExecuteNonQuery();
25 <                    }
26 <                }
20 >                Server server = new Server(new ServerConnection(this.connection));
21 >                server.ConnectionContext.ExecuteNonQuery(strFile);
22                  return true;
23              }
24              catch (Exception ex)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines