i need to ask one more question....

private void bbn_Click(object sender, EventArgs e)
            OleDbDataAdapter ad;
            DataSet ds1 = new DataSet();
            if (comboBox1.SelectedIndex == 0)
                string str1 = "select * from '"+comboBox1.SelectedIndex+"'";
                OleDbConnection conn1 = new OleDbConnection(str);
                ad = new OleDbDataAdapter(str1, conn1);

                dataGridView1.DataSource = ds1.Tables[0].DefaultView;

i want the button to select the data from combo box and then display the corresponding table in grid view...

however its giving me an error



it says syntax error..i know i need to write table name there...but i want it to read it from my

combobox.seleted index


Any suggestions....

thanks and regards

You have written


Well, this gives you a selected index, whtever you have selected like 1, 2 or 4

Well, same table name 1, 2, or 4 might be not availabe in your database

so use .SelectedValue

so you may get the table name form the combobox

check it out and ...