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

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

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

revision 124 by william, Sat Jul 14 11:14:09 2012 UTC revision 125 by william, Sat Jul 14 11:44:52 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;  using System.Linq;
6  using Microsoft.SqlServer.Management.Smo;  using System.Text.RegularExpressions;
   
7  namespace AnywhereTS.DBSupport  namespace AnywhereTS.DBSupport
8  {  {
9      public class SqlMdfConnector : DBConnector<SqlParameter, SqlCommand, SqlConnection, SqlDataAdapter>      public class SqlMdfConnector : DBConnector<SqlParameter, SqlCommand, SqlConnection, SqlDataAdapter>
# Line 34  namespace AnywhereTS.DBSupport Line 33  namespace AnywhereTS.DBSupport
33          {          {
34              ErrorInfo = null;              ErrorInfo = null;
35              try              try
36              {              {                
37                  Server server = new Server(new ServerConnection(this.connection));                  var commands = Regex.Split(strFile, string.Format(@"^GO${0}", System.Environment.NewLine), RegexOptions.IgnoreCase | RegexOptions.Multiline);
38                  server.ConnectionContext.ExecuteNonQuery(strFile);                  foreach (var command in commands)
39                    {
40                        SqlCommand sqlcmd = this.CreateCommandInstance(command, new List<SqlParameter>(), out ErrorInfo);
41                        if (ErrorInfo != null)
42                            throw ErrorInfo;
43                        sqlcmd.ExecuteNonQuery();
44                    }
45                  return true;                  return true;
46              }              }
47              catch (Exception ex)              catch (Exception ex)

Legend:
Removed from v.124  
changed lines
  Added in v.125

  ViewVC Help
Powered by ViewVC 1.1.22