public IDbConnection OpenConnection(string database) { //dbRoot mymeta = new dbRoot(); dbRoot mymeta = CurrentDbRoot(); IDbConnection _connection = null; try { // special code to handle databases that cannot have multiple open connections. object v = mymeta.PluginSpecificData(DbDriver, "requiresinternalconnection"); if (v != null && v.GetType() == typeof(bool)) { if ((bool)v) { _connection = mymeta.PluginSpecificData(DbDriver, "internalconnection") as IDbConnection; } } // The standard connection code. if (_connection == null) { _connection = mymeta.BuildConnection(DbDriver, ConnectionString); } if (_connection != null) { if (_connection.State != ConnectionState.Open) { _connection.Open(); } if (!string.IsNullOrEmpty(database)) { mymeta.ChangeDatabase(_connection, database); } } } catch (Exception ex) { this._mdi.ErrorList.AddErrors(ex); } return(_connection); }