G
Guest
Hi all,
I am a bit of "noob" when it comes to using c#.NET datagrids, and always
look at them in terms of what i could have done in VB6.
I have been reading around, and understand the ideas and logic of DataSets,
DataRelations, and DataTables. I understand how to populate a dataset,
datatable, grid etc, and have even got as displaying a combobox in cell of
the datagrid. However, I do not understand how to make relationships between
multiple tables appear as I want them on the screen.
For example, the following code I have used to populate data into a dataset,
and establish the relationships between the data tables. This works fine, no
problems:
sqlAdap=new SqlDataAdapter(strSearch,sqlConn);
SqlDataAdapter sqlAdap2 = new SqlDataAdapter("SELECT * FROM
T_Recycle_Consignment_Detail",sqlConn);
ds = new DataSet();
sqlAdap.Fill(ds,"T_Recycle_Consignment_Header");
sqlAdap2.Fill(ds,"T_Recycle_Consignment_Detail");
DataRelation Tran_Detail = new DataRelation("Items",
ds.Tables[0].Columns["F_Consignment_ID"],
ds.Tables[1].Columns["F_Consignment_ID"]);
ds.Relations.Add(Tran_Detail);
Where I am stuck, is that when I click on the "+" sign on the datagrid, I
first get a link to DataRelation name "Items", which when I click it, it
removes the parent grid, and just displays the child record(s).
Basically what I am after is the MSHFlexGrid from VB6, which my users have
always found really easy to use, and to understand.
Can anyone shed any light on this problem, or refer me any sites that
explain this?
Many thanks,
James.
I am a bit of "noob" when it comes to using c#.NET datagrids, and always
look at them in terms of what i could have done in VB6.
I have been reading around, and understand the ideas and logic of DataSets,
DataRelations, and DataTables. I understand how to populate a dataset,
datatable, grid etc, and have even got as displaying a combobox in cell of
the datagrid. However, I do not understand how to make relationships between
multiple tables appear as I want them on the screen.
For example, the following code I have used to populate data into a dataset,
and establish the relationships between the data tables. This works fine, no
problems:
sqlAdap=new SqlDataAdapter(strSearch,sqlConn);
SqlDataAdapter sqlAdap2 = new SqlDataAdapter("SELECT * FROM
T_Recycle_Consignment_Detail",sqlConn);
ds = new DataSet();
sqlAdap.Fill(ds,"T_Recycle_Consignment_Header");
sqlAdap2.Fill(ds,"T_Recycle_Consignment_Detail");
DataRelation Tran_Detail = new DataRelation("Items",
ds.Tables[0].Columns["F_Consignment_ID"],
ds.Tables[1].Columns["F_Consignment_ID"]);
ds.Relations.Add(Tran_Detail);
Where I am stuck, is that when I click on the "+" sign on the datagrid, I
first get a link to DataRelation name "Items", which when I click it, it
removes the parent grid, and just displays the child record(s).
Basically what I am after is the MSHFlexGrid from VB6, which my users have
always found really easy to use, and to understand.
Can anyone shed any light on this problem, or refer me any sites that
explain this?
Many thanks,
James.