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

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

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

revision 122 by william, Sat Jul 14 09:08:55 2012 UTC revision 123 by william, Sat Jul 14 11:14:09 2012 UTC
# Line 2  Line 2 
2  using System.Collections.Generic;  using System.Collections.Generic;
3  using System.Text;  using System.Text;
4  using System.Data.SqlClient;  using System.Data.SqlClient;
5    using Microsoft.SqlServer.Management.Common;
6    using Microsoft.SqlServer.Management.Smo;
7    
8  namespace AnywhereTS.DBSupport  namespace AnywhereTS.DBSupport
9  {  {
# Line 9  namespace AnywhereTS.DBSupport Line 11  namespace AnywhereTS.DBSupport
11      {      {
12          public MsSqlConnector(string DBServerAddress, string DBServerInstance, string DBDatabase) : base(DBServerAddress, DBServerInstance, DBDatabase) { }          public MsSqlConnector(string DBServerAddress, string DBServerInstance, string DBDatabase) : base(DBServerAddress, DBServerInstance, DBDatabase) { }
13    
14          public override bool ClientRunScript(string[] strCommands, out Exception ErrorInfo)  
15            protected override bool ClientRunScript(string strFile, out Exception ErrorInfo)
16          {          {
17              ErrorInfo = null;              ErrorInfo = null;
18              try              try
19              {              {
20                  foreach (string strCmd in strCommands)                  Server server = new Server(new ServerConnection(this.connection));
21                  {                  server.ConnectionContext.ExecuteNonQuery(strFile);
                     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();  
                     }  
                 }  
22                  return true;                  return true;
23              }              }
24              catch (Exception ex)              catch (Exception ex)

Legend:
Removed from v.122  
changed lines
  Added in v.123

  ViewVC Help
Powered by ViewVC 1.1.22