⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dataset1.vb

📁 编程之道VB.NETt程序设计入门-589M.zip
💻 VB
📖 第 1 页 / 共 3 页
字号:
            End If
        End Sub
        
        Public Sub RemoveOrder_DetailsRow(ByVal row As Order_DetailsRow)
            Me.Rows.Remove(row)
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class Order_DetailsRow
        Inherits DataRow
        
        Private tableOrder_Details As Order_DetailsDataTable
        
        Friend Sub New(ByVal rb As DataRowBuilder)
            MyBase.New(rb)
            Me.tableOrder_Details = CType(Me.Table,Order_DetailsDataTable)
        End Sub
        
        Public Property OrderID As Integer
            Get
                Return CType(Me(Me.tableOrder_Details.OrderIDColumn),Integer)
            End Get
            Set
                Me(Me.tableOrder_Details.OrderIDColumn) = value
            End Set
        End Property
        
        Public Property ProductID As Integer
            Get
                Return CType(Me(Me.tableOrder_Details.ProductIDColumn),Integer)
            End Get
            Set
                Me(Me.tableOrder_Details.ProductIDColumn) = value
            End Set
        End Property
        
        Public Property UnitPrice As Decimal
            Get
                Return CType(Me(Me.tableOrder_Details.UnitPriceColumn),Decimal)
            End Get
            Set
                Me(Me.tableOrder_Details.UnitPriceColumn) = value
            End Set
        End Property
        
        Public Property Quantity As Short
            Get
                Return CType(Me(Me.tableOrder_Details.QuantityColumn),Short)
            End Get
            Set
                Me(Me.tableOrder_Details.QuantityColumn) = value
            End Set
        End Property
        
        Public Property Discount As Single
            Get
                Return CType(Me(Me.tableOrder_Details.DiscountColumn),Single)
            End Get
            Set
                Me(Me.tableOrder_Details.DiscountColumn) = value
            End Set
        End Property
        
        Public Property OrdersRow As OrdersRow
            Get
                Return CType(Me.GetParentRow(Me.Table.ParentRelations("OrdersOrder_x0020_Details")),OrdersRow)
            End Get
            Set
                Me.SetParentRow(value, Me.Table.ParentRelations("OrdersOrder_x0020_Details"))
            End Set
        End Property
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class Order_DetailsRowChangeEvent
        Inherits EventArgs
        
        Private eventRow As Order_DetailsRow
        
        Private eventAction As DataRowAction
        
        Public Sub New(ByVal row As Order_DetailsRow, ByVal action As DataRowAction)
            MyBase.New
            Me.eventRow = row
            Me.eventAction = action
        End Sub
        
        Public ReadOnly Property Row As Order_DetailsRow
            Get
                Return Me.eventRow
            End Get
        End Property
        
        Public ReadOnly Property Action As DataRowAction
            Get
                Return Me.eventAction
            End Get
        End Property
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class OrdersDataTable
        Inherits DataTable
        Implements System.Collections.IEnumerable
        
        Private columnOrderID As DataColumn
        
        Private columnCustomerID As DataColumn
        
        Private columnEmployeeID As DataColumn
        
        Private columnOrderDate As DataColumn
        
        Private columnRequiredDate As DataColumn
        
        Private columnShippedDate As DataColumn
        
        Private columnShipVia As DataColumn
        
        Private columnFreight As DataColumn
        
        Private columnShipName As DataColumn
        
        Private columnShipAddress As DataColumn
        
        Private columnShipCity As DataColumn
        
        Private columnShipRegion As DataColumn
        
        Private columnShipPostalCode As DataColumn
        
        Private columnShipCountry As DataColumn
        
        Friend Sub New()
            MyBase.New("Orders")
            Me.InitClass
        End Sub
        
        Friend Sub New(ByVal table As DataTable)
            MyBase.New(table.TableName)
            If (table.CaseSensitive <> table.DataSet.CaseSensitive) Then
                Me.CaseSensitive = table.CaseSensitive
            End If
            If (table.Locale.ToString <> table.DataSet.Locale.ToString) Then
                Me.Locale = table.Locale
            End If
            If (table.Namespace <> table.DataSet.Namespace) Then
                Me.Namespace = table.Namespace
            End If
            Me.Prefix = table.Prefix
            Me.MinimumCapacity = table.MinimumCapacity
            Me.DisplayExpression = table.DisplayExpression
        End Sub
        
        <System.ComponentModel.Browsable(false)>  _
        Public ReadOnly Property Count As Integer
            Get
                Return Me.Rows.Count
            End Get
        End Property
        
        Friend ReadOnly Property OrderIDColumn As DataColumn
            Get
                Return Me.columnOrderID
            End Get
        End Property
        
        Friend ReadOnly Property CustomerIDColumn As DataColumn
            Get
                Return Me.columnCustomerID
            End Get
        End Property
        
        Friend ReadOnly Property EmployeeIDColumn As DataColumn
            Get
                Return Me.columnEmployeeID
            End Get
        End Property
        
        Friend ReadOnly Property OrderDateColumn As DataColumn
            Get
                Return Me.columnOrderDate
            End Get
        End Property
        
        Friend ReadOnly Property RequiredDateColumn As DataColumn
            Get
                Return Me.columnRequiredDate
            End Get
        End Property
        
        Friend ReadOnly Property ShippedDateColumn As DataColumn
            Get
                Return Me.columnShippedDate
            End Get
        End Property
        
        Friend ReadOnly Property ShipViaColumn As DataColumn
            Get
                Return Me.columnShipVia
            End Get
        End Property
        
        Friend ReadOnly Property FreightColumn As DataColumn
            Get
                Return Me.columnFreight
            End Get
        End Property
        
        Friend ReadOnly Property ShipNameColumn As DataColumn
            Get
                Return Me.columnShipName
            End Get
        End Property
        
        Friend ReadOnly Property ShipAddressColumn As DataColumn
            Get
                Return Me.columnShipAddress
            End Get
        End Property
        
        Friend ReadOnly Property ShipCityColumn As DataColumn
            Get
                Return Me.columnShipCity
            End Get
        End Property
        
        Friend ReadOnly Property ShipRegionColumn As DataColumn
            Get
                Return Me.columnShipRegion
            End Get
        End Property
        
        Friend ReadOnly Property ShipPostalCodeColumn As DataColumn
            Get
                Return Me.columnShipPostalCode
            End Get
        End Property
        
        Friend ReadOnly Property ShipCountryColumn As DataColumn
            Get
                Return Me.columnShipCountry
            End Get
        End Property
        
        Public Default ReadOnly Property Item(ByVal index As Integer) As OrdersRow
            Get
                Return CType(Me.Rows(index),OrdersRow)
            End Get
        End Property
        
        Public Event OrdersRowChanged As OrdersRowChangeEventHandler
        
        Public Event OrdersRowChanging As OrdersRowChangeEventHandler
        
        Public Event OrdersRowDeleted As OrdersRowChangeEventHandler
        
        Public Event OrdersRowDeleting As OrdersRowChangeEventHandler
        
        Public Overloads Sub AddOrdersRow(ByVal row As OrdersRow)
            Me.Rows.Add(row)
        End Sub
        
        Public Overloads Function AddOrdersRow(ByVal CustomerID As String, ByVal EmployeeID As Integer, ByVal OrderDate As Date, ByVal RequiredDate As Date, ByVal ShippedDate As Date, ByVal ShipVia As Integer, ByVal Freight As Decimal, ByVal ShipName As String, ByVal ShipAddress As String, ByVal ShipCity As String, ByVal ShipRegion As String, ByVal ShipPostalCode As String, ByVal ShipCountry As String) As OrdersRow
            Dim rowOrdersRow As OrdersRow = CType(Me.NewRow,OrdersRow)
            rowOrdersRow.ItemArray = New Object() {Nothing, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry}
            Me.Rows.Add(rowOrdersRow)
            Return rowOrdersRow
        End Function
        
        Public Function FindByOrderID(ByVal OrderID As Integer) As OrdersRow
            Return CType(Me.Rows.Find(New Object() {OrderID}),OrdersRow)
        End Function
        
        Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
            Return Me.Rows.GetEnumerator
        End Function
        
        Public Overrides Function Clone() As DataTable
            Dim cln As OrdersDataTable = CType(MyBase.Clone,OrdersDataTable)
            cln.InitVars
            Return cln
        End Function
        
        Protected Overrides Function CreateInstance() As DataTable
            Return New OrdersDataTable
        End Function
        
        Friend Sub InitVars()
            Me.columnOrderID = Me.Columns("OrderID")
            Me.columnCustomerID = Me.Columns("CustomerID")
            Me.columnEmployeeID = Me.Columns("EmployeeID")
            Me.columnOrderDate = Me.Columns("OrderDate")
            Me.columnRequiredDate = Me.Columns("RequiredDate")
            Me.columnShippedDate = Me.Columns("ShippedDate")
            Me.columnShipVia = Me.Columns("ShipVia")
            Me.columnFreight = Me.Columns("Freight")
            Me.columnShipName = Me.Columns("ShipName")
            Me.columnShipAddress = Me.Columns("ShipAddress")
            Me.columnShipCity = Me.Columns("ShipCity")
            Me.columnShipRegion = Me.Columns("ShipRegion")
            Me.columnShipPostalCode = Me.Columns("ShipPostalCode")
            Me.columnShipCountry = Me.Columns("ShipCountry")
        End Sub
        
        Private Sub InitClass()
            Me.columnOrderID = New DataColumn("OrderID", GetType(System.Int32), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnOrderID)
            Me.columnCustomerID = New DataColumn("CustomerID", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnCustomerID)
            Me.columnEmployeeID = New DataColumn("EmployeeID", GetType(System.Int32), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnEmployeeID)
            Me.columnOrderDate = New DataColumn("OrderDate", GetType(System.DateTime), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnOrderDate)
            Me.columnRequiredDate = New DataColumn("RequiredDate", GetType(System.DateTime), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnRequiredDate)
            Me.columnShippedDate = New DataColumn("ShippedDate", GetType(System.DateTime), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnShippedDate)
            Me.columnShipVia = New DataColumn("ShipVia", GetType(System.Int32), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnShipVia)
            Me.columnFreight = New DataColumn("Freight", GetType(System.Decimal), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnFreight)
            Me.columnShipName = New DataColumn("ShipName", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnShipName)
            Me.columnShipAddress = New DataColumn("ShipAddress", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnShipAddress)
            Me.columnShipCity = New DataColumn("ShipCity", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnShipCity)
            Me.columnShipRegion = New DataColumn("ShipRegion", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnShipRegion)
            Me.columnShipPostalCode = New DataColumn("ShipPostalCode", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnShipPostalCode)
            Me.columnShipCountry = New DataColumn("ShipCountry", GetType(System.String), Nothing, System.Data.MappingType.Element)
            Me.Columns.Add(Me.columnShipCountry)
            Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnOrderID}, true))
            Me.columnOrderID.AutoIncrement = true
            Me.columnOrderID.AllowDBNull = false
            Me.columnOrderID.ReadOnly = true
            Me.columnOrderID.Unique = true
        End Sub
        
        Public Function NewOrdersRow() As OrdersRow
            Return CType(Me.NewRow,OrdersRow)
        End Function
        
        Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
            Return New OrdersRow(builder)
        End Function
        
        Protected Overrides Function GetRowType() As System.Type
            Return GetType(OrdersRow)
        End Function
        
        Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanged(e)
            If (Not (Me.OrdersRowChangedEvent) Is Nothing) Then

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -