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 |
|
{ |
30 |
|
return string.Format(@"Data Source={0}\{1};AttachDbFilename=|DataDirectory|\{2};Integrated Security=SSPI", DBServerAddress, DBServerInstance, DBDatabase); |
31 |
|
} |
32 |
|
|
33 |
< |
public override bool ClientRunScript(string[] strCommands, out Exception ErrorInfo) |
33 |
> |
protected override bool ClientRunScript(string strFile, out Exception ErrorInfo) |
34 |
|
{ |
35 |
|
ErrorInfo = null; |
36 |
|
try |
37 |
|
{ |
38 |
< |
foreach (string strCmd in strCommands) |
39 |
< |
{ |
38 |
< |
if (strCmd.Length > 0) |
39 |
< |
{ |
40 |
< |
Logging.DatabaseLog.DebugFormat("Current Command: {0}{1}", System.Environment.NewLine, strCmd); |
41 |
< |
// Substitute database directory with the decided one. |
42 |
< |
SqlCommand command = this.CreateCommandInstance(strCmd, new List<SqlParameter>(), out ErrorInfo); |
43 |
< |
command.ExecuteNonQuery(); |
44 |
< |
} |
45 |
< |
} |
38 |
> |
Server server = new Server(new ServerConnection(this.connection)); |
39 |
> |
server.ConnectionContext.ExecuteNonQuery(strFile); |
40 |
|
return true; |
41 |
|
} |
42 |
|
catch (Exception ex) |