appdatabasedataset.designer.vb

来自「清华大学出版社出版的 移动应用开发宝典 张大威(2008)的附书源代码」· VB 代码 · 共 1,416 行 · 第 1/5 页

VB
1,416
字号
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ProductId() As Integer
            Get
                Return CType(Me(Me.tableProducts.ProductIdColumn),Integer)
            End Get
            Set
                Me(Me.tableProducts.ProductIdColumn) = value
            End Set
        End Property
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ProductName() As String
            Get
                Return CType(Me(Me.tableProducts.ProductNameColumn),String)
            End Get
            Set
                Me(Me.tableProducts.ProductNameColumn) = value
            End Set
        End Property
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property Price() As Decimal
            Get
                Return CType(Me(Me.tableProducts.PriceColumn),Decimal)
            End Get
            Set
                Me(Me.tableProducts.PriceColumn) = value
            End Set
        End Property
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property Description() As String
            Get
                Try 
                    Return CType(Me(Me.tableProducts.DescriptionColumn),String)
                Catch e As System.InvalidCastException
                    Throw New System.Data.StrongTypingException("The value for column 'Description' in table 'Products' is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableProducts.DescriptionColumn) = value
            End Set
        End Property
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Function IsDescriptionNull() As Boolean
            Return Me.IsNull(Me.tableProducts.DescriptionColumn)
        End Function
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub SetDescriptionNull()
            Me(Me.tableProducts.DescriptionColumn) = System.Convert.DBNull
        End Sub
    End Class
    
    Public Class OrdersRowChangeEvent
        Inherits System.EventArgs
        
        Private eventRow As OrdersRow
        
        Private eventAction As System.Data.DataRowAction
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub New(ByVal row As OrdersRow, ByVal action As System.Data.DataRowAction)
            MyBase.New
            Me.eventRow = row
            Me.eventAction = action
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public ReadOnly Property Row() As OrdersRow
            Get
                Return Me.eventRow
            End Get
        End Property
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public ReadOnly Property Action() As System.Data.DataRowAction
            Get
                Return Me.eventAction
            End Get
        End Property
    End Class
    
    Public Class ProductsRowChangeEvent
        Inherits System.EventArgs
        
        Private eventRow As ProductsRow
        
        Private eventAction As System.Data.DataRowAction
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub New(ByVal row As ProductsRow, ByVal action As System.Data.DataRowAction)
            MyBase.New
            Me.eventRow = row
            Me.eventAction = action
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public ReadOnly Property Row() As ProductsRow
            Get
                Return Me.eventRow
            End Get
        End Property
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public ReadOnly Property Action() As System.Data.DataRowAction
            Get
                Return Me.eventAction
            End Get
        End Property
    End Class
End Class

Namespace AppDatabaseDataSetTableAdapters
    
    <System.ComponentModel.DesignerCategoryAttribute("code"),  _
     System.ComponentModel.DataObjectAttribute(true)>  _
    Partial Public Class OrdersTableAdapter
        Inherits System.ComponentModel.Component
        
        Private WithEvents _adapter As System.Data.SqlServerCe.SqlCeDataAdapter
        
        Private _connection As System.Data.SqlServerCe.SqlCeConnection
        
        Private _commandCollection() As System.Data.SqlServerCe.SqlCeCommand
        
        Private _clearBeforeFill As Boolean
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub New()
            MyBase.New
            Me.ClearBeforeFill = true
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private ReadOnly Property Adapter() As System.Data.SqlServerCe.SqlCeDataAdapter
            Get
                If (Me._adapter Is Nothing) Then
                    Me.InitAdapter
                End If
                Return Me._adapter
            End Get
        End Property
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Friend Property Connection() As System.Data.SqlServerCe.SqlCeConnection
            Get
                If (Me._connection Is Nothing) Then
                    Me.InitConnection
                End If
                Return Me._connection
            End Get
            Set
                Me._connection = value
                If (Not (Me.Adapter.InsertCommand) Is Nothing) Then
                    Me.Adapter.InsertCommand.Connection = value
                End If
                If (Not (Me.Adapter.DeleteCommand) Is Nothing) Then
                    Me.Adapter.DeleteCommand.Connection = value
                End If
                If (Not (Me.Adapter.UpdateCommand) Is Nothing) Then
                    Me.Adapter.UpdateCommand.Connection = value
                End If
                Dim i As Integer = 0
                Do While (i < Me.CommandCollection.Length)
                    If (Not (Me.CommandCollection(i)) Is Nothing) Then
                        CType(Me.CommandCollection(i),System.Data.SqlServerCe.SqlCeCommand).Connection = value
                    End If
                    i = (i + 1)
                Loop
            End Set
        End Property
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Protected ReadOnly Property CommandCollection() As System.Data.SqlServerCe.SqlCeCommand()
            Get
                If (Me._commandCollection Is Nothing) Then
                    Me.InitCommandCollection
                End If
                Return Me._commandCollection
            End Get
        End Property
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Property ClearBeforeFill() As Boolean
            Get
                Return Me._clearBeforeFill
            End Get
            Set
                Me._clearBeforeFill = value
            End Set
        End Property
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitAdapter()
            Me._adapter = New System.Data.SqlServerCe.SqlCeDataAdapter
            Dim tableMapping As System.Data.Common.DataTableMapping = New System.Data.Common.DataTableMapping
            tableMapping.SourceTable = "Table"
            tableMapping.DataSetTable = "Orders"
            tableMapping.ColumnMappings.Add("OrderId", "OrderId")
            tableMapping.ColumnMappings.Add("ServerOrderId", "ServerOrderId")
            tableMapping.ColumnMappings.Add("ProductId", "ProductId")
            tableMapping.ColumnMappings.Add("Quantity", "Quantity")
            tableMapping.ColumnMappings.Add("ProductName", "ProductName")
            tableMapping.ColumnMappings.Add("Price", "Price")
            Me._adapter.TableMappings.Add(tableMapping)
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitConnection()
            Me._connection = New System.Data.SqlServerCe.SqlCeConnection
            Me._connection.ConnectionString = ("Data Source ="  _
                        + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.GetName.CodeBase) + "\AppDatabase.sdf;"))
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private Sub InitCommandCollection()
            Me._commandCollection = New System.Data.SqlServerCe.SqlCeCommand(0) {}
            Me._commandCollection(0) = New System.Data.SqlServerCe.SqlCeCommand
            Me._commandCollection(0).Connection = Me.Connection
            Me._commandCollection(0).CommandText = "SELECT     Orders.OrderId, Orders.ServerOrderId, Orders.ProductId, Orders.Quantit"& _ 
                "y, Products.ProductName, Products.Price"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"FROM         Orders LEFT JOIN Products"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"ON Orders.ProductId = Products.ProductId"
            Me._commandCollection(0).CommandType = System.Data.CommandType.Text
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Fill, true)>  _
        Public Overloads Overridable Function Fill(ByVal dataTable As AppDatabaseDataSet.OrdersDataTable) As Integer
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            If (Me.ClearBeforeFill = true) Then
                dataTable.Clear
            End If
            Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
            Return returnValue
        End Function
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.[Select], true)>  _
        Public Overloads Overridable Function GetData() As AppDatabaseDataSet.OrdersDataTable
            Me.Adapter.SelectCommand = Me.CommandCollection(0)
            Dim dataTable As AppDatabaseDataSet.OrdersDataTable = New AppDatabaseDataSet.OrdersDataTable
            Me.Adapter.Fill(dataTable)
            Return dataTable
        End Function
    End Class
    
    <System.ComponentModel.DesignerCategoryAttribute("code"),  _
     System.ComponentModel.DataObjectAttribute(true)>  _
    Partial Public Class ProductsTableAdapter
        Inherits System.ComponentModel.Component
        
        Private WithEvents _adapter As System.Data.SqlServerCe.SqlCeDataAdapter
        
        Private _connection As System.Data.SqlServerCe.SqlCeConnection
        
        Private _commandCollection() As System.Data.SqlServerCe.SqlCeCommand
        
        Private _clearBeforeFill As Boolean
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Public Sub New()
            MyBase.New
            Me.ClearBeforeFill = true
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Private ReadOnly Property Adapter() As System.Data.SqlServerCe.SqlCeDataAdapter
            Get
                If (Me._adapter Is Nothing) Then
                    Me.InitAdapter
                End If
                Return Me._adapter
            End Get
        End Property
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute()>  _
        Friend Property Connection() As System.Data.SqlServerCe.SqlCeConnection
            Get
                If (Me._connection Is Nothing) Then
                    Me.InitConnection
                End If

⌨️ 快捷键说明

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