可以用DataRelation,
private void CreateRelation() {
// Get the DataColumn objects from two DataTable objects in a DataSet.
DataColumn parentCol;
DataColumn childCol;
// Code to get the DataSet not shown here.
parentCol = DataSet1.Tables["Customers"].Columns["CustID"];
childCol = DataSet1.Tables["Orders"].Columns["CustID"];
// Create DataRelation.
DataRelation relCustOrder;
relCustOrder = new DataRelation("CustomersOrders", parentCol, childCol);
// Add the relation to the DataSet.
DataSet1.Relations.Add(relCustOrder);
}int rowCtr;
// Declare an array of datarows to hold the child records.
DataRow[] drarray;
// GetChildRows gets related rows. It is a method on the datatable, and
// takes either DataRelation object name as a string.
rowCtr = 0;
drarray = dsCustomersOrders1.Customers[rowCtr].GetChildRows("CustomersOrders");
private void CreateRelation() {
// Get the DataColumn objects from two DataTable objects in a DataSet.
DataColumn parentCol;
DataColumn childCol;
// Code to get the DataSet not shown here.
parentCol = DataSet1.Tables["Customers"].Columns["CustID"];
childCol = DataSet1.Tables["Orders"].Columns["CustID"];
// Create DataRelation.
DataRelation relCustOrder;
relCustOrder = new DataRelation("CustomersOrders", parentCol, childCol);
// Add the relation to the DataSet.
DataSet1.Relations.Add(relCustOrder);
}int rowCtr;
// Declare an array of datarows to hold the child records.
DataRow[] drarray;
// GetChildRows gets related rows. It is a method on the datatable, and
// takes either DataRelation object name as a string.
rowCtr = 0;
drarray = dsCustomersOrders1.Customers[rowCtr].GetChildRows("CustomersOrders");
解决方案 »
- 【在线】哪些文件的修改操作会引用内存缓存的丢失?谢谢~!
- 好久没来了,散点技术分,问个SQL问题:如果快速获取当前排名?
- 控件输入日期时,数据库里面放一些不让填写的日期的数据,check输入数据,想用javascript或ajax 来做.客户端实现.可以吗?
- 高手都过年去了,没想到这周竟然让我上的周榜,哈哈,再散分庆祝一下
- 客户端访问本地盘等
- 关于绑定事件的处理方法的问题
- 如何限制只显示标题的前几个字符.
- 奇葩的现象,MVC 不查找默认的Index
- 在服务器端执行弹出窗口,怎么能不POSTBACK,象客户端执行的效果那样?
- 急!!关于DataList操作的问题
- 求救!帮帮我这个菜鸟吧!datagrid删除的问题
- 开发wap项目中的输入框的中文传不到下一个页面,如何处理?
int rowCtr;
// Declare an array of datarows to hold the child records.
DataRow[] drarray;
// GetChildRows gets related rows. It is a method on the datatable, and
// takes either DataRelation object name as a string.
rowCtr = 0;
drarray = dsCustomersOrders1.Customers[rowCtr].GetChildRows("CustomersOrders");