Пример #1
0
 protected override void DisconnectInternal()
 {
     this._dmoServer.DisConnect();
     this._dmoServer = null;
     this._dmoDatabase = null;
 }
Пример #2
0
 protected override void ConnectInternal()
 {
     this._dmoServer = (Interop.ISqlServer) new Interop.SqlServer();
     this._dmoServer.SetLoginSecure(this._connectionSettings.SecureConnection);
     this._dmoServer.Connect(this._connectionSettings.Server, this._connectionSettings.Username, this._connectionSettings.Password);
     if ((this._connectionSettings.Database != null) && (this._connectionSettings.Database.Length > 0))
     {
         Interop.IDatabases databases = this._dmoServer.GetDatabases();
         for (int i = 1; i <= databases.GetCount(); i++)
         {
             Interop.IDatabase database = databases.Item(i, string.Empty);
             if (database.GetName().ToLower() == this._connectionSettings.Database.ToLower())
             {
                 this._dmoDatabase = database;
                 return;
             }
         }
     }
 }