private void cbxSQLSchema_SelectedIndexChanged(object sender, EventArgs e) { try { var sqlConnectionString = rtbxSQLConnectionString.Text; if (string.IsNullOrWhiteSpace(sqlConnectionString)) { return; } _dataConnector.ConnectionString = sqlConnectionString; if (cbxSQLSchema.SelectedIndex == -1) { return; } _tableInfo = (SchemaTableInfo)cbxSQLSchema.SelectedItem; if (_tableInfo == null) { return; } tbxMonetSchema.Text = string.IsNullOrWhiteSpace(_tableInfo.Schema) ? $"\"{_tableInfo.Table}\"" : $"\"{_tableInfo.Schema}\".\"{_tableInfo.Table}\""; var items = _dataConnector.GetTableColumns(_tableInfo.Table, _tableInfo.Schema); if (items.Count == 0) { return; } lsvSQLCols.Items.Clear(); lsvSQLCols.Items.AddRange(items.Select(s => new ListViewItem(new[] { s.Column, s.DataType, s.Nullable.To <string>() })).ToArray()); LoggerHelper.Write(LoggerOption.Info, "Getting {0} tables from SqlServer", items.Count); } catch (Exception exp) { MessageBox.Show(exp.Message, @"Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); LoggerHelper.Write(LoggerOption.Error, "Error: {0}", exp.Message); } }