1 |
using System; |
2 |
using System.Collections.Generic; |
3 |
using System.Text; |
4 |
using System.Data.SqlClient; |
5 |
|
6 |
namespace AnywhereTS.DBSupport |
7 |
{ |
8 |
public class MsSqlConnector : DBConnector<SqlParameter,SqlCommand,SqlConnection,SqlDataAdapter> |
9 |
{ |
10 |
public MsSqlConnector(string DBServerAddress, string DBServerInstance, string DBDatabase) : base(DBServerAddress, DBServerInstance, DBDatabase) { } |
11 |
|
12 |
public override bool ClientRunScript(string[] strCommands, out Exception ErrorInfo) |
13 |
{ |
14 |
ErrorInfo = null; |
15 |
try |
16 |
{ |
17 |
foreach (string strCmd in strCommands) |
18 |
{ |
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 |
} |
27 |
return true; |
28 |
} |
29 |
catch (Exception ex) |
30 |
{ |
31 |
ErrorInfo = ex; |
32 |
return false; |
33 |
} |
34 |
} |
35 |
} |
36 |
} |