473,387 Members | 1,578 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 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
1 1380
Killer42
8,435 Expert 8TB
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

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

Similar topics

7
by: Ben R. | last post by:
Could someone fill me in on the difference between the following three DataRow methods: GetParentRow GetParentRows GetChildRows I'm guessing the difference between the first two is that one...
9
by: Christopher Weaver | last post by:
I've writtten the following (which compiles and runs). For some reason, TaskRows is always empty. DataRow TaskRows; foreach(DataRow TaskRow in dsTaskActivities.Tables.Rows) { TaskRows =...
3
by: I am Sam | last post by:
I can relate two tables rather easily using the following code: dsClub.Relations.Add("Section_Data", dsClub.Tables.Columns, dsClub.Tables.Columns); Which connects the "Section" table to the...
8
by: I am Sam | last post by:
Hi everyone, This problem is making me old. I don't want to get any older. I have a multi-nested repeater control as follows: <asp:Repeater ID="clubRep1" Runat="server">...
5
by: Geoff Jones | last post by:
Hi How can I search, using SQL commands, an arrow of rows generated from GetChildRows. For example, suppose the result is given by: Dim drMyRows() As DataRow =...
2
by: Joe | last post by:
Hi I have a dataset with 3 tables and 2 relations Is there a way to when I am at 1 row to tell if there is a relation on that row ??? I have the code hardcoded but try to make it work if the #...
2
by: G .Net | last post by:
Hi A question has just occurred to me. I can get the child rows in a relationship using GetChildRows. Further, I can do something like: For Each child As DataRow In...
4
by: Daniel | last post by:
What's wrong with this code? 1 Dim parentRow, childRow as DataRow 2 3 For i = 0 To mainDataTable.Rows.Count - 1 4 parentRow = mainDataTable.Rows(i) 5 childRow =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.