1:N getChildRows ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • delusion7
    New Member
    • Sep 2006
    • 37

    1:N getChildRows ?

    I'm really lost right now, I can't figure out how to pass to values from a table back to the presentationTie r. I am searching by the value selected in the parent(carSize) using a comboBox and passing the selected value to the dataTier to select the childRows(manuf actuer and model). The child values will be set into a dataGrid. Here is my code, any advice would be greatly appreciated! Should I just return the dataSet instead of doing it this way and then setup everything in the presentation? Thank you

    Code:
      Public Function getCarSize(ByVal carSize_String As String) As String
            Dim drCarSize As DataRow
            Dim drVehicles As DataRow()
            Dim manufacturerString As String
            Dim manufModelStrings(10) As String
            Dim modelString As String
            Dim modelStrings(10) As String
            Dim subInt As Integer
    
            drCarSize = aCustomerDataSet.CarSize.FindBySizeCode(carSize_String)
    
            drVehicles = drCarSize.GetChildRows("CarsToVehicleRelation")
    
            For Each drVehicle As DataRow In drVehicles
                manufacturerString = drVehicle.GetParentRow("CarsToVehicleRelation")!manuf_name.ToString
                modelString = drVehicle.GetParentRow("CarsToVehicleRelation")!model.ToString
    
                manufacturerStrings(subInt) = manufacturerString
                modelStrings(subInt) = modelString
    
                subInt += 1
            Next
            Return ' what?
        End Function
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    I can't advise on what is a good way to go about it, but I'd like to point out that you can in fact modify the "input" parameters in a function, unless they are passed ByVal. So in theory, you could include output parameters inside the parentheses, and return values in them.

    In other words, you can do something like:
    Code:
    Public Function DoSomething(In1, In2, Out1, Out2, Out3) As Long
    And of course, depending on how it is to be used and what you want from it, you could then make it a Sub rather than a Function.

    As to whether this is an acceptable practise, that's your call.

    Comment

    Working...