public override void RefreshSchema(bool preferSilent) { try { this.SuppressDataSourceEvents(); bool flag = false; IServiceProvider site = this.SqlDataSource.Site; if (!this.CanRefreshSchema) { if (!preferSilent) { UIServiceHelper.ShowError(site, System.Design.SR.GetString("SqlDataSourceDesigner_RefreshSchemaRequiresSettings")); } } else { IDataSourceViewSchema schema = this.GetView("DefaultView").Schema; bool flag2 = false; if (schema == null) { this._forceSchemaRetrieval = true; schema = this.GetView("DefaultView").Schema; this._forceSchemaRetrieval = false; flag2 = true; } DesignerDataConnection connection = new DesignerDataConnection(string.Empty, this.ProviderName, this.ConnectionString); if (preferSilent) { flag = this.RefreshSchema(connection, this.SelectCommand, this.SqlDataSource.SelectCommandType, this.SqlDataSource.SelectParameters, true); } else { Parameter[] parameterArray = this.InferParameterNames(connection, this.SelectCommand, this.SqlDataSource.SelectCommandType); if (parameterArray == null) { return; } ParameterCollection parameters = new ParameterCollection(); ParameterCollection parameters2 = new ParameterCollection(); foreach (ICloneable cloneable in this.SqlDataSource.SelectParameters) { parameters2.Add((Parameter) cloneable.Clone()); } foreach (Parameter parameter in parameterArray) { if ((parameter.Direction == ParameterDirection.Input) || (parameter.Direction == ParameterDirection.InputOutput)) { Parameter parameter2 = parameters2[parameter.Name]; if (parameter2 != null) { parameter.DefaultValue = parameter2.DefaultValue; if ((parameter.DbType == DbType.Object) && (parameter.Type == TypeCode.Empty)) { parameter.DbType = parameter2.DbType; parameter.Type = parameter2.Type; } parameters2.Remove(parameter2); } parameters.Add(parameter); } } if (parameters.Count > 0) { SqlDataSourceRefreshSchemaForm form = new SqlDataSourceRefreshSchemaForm(site, this, parameters); flag = UIServiceHelper.ShowDialog(site, form) == DialogResult.OK; } else { flag = this.RefreshSchema(connection, this.SelectCommand, this.SqlDataSource.SelectCommandType, parameters, false); } } if (flag) { IDataSourceViewSchema schema2 = this.GetView("DefaultView").Schema; if (flag2 && DataSourceDesigner.ViewSchemasEquivalent(schema, schema2)) { this.OnDataSourceChanged(EventArgs.Empty); } else if (!DataSourceDesigner.ViewSchemasEquivalent(schema, schema2)) { this.OnSchemaRefreshed(EventArgs.Empty); } } } } finally { this.ResumeDataSourceEvents(); } }