I am getting three resultsets from a stored procedure
I pass a few parameters then try to bind each resultset to three different DataGridView via DataSet and BindingSource.
I can get the first set into the first DataGridView showing Orders
But when I write the second set to the second DataGridView showing Customers, this also overwrites the first DataGridView with the same data.
If I try with the third set of Order lines, this overwrites the first and second.
Am I missing a command or doing it completely wrong?
Code:
//Create a DataAdapter, with the name of the stored procedure.
SqlDataAdapter MyAdapter = new SqlDataAdapter("findOrders", myConnection);
//Set the command type as StoredProcedure.
MyAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
DataSet DS = new DataSet();
I can get the first set into the first DataGridView showing Orders
Code:
MyAdapter.Fill(DS,"findOrders"); dbBindSource.DataSource = DS.Tables["findOrders"]; grdOrders.DataSource = dbBindSource;
Code:
dbBindSource.DataSource = DS.Tables["BB_findOrders1"]; grdCust.DataSource = dbBindSource;
Code:
dbBindSource.DataSource = DS.Tables["BB_findOrders2"]; grdPart.DataSource = dbBindSource
Comment