微博:https://weibo.com/6274976536/profile?rightmod=1&wvr=6&mod=personinfo&is_all=1
ds.Tables.Add(表1.Copy());
ds.Tables.Add(表2.Copy());
ds.Relations.Add(new DataRelation("TERMS", 表1.Columns[关联字段名], 表2.Columns[关联字段名]));//TERMS == ChildGridLevelName
gcTerms.DataSource = ds.Tables[0];
前期准备:
gridControl 添加两个gridView,并添加所需要的列gridColumn,设置fieldname.在MainView 中设置ChildGridLevelName
步骤:
1.查询出两个有关系的表,并设置两表的TableName;
2.将两表copy到新的dataSet中;
3.为DataSet添加Relations;