473,386 Members | 1,699 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,386 software developers and data experts.

Q: GetChildRows

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 parent.GetChildRows("Relationship1")
......
Next

What I'd like to know is how to return the same rows but sorted in some
manner. For example, in reverse order or sorted by a date field in the child
row.

I know I can get the rows using a Select statement BUT I'm wondering if I
can achieve a "sorting" of the children using the technique above.

Does anybody have any ideas?

G
Oct 4 '06 #1
2 3250
It depends how your relationships are setup and when you want to sort,
but you can use Table Views to do some of this.

myDataTable.DefaultView.Sort = "ColumnName DESC"

where the Sort expression is similar to what you would use in SQL.
G .Net wrote:
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 parent.GetChildRows("Relationship1")
.....
Next

What I'd like to know is how to return the same rows but sorted in some
manner. For example, in reverse order or sorted by a date field in the child
row.

I know I can get the rows using a Select statement BUT I'm wondering if I
can achieve a "sorting" of the children using the technique above.

Does anybody have any ideas?

G
Oct 4 '06 #2
Hi Charlie

I thought your suggestion looked like the solution when I first saw it.
Unfortunately it didn't work :(

Basically, I tried setting the default view of the child table to sort first
on one of its columns. However, the order of the child rows returned in the
code below does not appear to alter for the code below:

For Each child As DataRow In parent.GetChildRows("Relationship1")

Next

Can you be of any further help?

Thanks again
"Charlie Brown" <cb****@duclaw.comwrote in message
news:11*********************@c28g2000cwb.googlegro ups.com...
It depends how your relationships are setup and when you want to sort,
but you can use Table Views to do some of this.

myDataTable.DefaultView.Sort = "ColumnName DESC"

where the Sort expression is similar to what you would use in SQL.
G .Net wrote:
>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 parent.GetChildRows("Relationship1")
.....
Next

What I'd like to know is how to return the same rows but sorted in some
manner. For example, in reverse order or sorted by a date field in the
child
row.

I know I can get the rows using a Select statement BUT I'm wondering if I
can achieve a "sorting" of the children using the technique above.

Does anybody have any ideas?

G

Oct 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

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 #...
1
by: delusion7 | last post by:
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...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.