SqlEditor ClassCleanCode C# Libraries v1.2.03 API
A practical SQL edit window and output result grid in one control.
Inheritance Hierarchy

OnlineSystem Object
  OnlineSystem MarshalByRefObject
    OnlineSystem.ComponentModel Component
      OnlineSystem.Windows.Forms Control
        OnlineSystem.Windows.Forms ScrollableControl
          OnlineSystem.Windows.Forms ContainerControl
            OnlineSystem.Windows.Forms UserControl
              CleanCode.SqlEditorControls SqlEditor

Namespace: CleanCode.SqlEditorControls
Assembly: CleanCode.SqlEditorControls (in CleanCode.SqlEditorControls.dll) Version: (1.2.03)

public class SqlEditor : UserControl, IDisplayCommands, 

OnlineSqlEditor -- click for full size This control is a true SQL-editor-in-a-box. Drag it onto your Windows Form and you have a fully functioning editor that may be configured at runtime to connect to any number of different servers and database types (it supports SQL Server, Oracle, and any ODBC data source). Once you define a set of connections in the connection editor, you may export the list and then import it into another copy of the application running on other machines. Click on the thumbnail at right for a screenshot of the SqlEditor.

This control is built on top of several other custom building blocks. A ChameleonRichTextBox provides the editing pane and an ExtendedDataGridView displays the output results. Each of those child controls plus this control itself performs a variety of commands by keystroke, mouse, menu, or context menu. To provide an aid to using them, each provides a pop-up reference detailing all the commands. You need only hook up the ShowUserCommands  method of each to display this. Another major child control is the MultiConnectionStringManager, which provides the connection editor that lets you define database connections, test the connections, encrypts passwords when stored, and imports/exports the connection list.

This control has built-in support for synchronizing its actions with a partner. That is, instantiate two copies of this control and they can scroll together, load files together, and change settings together, once you enable tandem operation (TandemMode and Partner). Features that work in tandem are listed here. The user may override the tandem mode setting (either on or off) for a single action simply by depressing the Ctrl key when performing an action.

  • Load query file.
  • Execute query.
  • Filter DataGridView.
  • Change date format in DataGridView.
  • Increase/decrease row height in the DataGridView.
  • Change column width to fit header/data.
  • Scroll DataGridView vertically or horizontally.
  • Set AutoExecute mode.
  • Set AutoHighlight mode.
  • Set Local/Remote mode.

This class is instrumented with a StructuredTraceSource for diagnostic output. Its key name defaults to SqlEditor. However, if you assign a Partner property, the key name becomes the Name property of the instance in order to allow distinguishing instances in the diagnostic output.

Since CleanCode 0.9.23.

See Also