public void all() { SqlCommand cm1 = new SqlCommand("select * from traintime where No BETWEEN 1 AND 20", con); DataTable dth = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cm1); da.Fill(dth); dataGridView2.DataSource = dth; } private void button1_Click(object sender, EventArgs e) { if (comboBox1.SelectedIndex == 0 || comboBox1.SelectedIndex == 1 || comboBox1.SelectedIndex == 2 || comboBox1.SelectedIndex == 3 || comboBox1.SelectedIndex == 4 && comboBox2.SelectedIndex==5) { all(); } else if (comboBox1.SelectedIndex == 0 || comboBox1.SelectedIndex == 1 || comboBox1.SelectedIndex == 2 || comboBox1.SelectedIndex == 3 || comboBox1.SelectedIndex == 4 || comboBox1.SelectedIndex == 5 && comboBox2.SelectedIndex == 6) { SqlCommand cm1 = new SqlCommand("select * from traintime where TrainNo=11026", con); DataTable dth = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cm1); da.Fill(dth); dataGridView2.DataSource = dth; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)