Exemplo n.º 1
0
 /// <summary>
 /// When the database ComboBox selection changes, populate the ListBox with
 /// table names within the selected database.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cboDatabaseNames_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cboDatabaseNames.DataSource != null)
     {
         lstTableNames.DataSource = sOps.TableNames(cboDatabaseNames.Text);
     }
     else
     {
         MessageBox.Show("Please populate the first ListBox with database names");
     }
 }
 private void cmdLoadTableNamesForSelectedDatabaseName_Click(object sender, EventArgs e)
 {
     if (lstDatabaseNames.DataSource != null)
     {
         var ops = new SmoOperations();
         lstTableNames.DataSource = ops.TableNames(lstDatabaseNames.Text);
     }
     else
     {
         MessageBox.Show("Please populate the first ListBox with database names");
     }
 }
        /// <summary>
        /// Here for testing that all works I load all ListBoxes
        /// with know database, table and columns in one shot.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdSpecialLoader_Click(object sender, EventArgs e)
        {
            var ops = new SmoOperations();

            lstDatabaseNames.DataSource = ops.DatabaseNames();
            var Index = lstDatabaseNames.FindString("NorthWindAzure");

            if (Index > -1)
            {
                lstDatabaseNames.SelectedIndex = Index;
                lstTableNames.DataSource       = ops.TableNames(lstDatabaseNames.Text);
                Index = lstTableNames.FindString("Orders");
                if (Index > -1)
                {
                    lstTableNames.SelectedIndex = Index;
                    lstColumnNames.DataSource   = ops.TableColumnNames(lstDatabaseNames.Text, lstTableNames.Text);
                    currentTableColumDetails    = ops.GetColumnDetails(lstDatabaseNames.Text, lstTableNames.Text);
                }
            }
        }