' Checks business rules against the specified DataTable Public Overrides Function CheckRulesHook(ByVal ds As DataSet, ByVal tableName As String) As Boolean Dim result As Boolean = True Dim RowCount As Integer = ds.Tables(tableName).Rows.Count Dim row As Integer For row = 0 To RowCount - 1 Me.DataRow = ds.Tables(tableName).Rows(row) Me.CurrentRow = row If TypeOf Me.DataRow("Quantity") Is Int16 Then Me.ValidateQuantity(CType(Me.DataRow("Quantity"), System.Int16)) Me.ValidateProductID(CInt(Me.DataRow("ProductID"))) End If Next row Return result End Function
' Checks business rules against the specified DataTable Public Overrides Function CheckRulesHook(ByVal ds As DataSet, ByVal tableName As String) As Boolean Me.ValidateShipName(Me.DataRow("ShipName")) Me.ValidateShipRegion(Me.DataRow("ShipRegion").ToString()) Return Me.ErrorProviderBrokenRuleCount = 0 End Function
' Checks business rules against the specified DataTable Public Overrides Function CheckRulesHook _ (ByVal ds As DataSet, ByVal tableName As String) As Boolean If Not (ds Is Nothing) Then Dim dr As DataRow = ds.Tables(tableName).Rows(0) Me.ValidateVisitId(CInt(Me.DataRow("VisitId"))) End If Return Me.ErrorProviderBrokenRuleCount = 0 End FunctionPerhaps a brief walkthough of what each of these examples is attempting to do would be useful.