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

Help with searching DataRow array...

P: n/a
Hello

I'm having some difficulty searching a set of rows in a DataRow collection..
This is my question
What would be an efficient way to search any column of an DataRow array

Let me try to explain the context of this question, that will help you understand what I'm looking for..
Assume that I have a collection of rows that came out of a statement like this
dim myRows() as DataRow = myTable.Select("any query"

Now that I have this array of rows, I need to find an specific row that matches certain criteria..
For example, "name = Joe"..
If I look at the available options from intellisense when I type "myRows.", I cannot find any function or method that I can call and pass my further search query for a field "name" that contains "Joe"..

With this scenario in mind, my real problem does not allow me to pass to the "myTable" DataTable one select command already containing "name = 'Joe'" because I don't have access to the DataTable
This portion of the code receives rows, and can only deal with them, not with the original datatable

Back to the question
What would be an efficient way to search any column of an DataRow array

Thanks in advance for any help you can provide

Carlos
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Cor
Hi Carlos,

Because you have not any access to the datatable you have not any tool also.
The datarowcollection.find is excelent for your question, but for that it
has to be the primarykey in the datatable.

When you have a lot of search to do you can of course build a datatable
back.
When it are a few you should use the normal for index loop (and exit that if
you found your row)

I hope this helps,

Cor
I'm having some difficulty searching a set of rows in a DataRow collection... This is my question:
What would be an efficient way to search any column of an DataRow array?

Let me try to explain the context of this question, that will help you understand what I'm looking for... Assume that I have a collection of rows that came out of a statement like this: dim myRows() as DataRow = myTable.Select("any query")

Now that I have this array of rows, I need to find an specific row that matches certain criteria... For example, "name = Joe"...
If I look at the available options from intellisense when I type "myRows.", I cannot find any function or method that I can call and pass my
further search query for a field "name" that contains "Joe"...
With this scenario in mind, my real problem does not allow me to pass to the "myTable" DataTable one select command already containing "name = 'Joe'"
because I don't have access to the DataTable! This portion of the code receives rows, and can only deal with them, not with the original datatable.
Back to the question:
What would be an efficient way to search any column of an DataRow array?

Thanks in advance for any help you can provide!

Nov 20 '05 #2

P: n/a
Thanks for the ideas, Cor...

I'm thinking about re-building the datatable locally and
then search.

That might be faster for my application.

Thanks again,
Carlos
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.