/// <summary>Sets the external data access object</summary> /// <param name="Query">ExternalQuery object holding all parameters</param> private void SetExternalDatabase(ExternalQueryInfo Query) { if (_browser.Tree.Cache.ContainsKey("ROOT")) { ServerItem si = _browser.Tree.Cache["ROOT"].FirstOrDefault(s => s.Name == Query.Server) as ServerItem; _externalDab = DataAccessFactory.GetDataAccess(si.DataAccess.ConnectionType, si.DataAccess.DataSource, si.DataAccess.SelectedDatabase, si.DataAccess.Authentication, si.DataAccess.Username, si.DataAccess.Password); string oldDb = _externalDab.SelectedDatabase; _externalDab.SetDatabase(Query.Database); if (_externalDab.SelectedDatabase.ToUpper() != Query.Database.ToUpper()) { _externalDab.SetDatabase(oldDb); throw new Exception("Could not set the database context for the extraserver query."); } } else { throw new Exception("I'm sorry, I don't know what server that is."); } }