private void button1_Click(object sender, EventArgs e) { listView1.Items.Clear(); Tree new_tree = new Tree(adapter); new_tree.build(); if (new_tree.monitorsCount() > 0) { displayMonitors(new_tree); trees.Add(adapter.getPortName(), new_tree); button2.Enabled = true; //Upload monitors from the new tree to the DB db_connection.OpenConnection(); db_connection.uploadMonitors(new_tree); //db_connection.testQuery(); db_connection.CloseConnection(); } }