      private void button1_Click(object sender, EventArgs e)
        {
            dataGrid1.DataBindings.Clear();
            strCon = "Data Source=RAYANEH-C5E4683\\SQLEXPRESS;Initial Catalog=Student;Integrated Security=True";
            SqlConnection con = new SqlConnection(strCon);
            con.Open();
            if (comboBox2.Text != "Name")
                            strSql = "SELECT * FROM stTable WHERE " + comboBox2.Text + " " + comboBox1.Text +" "+ textBox1.Text;
            else
                            strSql = "SELECT * FROM stTable WHERE " + comboBox2.Text + " " + comboBox1.Text + " " +"'"+ textBox1.Text+"'";
            SqlDataAdapter da = new SqlDataAdapter(strSql, con);
            textBox2.Text = strSql;
            DataSet ds = new DataSet();
            da.Fill(ds, "stTable");
            dataGrid1.DataBindings.Add(new Binding("DataSource", ds, "stTable"));
            con.Close();
            }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               