473,480 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Q: Searching the result of relationship

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 = myTable(0).Rows.GetChildRows("MyChoices")

I would like to search for all the rows in drMyRows which satisfy an SQL
condition. I thought there may be a "Select" or "RowFilter" method I could
use but I can't find an example of one.

The only other thing I can think of is to iterate through each row and check
each one against the condition. Okay, it'll work, but I'd hoped there was an
inbuilt way to do it; if only in the hope it would be faster and more
efficient?

Can anybody help?

Thanks in advance

Geoff
Nov 20 '05 #1
5 1263
Hi Geoff,

I showed you more times that when there is a childrelation, there should be
a filter item that makes the relation. You do not want to use that, why?

Am I missing something?

Cor
Nov 20 '05 #2
Geoff,
I'm not sure if this will work, but, it may help to get you in the right
direction. How are you getting an array of rows with out specifing which row
to get child rows from? Your code: Rows.GetChildRows("MyChoices"), Example
Code: Rows(0).GetChildRows("MyChoices").

Dim Rows() As DataRow = ds.Tables(0).Rows(0).GetChildRows("MyChoices")
Dim dt As New DataTable
For Each row As DataRow In Rows
dt.ImportRow(row)
Next
Rows = dt.Select("MyColumn=MyValue")

'OR

'Dim dv As New DataView(dt)
'Filter here

"Geoff Jones" <ge***@NODAMNSPAM.com> wrote in message
news:40***********************@news.dial.pipex.com ...
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 = myTable(0).Rows.GetChildRows("MyChoices")

I would like to search for all the rows in drMyRows which satisfy an SQL
condition. I thought there may be a "Select" or "RowFilter" method I could
use but I can't find an example of one.

The only other thing I can think of is to iterate through each row and
check
each one against the condition. Okay, it'll work, but I'd hoped there was
an
inbuilt way to do it; if only in the hope it would be faster and more
efficient?

Can anybody help?

Thanks in advance

Geoff

Nov 20 '05 #3
Hi Cor

No, your solution is very elegant and does indeed work. However, it does
surprise me that there are no other alternatives i.e. I would have expected
some kind of "Select" or "RowFilter" for an array of Rows. Obviously I'm
mistaken.

Geoff

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:O7**************@TK2MSFTNGP12.phx.gbl...
Hi Geoff,

I showed you more times that when there is a childrelation, there should be a filter item that makes the relation. You do not want to use that, why?

Am I missing something?

Cor

Nov 20 '05 #4
Geoff,

When you write that, there is one, the find (the fastest) however that needs
a key in the rowscollection.

http://msdn.microsoft.com/library/de...sfindtopic.asp

Cor
Hi Cor

No, your solution is very elegant and does indeed work. However, it does
surprise me that there are no other alternatives i.e. I would have expected some kind of "Select" or "RowFilter" for an array of Rows. Obviously I'm
mistaken.

Geoff

Nov 20 '05 #5
Geoff,
How's that go? The third time is the charm.

I've answered this for you on both 7/6 & 7/13.

Instead of DataRow.GetChildRows use a DataView and use
DataRowView.CreateChildView.

Then you can set the RowFilter property of the DataView returned.

Dim view As New DataView(myTable)

For Each parent As DataRowView In view
Dim prices As DataView = parent.CreateChildView("PricesCompany")
prices.RowFilter = "Prices = '2'"
For Each price As DataRowView In prices
Debug.WriteLine(price!Prices, "Prices")
Debug.WriteLine(price!Company, "Company")
Next
Next

Hope this helps
Jay

"Geoff Jones" <ge***@NODAMNSPAM.com> wrote in message
news:40***********************@news.dial.pipex.com ...
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 = myTable(0).Rows.GetChildRows("MyChoices")

I would like to search for all the rows in drMyRows which satisfy an SQL
condition. I thought there may be a "Select" or "RowFilter" method I could
use but I can't find an example of one.

The only other thing I can think of is to iterate through each row and check each one against the condition. Okay, it'll work, but I'd hoped there was an inbuilt way to do it; if only in the hope it would be faster and more
efficient?

Can anybody help?

Thanks in advance

Geoff

Nov 20 '05 #6

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

Similar topics

7
6777
by: MIA | last post by:
Hi, I have an nxn array in which in each row is consisting of +ve and -ve numbers, such that -ve number comes before +ve numbers. e.g. -45 | -9 | -3 | 2 =================== -5 | -9 | 21 |...
1
2400
by: Robert Oschler | last post by:
I read a while back that MySQL will only use one index per query. (If this is not so, please tell me and point me to a doc that gives a good explanation of MySQL's current index usage policy). ...
1
923
by: Geoff Jones | last post by:
Hi I have a question regarding searching and filtering etc. Suppose I have some data rows i.e. an array, which have been generated via a relationship on two tables. What would be the best way...
5
2379
by: justobservant | last post by:
When more than one keyword is typed into a search-query, most of the search-results displayed indicate specified keywords scattered throughout an entire website of content i.e., this is shown as...
7
2602
by: pbd22 | last post by:
Hi. I am somewhat new to this and would like some advice. I want to search my xml file using "keyword" search and return results based on "proximity matching" - in other words, since the search...
3
3264
by: Aaron | last post by:
I'm trying to parse a table on a webpage to pull down some data I need. The page is based off of information entered into a form. when you submit the data from the form it displays a...
2
1118
by: wietmie | last post by:
Hai, i just wanna ask, is it possible to do a searching result like google using VB6.0, but google are too complicated, what i mean just, user put the searching word in the textbox, then it will...
5
3163
by: lemlimlee | last post by:
hello, this is the task i need to do: For this task, you are to develop a Java program that allows a user to search or sort an array of numbers using an algorithm that the user chooses. The...
5
3518
by: Sevla | last post by:
hello guys i set this code , and i would like to know if its possible set "quotes" on the searched word. Thank You #word searching program within a txt file #!C:/perl/bin/perl.exe start:
0
7044
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
7045
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,...
1
6741
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
4483
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2985
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
182
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.