private void button3_Click(object sender, EventArgs e) { FridgeServicing fridgeServicing = new FridgeServicing(); this.Hide(); fridgeServicing.Show(); }
private void button1_Click(object sender, EventArgs e) { SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DBconnection"].ConnectionString); connection.Open(); string PF = "Fridge Mechanic"; string sql1 = "SELECT *FROM Registrations WHERE gender= '" + comboBox1.Text + "' and Profession='" + PF + "' "; SqlCommand command = new SqlCommand(sql1, connection); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { connection.Close(); DataAcess ac = new DataAcess(); string sql = "SELECT *FROM Registrations WHERE City='" + textBoxCity.Text + "'AND gender='" + comboBox1.Text + "'AND Profession='" + PF + "'"; sqladp = new SqlDataAdapter(sql, connection); sqladp.Fill(data); pos = 0; displaytext(pos); connection.Close(); ac.ConnectionClose(); } else { MessageBox.Show("Sorry!There is no Mechanic as per your Requirement"); FridgeServicing fridgeServicing = new FridgeServicing(); this.Hide(); fridgeServicing.Show(); connection.Close(); } }