ADO.NET中,怎样用关系联结两个表,实现读出和写入?
RT,新手求教!!!谢谢!!!!!
datarelation
DataColumn[] parentCols = new DataColumn[]
{DataSet1.Tables["Customers"].Columns["CustID"],
DataSet1.Tables["Customers"].Columns["OrdID"]};
DataColumn[] childCols= new DataColumn[]
{DataSet1.Tables["Orders"].Columns["CustID"],
DataSet1.Tables["Orders"].Columns["OrdID"]};
// Create DataRelation.
DataRelation CustOrderRel = new DataRelation(
"CustomersOrders", parentCols, childCols);
// Add the relation to the DataSet.
DataSet1.Relations.Add(CustOrderRel);