hi,,
I have 4 tables. t1, t2, t3, t4.
t2 and t4 are many to many.
DATAGRID 1:
t1 - parent table - Primarykey (t1-ID)
- t2 child table -Primary key (t2-id), Foreign Key (t1-ID), column (t3-ID)not unique, and more columns
DATAGRID 2:
t3 - parent table - Primarykey (t3-ID)
- t4 child table -Primary key (t4-id), Foreign Key (t3-ID) not unique, and more columns
DATAGRID 3 :
I need to display the corresponding records in t4 for selection of 't2' in datagrid 1..
As u can see the link for the two tables 't2' and 't4' is "t3-ID"...
How to do this?
private int lastRowIndex = 0;
private int t3IdColIndex = 3;
mydatagrid_currentcellchan
{
if ( mydatagrid.currentRowIndex
lastRowIndex = mydatagrid.currentRowIndex
string id = mydatagrid[ lastRowIndex, t3IdColIndex ].ToString();
DataTable t5 = new DataTable();
foreach ( DataRow dr in t4 ) {
if ( dr["t3-ID"].ToString().Equ
t5.Rowd.Add( dr );
}
}
mydatagrid3.DataSource = t5;
}
}