📄 dscustomers.vb
字号:
Me.columnContactName = New DataColumn("ContactName", GetType(System.String), "", System.Data.MappingType.Element)
Me.Columns.Add(Me.columnContactName)
Me.columnContactTitle = New DataColumn("ContactTitle", GetType(System.String), "", System.Data.MappingType.Element)
Me.Columns.Add(Me.columnContactTitle)
Me.columnAddress = New DataColumn("Address", GetType(System.String), "", System.Data.MappingType.Element)
Me.Columns.Add(Me.columnAddress)
Me.columnCity = New DataColumn("City", GetType(System.String), "", System.Data.MappingType.Element)
Me.Columns.Add(Me.columnCity)
Me.column_Region = New DataColumn("Region", GetType(System.String), "", System.Data.MappingType.Element)
Me.Columns.Add(Me.column_Region)
Me.columnPostalCode = New DataColumn("PostalCode", GetType(System.String), "", System.Data.MappingType.Element)
Me.Columns.Add(Me.columnPostalCode)
Me.columnCountry = New DataColumn("Country", GetType(System.String), "", System.Data.MappingType.Element)
Me.Columns.Add(Me.columnCountry)
Me.columnPhone = New DataColumn("Phone", GetType(System.String), "", System.Data.MappingType.Element)
Me.Columns.Add(Me.columnPhone)
Me.columnFax = New DataColumn("Fax", GetType(System.String), "", System.Data.MappingType.Element)
Me.Columns.Add(Me.columnFax)
Me.Constraints.Add(New UniqueConstraint("Constraint1", New DataColumn() {Me.columnCustomerID}, true))
Me.columnCustomerID.AllowDBNull = false
Me.columnCustomerID.Unique = true
Me.columnCompanyName.AllowDBNull = false
End Sub
Public Function NewCustomersRow() As CustomersRow
Return CType(Me.NewRow,CustomersRow)
End Function
Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
Return New CustomersRow(builder)
End Function
Protected Overrides Function GetRowType() As System.Type
Return GetType(CustomersRow)
End Function
Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanged(e)
If (Not (Me.CustomersRowChangedEvent) Is Nothing) Then
RaiseEvent CustomersRowChanged(Me, New CustomersRowChangeEvent(CType(e.Row,CustomersRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowChanging(e)
If (Not (Me.CustomersRowChangingEvent) Is Nothing) Then
RaiseEvent CustomersRowChanging(Me, New CustomersRowChangeEvent(CType(e.Row,CustomersRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleted(e)
If (Not (Me.CustomersRowDeletedEvent) Is Nothing) Then
RaiseEvent CustomersRowDeleted(Me, New CustomersRowChangeEvent(CType(e.Row,CustomersRow), e.Action))
End If
End Sub
Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
MyBase.OnRowDeleting(e)
If (Not (Me.CustomersRowDeletingEvent) Is Nothing) Then
RaiseEvent CustomersRowDeleting(Me, New CustomersRowChangeEvent(CType(e.Row,CustomersRow), e.Action))
End If
End Sub
Public Sub RemoveCustomersRow(ByVal row As CustomersRow)
Me.Rows.Remove(row)
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class CustomersRow
Inherits DataRow
Private tableCustomers As CustomersDataTable
Friend Sub New(ByVal rb As DataRowBuilder)
MyBase.New(rb)
Me.tableCustomers = CType(Me.Table,CustomersDataTable)
End Sub
Public Property CustomerID As String
Get
Return CType(Me(Me.tableCustomers.CustomerIDColumn),String)
End Get
Set
Me(Me.tableCustomers.CustomerIDColumn) = value
End Set
End Property
Public Property CompanyName As String
Get
Return CType(Me(Me.tableCustomers.CompanyNameColumn),String)
End Get
Set
Me(Me.tableCustomers.CompanyNameColumn) = value
End Set
End Property
Public Property ContactName As String
Get
Try
Return CType(Me(Me.tableCustomers.ContactNameColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
End Try
End Get
Set
Me(Me.tableCustomers.ContactNameColumn) = value
End Set
End Property
Public Property ContactTitle As String
Get
Try
Return CType(Me(Me.tableCustomers.ContactTitleColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
End Try
End Get
Set
Me(Me.tableCustomers.ContactTitleColumn) = value
End Set
End Property
Public Property Address As String
Get
Try
Return CType(Me(Me.tableCustomers.AddressColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
End Try
End Get
Set
Me(Me.tableCustomers.AddressColumn) = value
End Set
End Property
Public Property City As String
Get
Try
Return CType(Me(Me.tableCustomers.CityColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
End Try
End Get
Set
Me(Me.tableCustomers.CityColumn) = value
End Set
End Property
Public Property _Region As String
Get
Try
Return CType(Me(Me.tableCustomers._RegionColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
End Try
End Get
Set
Me(Me.tableCustomers._RegionColumn) = value
End Set
End Property
Public Property PostalCode As String
Get
Try
Return CType(Me(Me.tableCustomers.PostalCodeColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
End Try
End Get
Set
Me(Me.tableCustomers.PostalCodeColumn) = value
End Set
End Property
Public Property Country As String
Get
Try
Return CType(Me(Me.tableCustomers.CountryColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
End Try
End Get
Set
Me(Me.tableCustomers.CountryColumn) = value
End Set
End Property
Public Property Phone As String
Get
Try
Return CType(Me(Me.tableCustomers.PhoneColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
End Try
End Get
Set
Me(Me.tableCustomers.PhoneColumn) = value
End Set
End Property
Public Property Fax As String
Get
Try
Return CType(Me(Me.tableCustomers.FaxColumn),String)
Catch e As InvalidCastException
Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
End Try
End Get
Set
Me(Me.tableCustomers.FaxColumn) = value
End Set
End Property
Public Function IsContactNameNull() As Boolean
Return Me.IsNull(Me.tableCustomers.ContactNameColumn)
End Function
Public Sub SetContactNameNull()
Me(Me.tableCustomers.ContactNameColumn) = System.Convert.DBNull
End Sub
Public Function IsContactTitleNull() As Boolean
Return Me.IsNull(Me.tableCustomers.ContactTitleColumn)
End Function
Public Sub SetContactTitleNull()
Me(Me.tableCustomers.ContactTitleColumn) = System.Convert.DBNull
End Sub
Public Function IsAddressNull() As Boolean
Return Me.IsNull(Me.tableCustomers.AddressColumn)
End Function
Public Sub SetAddressNull()
Me(Me.tableCustomers.AddressColumn) = System.Convert.DBNull
End Sub
Public Function IsCityNull() As Boolean
Return Me.IsNull(Me.tableCustomers.CityColumn)
End Function
Public Sub SetCityNull()
Me(Me.tableCustomers.CityColumn) = System.Convert.DBNull
End Sub
Public Function Is_RegionNull() As Boolean
Return Me.IsNull(Me.tableCustomers._RegionColumn)
End Function
Public Sub Set_RegionNull()
Me(Me.tableCustomers._RegionColumn) = System.Convert.DBNull
End Sub
Public Function IsPostalCodeNull() As Boolean
Return Me.IsNull(Me.tableCustomers.PostalCodeColumn)
End Function
Public Sub SetPostalCodeNull()
Me(Me.tableCustomers.PostalCodeColumn) = System.Convert.DBNull
End Sub
Public Function IsCountryNull() As Boolean
Return Me.IsNull(Me.tableCustomers.CountryColumn)
End Function
Public Sub SetCountryNull()
Me(Me.tableCustomers.CountryColumn) = System.Convert.DBNull
End Sub
Public Function IsPhoneNull() As Boolean
Return Me.IsNull(Me.tableCustomers.PhoneColumn)
End Function
Public Sub SetPhoneNull()
Me(Me.tableCustomers.PhoneColumn) = System.Convert.DBNull
End Sub
Public Function IsFaxNull() As Boolean
Return Me.IsNull(Me.tableCustomers.FaxColumn)
End Function
Public Sub SetFaxNull()
Me(Me.tableCustomers.FaxColumn) = System.Convert.DBNull
End Sub
End Class
<System.Diagnostics.DebuggerStepThrough()> _
Public Class CustomersRowChangeEvent
Inherits EventArgs
Private eventRow As CustomersRow
Private eventAction As DataRowAction
Public Sub New(ByVal row As CustomersRow, ByVal action As DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
Public ReadOnly Property Row As CustomersRow
Get
Return Me.eventRow
End Get
End Property
Public ReadOnly Property Action As DataRowAction
Get
Return Me.eventAction
End Get
End Property
End Class
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -