public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { System.Data.IDbCommand command = (System.Data.IDbCommand)context.Instance; if (command.Connection == null) { MessageBox.Show("Connection property not set to a valid connection.\n"+ "Please set and try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return value; } SqlCommandEditorDlg dlg = new SqlCommandEditorDlg( command ); dlg.SQL = (string)value; if(dlg.ShowDialog() == DialogResult.OK) { return dlg.SQL; } else return value; }
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { System.Data.IDbCommand command = (System.Data.IDbCommand)context.Instance; if (command.Connection == null) { MessageBox.Show("Connection property not set to a valid connection.\n" + "Please set and try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(value); } SqlCommandEditorDlg dlg = new SqlCommandEditorDlg(command); dlg.SQL = (string)value; if (dlg.ShowDialog() == DialogResult.OK) { return(dlg.SQL); } else { return(value); } }