當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET DataRelation構造函數代碼示例

本文整理匯總了VB.NET中System.Data.DataRelation.DataRelation構造函數的典型用法代碼示例。如果您正苦於以下問題:VB.NET DataRelation構造函數的具體用法?VB.NET DataRelation怎麽用?VB.NET DataRelation使用的例子?那麽, 這裏精選的構造函數代碼示例或許可以為您提供幫助。您也可以進一步了解該構造函數所在System.Data.DataRelation的用法示例。


在下文中一共展示了DataRelation構造函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。

示例1: CreateRelation

Private Sub CreateRelation()
    ' Code to get the DataSet not shown here.
    ' Get the DataColumn objects from two DataTable 
    ' objects in a DataSet.
    Dim parentCols As DataColumn() = _
        {DataSet1.Tables("Customers").Columns("CustID"), _
        DataSet1.Tables("Customers").Columns("OrdID")}
    Dim childCols As DataColumn() = _
        {DataSet1.Tables("Orders").Columns("CustID"), _
        DataSet1.Tables("Orders").Columns("OrdID")}

    ' Create DataRelation.
    Dim CustOrderRel As New DataRelation( _
        "CustomersOrders", parentCols, childCols)

    ' Add the relation to the DataSet.
    DataSet1.Relations.Add(CustOrderRel)
End Sub
開發者ID:VB.NET開發者,項目名稱:System.Data,代碼行數:18,代碼來源:DataRelation

示例2: CreateRelation

Private Sub CreateRelation()
    ' Code to get the DataSet not shown here.
    ' Get the DataColumn objects from two DataTable 
    ' objects in a DataSet.
    Dim parentColumns() As DataColumn
    Dim childColumns() As DataColumn
    parentColumns(0) = DataSet1.Tables( _
        "Customers").Columns("CustID")
    parentColumns(1) = DataSet1.Tables( _
        "Customers").Columns("OrdID")
 
    childColumns(0) = DataSet1.Tables( _
        "Orders").Columns("CustID")
    childColumns(1) = DataSet1.Tables( _
        "Orders").Columns("OrdID")

    ' Create DataRelation.
    Dim CustOrderRel As New DataRelation( _
        "CustomersOrders", parentColumns, childColumns)

    ' Add the relation to the DataSet.
    DataSet1.Relations.Add(CustOrderRel)
End Sub
開發者ID:VB.NET開發者,項目名稱:System.Data,代碼行數:23,代碼來源:DataRelation

示例3: CreateRelation

Private Sub CreateRelation()
    ' Code to get the DataSet not shown here.
    ' Get the DataColumn objects from two DataTable 
    ' objects in a DataSet.
    Dim parentColumn As DataColumn = DataSet1.Tables( _
        "Customers").Columns("CustID")
    Dim childColumn As DataColumn = _
        DataSet1.Tables("Orders").Columns("CustID")

    ' Create DataRelation.
    Dim bConstraints As Boolean = True
    Dim customerOrdersRelation As DataRelation = _
        New DataRelation("CustomersOrders", _
        parentColumn, childColumn, bConstraints)

    ' Add the relation to the DataSet.
    DataSet1.Relations.Add(customerOrdersRelation)
End Sub
開發者ID:VB.NET開發者,項目名稱:System.Data,代碼行數:18,代碼來源:DataRelation

示例4: CreateRelation

Private Sub CreateRelation()
    ' Code to get the DataSet not shown here.
    ' Get the DataColumn objects from two DataTable 
    ' objects in a DataSet.
    Dim parentColumns() As DataColumn
    Dim childColumns() As DataColumn
    parentColumns(0) = DataSet1.Tables( _
        "Customers").Columns("CustID")
    parentColumns(1) = DataSet1.Tables( _
        "Customers").Columns("OrdID")
 
    childColumns(0) = DataSet1.Tables( _
        "Orders").Columns("CustID")
    childColumns(1) = DataSet1.Tables( _
        "Orders").Columns("OrdID")
 
    Dim bConstraints As Boolean = True
    ' Create DataRelation.
    Dim CustOrderRel As New DataRelation( _
        "CustomersOrders", parentColumns, childColumns,  _
        bConstraints)

    ' Add the relation to the DataSet.
    DataSet1.Relations.Add(CustOrderRel)
End Sub
開發者ID:VB.NET開發者,項目名稱:System.Data,代碼行數:25,代碼來源:DataRelation


注:本文中的System.Data.DataRelation.DataRelation構造函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。