I have a windows forms application where i have to load different fee structures tables for different courses in one datagridview using the textbox but i do not know how to use the mulitple datasources for datagridview I have 20 fee structure which differ from each of them by the values in it I have a Textbox where i would retrieve the name of the table to be retrieved but how should i proceed further ?
I used the have made a DataSet named fSDataSet where all the datatables are stored Now i want to load the tables when i get the values from the form
private void fSDataSetBindingSource_CurrentChanged(object sender, EventArgs e)
{
BindingSource bindingsource = new BindingSource();
string getfeest = "FYBIOTECH";
string s = @"Data Source=SRINATH-PC\SQLEXPRESS;Initial Catalog=FS;Integrated Security=True;Pooling=False";
SqlConnection OK = new SqlConnection(s);
SqlDataAdapter getfeestructure = new SqlDataAdapter();
SqlCommandBuilder commandBuilder = new SqlCommandBuilder(getfeestructure);
SqlCommand cmd = new SqlCommand(@"Select * from " + getfeest, OK);
getfeestructure.SelectCommand = cmd;
DataTable dt = new DataTable(@"fsDataSet." + getfeest);
dt.Locale = System.Globalization.CultureInfo.InvariantCulture;
getfeestructure.Fill(dt);
bindingsource.DataSource = dt;
dataGridView1.AutoResizeColumns(
DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
}
private void button1_Click(object sender, EventArgs e)
{
fSDataSetBindingSource_CurrentChanged(sender, e);
}
Now the error it is not displaying the rows in it and i am not able to understand the actual error