Click here to Skip to main content
15,896,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
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;
    }


[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 16-Feb-14 1:05am
v2
Comments
OriginalGriff 16-Feb-14 7:05am    
Sorry? Is there a question there?
What are you trying to achieve? It really isn't clear from that what help you are asking for.
Use the "Improve question" widget to edit your question and provide better information.
Abhinav Chaudhary 16-Feb-14 7:56am    
sorry sir,i will update this question.
OriginalGriff 16-Feb-14 8:08am    
:thumbsup:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900