本文整理汇总了C#中System.Data.DataRow.GetParentRow方法的典型用法代码示例。如果您正苦于以下问题:C# DataRow.GetParentRow方法的具体用法?C# DataRow.GetParentRow怎么用?C# DataRow.GetParentRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.DataRow
的用法示例。
在下文中一共展示了DataRow.GetParentRow方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetParentRowForTable
private void GetParentRowForTable(DataTable thisTable,
DataRelation relation)
{
if(thisTable ==null){return;}
// For each row in the table, print column 1
// of the parent DataRow.
DataRow parentRow;
foreach(DataRow row in thisTable.Rows)
{
parentRow = row.GetParentRow(relation);
Console.Write("\table child row: " + row[1]);
Console.Write("\table parent row: " + parentRow[1]+ "\n");
}
}
private void CallGetParentRowForTable()
{
// An example of calling the function.
DataTable thisTable = DataSet1.Tables["Products"];
DataRelation relation = thisTable.ParentRelations[0];
GetParentRowForTable(thisTable, relation);
}
示例2: GetParentRowForTable
private void GetParentRowForTable(
DataTable thisTable, string relation)
{
if(thisTable ==null){return;}
// For each row in the table, print column 1
// of the parent DataRow.
DataRow parentRow;
foreach(DataRow row in thisTable.Rows)
{
parentRow = row.GetParentRow(relation);
Console.Write("\table child row: " + row[1]);
Console.Write("\table parent row: " + parentRow[1]+ "\n");
}
}
private void CallGetParentRowForTable()
{
// An example of calling the function.
DataTable thisTable = DataSet1.Tables["Products"];
DataRelation relation = thisTable.ParentRelations[0];
GetParentRowForTable(thisTable, relation.RelationName);
}
示例3: GetParentRowForTable
private void GetParentRowForTable(DataTable thisTable,
DataRelation relation,
DataRowVersion version)
{
if(thisTable ==null){return;}
// For each row in the table, print column 1 of the
// parent DataRow.
DataRow parentRow;
foreach(DataRow row in thisTable.Rows)
{
parentRow = row.GetParentRow(relation, version);
Console.Write("\table child row: " + row[1]);
Console.Write("\table parent row: " + parentRow[1]+ "\n");
}
}
private void CallGetParentRowForTable()
{
// An example of calling the function.
DataTable thisTable = DataSet1.Tables["Products"];
DataRelation relation = thisTable.ParentRelations[0];
// Print only original versions of parent rows.
GetParentRowForTable(thisTable, relation,
DataRowVersion.Original);
}
示例4: GetParentRowForTable
private void GetParentRowForTable(DataTable thisTable,
string relation, DataRowVersion version)
{
if(thisTable ==null){return;}
// For each row in the table, print column 1
// of the parent DataRow.
DataRow parentRow;
foreach(DataRow row in thisTable.Rows)
{
parentRow = row.GetParentRow(relation, version);
Console.Write("\t child row: " + row[1]);
Console.Write("\t parent row: " + parentRow[1]+ "\n");
}
}
private void CallGetParentRowForTable()
{
// An example of calling the function.
DataTable thisTable = DataSet1.Tables["Products"];
DataRelation relation = thisTable.ParentRelations[0];
// Print only original versions of parent rows.
GetParentRowForTable(thisTable, relation.RelationName,
DataRowVersion.Original);
}