This is how I did it in a WEB application, gdCustomers is the main grid,
dgOrders is the detail grid.
Once a selected row is clicked in the Customers grid the detail grid is
filled with the orders.
private void dgCustomers_SelectedIndexChanged(object sender,
System.EventArgs e)
{
DataGridItem item ;
item = dgCustomers.Items[dgCustomers.SelectedIndex];
string mySql = "Select * from Orders Where CustomerID = '" +
item.Cells[1].Text + "'";
SqlCommand comOrdrs = conn.CreateCommand();
comOrdrs.CommandText = mySql;
comOrdrs.CommandType = CommandType.Text;
SqlDataAdapter daOrders = new SqlDataAdapter(comOrdrs);
DataSet dsOrders = new DataSet();
daOrders.Fill(dsOrders);
dgOrders.DataSource = dsOrders;
dgOrders.DataBind();
}
"Steve Teeples" <St****@newsgroups.nospam> wrote in message
news:42**********************************@microsof t.com...
I have a form with two DataGridView controls. The form has linked to it an
Access database with just two tables. The second table contains unique
"child" data having a one-to-one relationship with each row of the first
table. I am able to display the first table's data in one of the
DataGridView controls - DatgaGridView_A.
What I want to do, but don't know how, is to select a row from the
DataGridView_A and have the data associated with it from the second table
displayed in DataGridView_B. Can someone show me how this is done or give
me
an example?
--
-----------
Thanks,
Steve