1. DataSet1.Relations.Add("YourRelation", DataSet1.Tables["t1"].Columns["id"],
DataSet1.Tables["t2"].Columns["fldid"]);2.
>>>>>当表t1中的记录定位到某一条后,t2能否自动筛选为相关参照条件的记录useDataRow[] drs = DataRow1.GetChildRows("YourRelation");
DataSet1.Tables["t2"].Columns["fldid"]);2.
>>>>>当表t1中的记录定位到某一条后,t2能否自动筛选为相关参照条件的记录useDataRow[] drs = DataRow1.GetChildRows("YourRelation");
dim Child as DataColumn=objDs.Tables("employee").Columns("job_id")
objDs.Relations.Add("RelationName",Parent,Child)
objDataSet.Relations.Add(relation); //这里添加的是DataRelation对象然后使用foreach循环,例如:
foreach(DataRow r in objDataSet.Tables["parentTable"].Rows){ //创建一个DataRow数组
DataRow[] childr; //通过关系取得child row
childr = r.GetChildRows("Relation"); //取得所有child row
foreach(DataRow theChildRow in childr){
//使用theChildRow["字段名"]就可获得相应的记录字段值
}}