public SQLControl() { InitializeComponent(); // initialize delegates SetResultsDel = new StringBoolDelegate(this.SetMessage); ShowResultsDel = new DataTableDelegate(this.ShowResults); SetUpFormDel = new BoolDelegate(this.SetUpForm); ChangeCursorDel = new CursorDelegate(this.ChangeCursor); SetMessageDel = new StringDelegate(this.ShowMessage); Condlg = new ConnectionDialog(); m_bQueryRunning = false; m_bConnected = false; }
public bool GetConnection() { // show the dialog and wait for a result Condlg = new ConnectionDialog(); Condlg.StartPosition = FormStartPosition.CenterParent; DialogResult result = Condlg.ShowDialog(); // if the user hit ok, we assume we have a connection if (result == DialogResult.OK) { // set up the form for input // clear the message since a residual message from earlier in the session can exist SetUpForm(true); SetMessage("", false); m_bConnected = true; return(true); } // otherwise, we didnt get an OK disable the form and display an error message DisableInput(); SetMessage("No Connection Established.", true); m_bConnected = false; return(false); }