void getTables()
 {
     comboBox2.Items.Clear();
     var databaseName = comboBox1.GetItemText(comboBox1.SelectedItem).Trim();
     if (String.IsNullOrEmpty(databaseName))
         return;
     var connection = new SqlConnection("Server=localhost;Database=" + databaseName + ";Trusted_Connection=True;MultipleActiveResultSets=True;");
     connection.Open();
     var command = new SqlCommand("SELECT [name] FROM sysobjects WHERE xtype = 'u';", connection);
     var reader = command.ExecuteReader();
     for (int i = 0; reader.Read(); i++)
     {
         var tmp = new ComboBoxEntity()
         {
             Text = reader[0].ToString(),
             Value = i++
         };
         comboBox2.Items.Add(tmp);
     }
     connection.Close();
 }
 private void getDatabases()
 {
     comboBox1.Items.Clear();
     var connection = new SqlConnection("Server=localhost;Trusted_Connection=True;MultipleActiveResultSets=True;");
     connection.Open();
     var command = new SqlCommand("SELECT name FROM Sys.Databases;", connection);
     var reader = command.ExecuteReader();
     for (int i = 0; reader.Read(); i++)
     {
         var tmp = new ComboBoxEntity()
         {
             Text = reader[0].ToString(),
             Value = i++
         };
         comboBox1.Items.Add(tmp);
     }
     connection.Close();
 }