AdHocSQL Class

User-form for ad-hoc SQL execution

Inheritance Hierarchy

Namespace: DBaddinAssembly: DBaddin in (DBaddin.dll)

Syntax

public class AdHocSQL : Form

The AdHocSQL type exposes the following members.

Constructors

ClassSummary
public constructorAdHocSQL(String, Int32)
create new AdHocSQL dialog

Methods

NameSummary
private methodAdHocSQL_KeyUp(Object, KeyEventArgs)
needed together with KeyPreview=True on form to simulate ESC canceling the form and catching this successfully (preventing closing when canceling an ongoing sql-command)
private methodAdHocSQL_Shown(Object, EventArgs)
execution of ribbon entered command after dialog has been set up, otherwise GUI elements are not available
private methodAdHocSQLQueryResult_DataError(Object, DataGridViewDataErrorEventArgs)
For non displayable data (blobs, etc.) that raise an exception, write out the exception in the data-grid cell tool-tip instead of lots of pop-ups
private methodBackgroundWorker1_DoWork(Object, DoWorkEventArgs)
start sql command and load data into data table in the background (to show progress and have cancellation control)
private methodBackgroundWorker1_RunWorkerCompleted(Object, RunWorkerCompletedEventArgs)
sql command finished, show results. All GUI related work needs to be done in the main thread
private methodClose_Click(Object, EventArgs)
"Close": close dialog with Cancel result
private methodDatabase_KeyDown(Object, KeyEventArgs)
when being on the database also allow Ctrl-Enter
private methodDatabase_SelectionChangeCommitted(Object, EventArgs)
database changed
protected methodDispose(Boolean)
private methodEnvironment_SelectionChangeCommitted(Object, EventArgs)
Change Environment in AdHocSQL
private methodExecute_Click(Object, EventArgs)
executing the SQL command and passing the results to the results pane
private methodexecuteSQL()
private methodfillDatabases()
fills all possible databases of current connection using db proprietary code in dbGetAllStr, data coming from field DBGetAllFieldName
private methodfillDatabasesAndSetDropDown()
fill the Database dropdown
private methodfinishForm(DialogResult)
common procedure to close the form, regarding (canceling) a busy background worker = sqlcmd)
private methodInitializeComponent()
private methodSQLText_KeyDown(Object, KeyEventArgs)
keyboard shortcuts for executing (ctrl-return), Transfer (shift-return) and maybe other things in the future (auto-complete)
private methodTimer1_Tick(Object, EventArgs)
show progress during BackgroundWorker1 execution
private methodTransfer_Click(Object, EventArgs)
"Transfer": close dialog with OK result
private methodTransferType_KeyDown(Object, KeyEventArgs)
when being on the TransferType selection also allow Shift-Enter

Properties

NameSummary
sealed propertiesAdHocSQLQueryResult
sealed propertiesBackgroundWorker1
sealed propertiesCloseBtn
public propertiesDatabase
sealed propertiesEnvSwitch
sealed propertiesExecute
public propertiesLDatabase
public propertiesLEnv1
sealed propertiesRowsReturned
sealed propertiesSplitContainer1
sealed propertiesSQLText
sealed propertiesTimer1
sealed propertiesToolTip1
sealed propertiesTransfer
sealed propertiesTransferType

Fields

NameDescription
private fieldcomponents
private fielddt
private fieldelapsedTime
private fieldmyDBConnHelper
common connection settings factored in helper class
private fieldnonRowResult
private fieldSqlCmd
private fieldstoredUserSetEnv
stored environment to reset after change
private fielduserSetDB
stored database to reset after change