private void button4_Click(object sender, EventArgs e) { CarServicing carServicing = new CarServicing(); this.Hide(); carServicing.Show(); }
private void button1_Click(object sender, EventArgs e) { SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DBconnection"].ConnectionString); connection.Open(); string PF = "AC 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); ac.ConnectionClose(); connection.Close(); } else { MessageBox.Show("Sorry!There is no Mechanic as per your Requirement"); CarServicing carServicing = new CarServicing(); this.Hide(); carServicing.Show(); connection.Close(); } connection.Close(); }