This is my database diagram;
project <--------∞ maingroup <--------------∞ group<------------∞ product<--------∞ piece*proID *maingroupId *groupId *productId *pieceId
name name name name name
+proId +maingrupId +groupId +productId
*primarykey
and my code for sql database to datagridview is;
using (ALBAYRAKEntities db = new ALBAYRAKEntities())
{
pROJEBindingSource.DataSource = db.PROJEs.ToList();
aNAGRUPBindingSource.DataSource = db.ANAGRUPs.ToList();
gRUPPBindingSource.DataSource = db.GRUPPs.ToList();üRÜNNBindingSource.DataSource = db.ÜRÜNN.ToList();
aLTPARCABindingSource.DataSource = db.ALTPARCAs.ToList();
}But
I want to retrieve data from the database to datagridview; second column according to the selected item in the first column and the third column according to selected item in the second column and so on, according to sql relationship.
How can I do this?
Thanks in advance.