By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,986 Members | 1,537 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,986 IT Pros & Developers. It's quick & easy.

1:N getChildRows ?

P: 37
I'm really lost right now, I can't figure out how to pass to values from a table back to the presentationTier. 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(manufactuer 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

Expand|Select|Wrap|Line Numbers
  1.   Public Function getCarSize(ByVal carSize_String As String) As String
  2.         Dim drCarSize As DataRow
  3.         Dim drVehicles As DataRow()
  4.         Dim manufacturerString As String
  5.         Dim manufModelStrings(10) As String
  6.         Dim modelString As String
  7.         Dim modelStrings(10) As String
  8.         Dim subInt As Integer
  9.  
  10.         drCarSize = aCustomerDataSet.CarSize.FindBySizeCode(carSize_String)
  11.  
  12.         drVehicles = drCarSize.GetChildRows("CarsToVehicleRelation")
  13.  
  14.         For Each drVehicle As DataRow In drVehicles
  15.             manufacturerString = drVehicle.GetParentRow("CarsToVehicleRelation")!manuf_name.ToString
  16.             modelString = drVehicle.GetParentRow("CarsToVehicleRelation")!model.ToString
  17.  
  18.             manufacturerStrings(subInt) = manufacturerString
  19.             modelStrings(subInt) = modelString
  20.  
  21.             subInt += 1
  22.         Next
  23.         Return ' what?
  24.     End Function
  25.  
Nov 2 '06 #1
Share this Question
Share on Google+
1 Reply


Expert 5K+
P: 8,434
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:
Expand|Select|Wrap|Line Numbers
  1. 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.
Nov 2 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.