private void btnSQLConnect_Click(object sender, EventArgs e) { lsvSQLCols.Items.Clear(); cbxSQLSchema.DataSource = null; try { btnSQLConnect.Enabled = false; var sqlConnectionString = rtbxSQLConnectionString.Text; if (string.IsNullOrWhiteSpace(sqlConnectionString)) { return; } _dataConnector.ConnectionString = sqlConnectionString; var tables = _dataConnector.GetSchemaTables(); if (tables.Count == 0) { return; } MessageBox.Show(@"Connected", @"Successfully", MessageBoxButtons.OK, MessageBoxIcon.Information); LoggerHelper.Write(LoggerOption.Info, "SqlServer connected : {0}", sqlConnectionString); cbxSQLSchema.DataSource = tables; } catch (Exception exp) { MessageBox.Show(exp.Message, @"Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); LoggerHelper.Write(LoggerOption.Error, "Error: {0}", exp.Message); } finally { btnSQLConnect.Enabled = true; } }