private void BuildSchemaTable() { bool mustClose = false; if (this.SelectCommand == null) { throw new InvalidOperationException("The DataAdapter.SelectCommand property needs to be initialized."); } if (this.SelectCommand.Connection == null) { throw new InvalidOperationException("The DataAdapter.SelectCommand.Connection property needs to be initialized."); } if (this.schemaTable == null) { if (this.SelectCommand.Connection.State == ConnectionState.Closed) { mustClose = true; this.SelectCommand.Connection.Open(); } try { FbCommand schemaCmd = (FbCommand)((ICloneable)this.SelectCommand).Clone(); FbDataReader reader = schemaCmd.ExecuteReader(CommandBehavior.SchemaOnly); this.schemaTable = reader.GetSchemaTable(); reader.Close(); schemaCmd.Dispose(); schemaCmd = null; this.CheckSchemaTable(); this.UpdateFormats(); } catch { throw; } finally { if (mustClose) { this.SelectCommand.Connection.Close(); } } } }