473,657 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with searching DataRow array...

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
2 1624
Cor
Hi Carlos,

Because you have not any access to the datatable you have not any tool also.
The datarowcollecti on.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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1936
by: Tommy Lang | last post by:
I am working on this project and I need some help/pointers/comments to get me started, I am stuck. The program will be used to store information in an array while it is running. I need to store objects of my classes Person(superclass), Student(inherit Person), Teacher(inherit Person) in that array. The name will be the unique key. These classes are all working ok. I want to be able to add, remove, find etc. objects. To all of this, I...
2
3297
by: Petez | last post by:
Hi, I want to declare array of System::Data::DataRow but how? With single variable I write System::Data::DataRow^ aRow but statement System::Data::DataRow^ - not works. System::Data::DataRow* - not works. System::Data::DataRow^^ - not works. I need this array for store result of DataTable->Rows->Select(...) Thanks, Peter
7
2201
by: Dan | last post by:
Hi. I'm having a problem with searching a databse entry. I'm new to dotnet and still trying to figure some things out. In order to locate a row in an access databse file .mdb, i am using this call Dim dr As DataRow dr = Me.DsMaster.Tables("MasterList").Rows.Find(Me.txtScan.Text) where me.txtscan.text is a value from 2 to 9323493000236.
2
1519
by: Allen | last post by:
Hey all, I have a question for you all. I'm learning vb.net and need some help. I have two classes one named Customers and one named CustomersDA. I have to go though Customer for everything. I have a listbox that needs to get data from an array. I call a function called GetAll that is a ArrayList in Customers that then calls CustomersDA.GetAll that is also an array list but returns customers (see code below).I need to fill a listbox from...
16
2002
by: Allen | last post by:
I have a class that returns an arraylist. How do I fill a list box from what is returned? It returns customers which is a arraylist but I cant seem to get the stuff to fill a list box. I just learning and really need some help bad. Public Shared Function GetAll() As ArrayList Dim dsCustomer As New DataSet() Dim sqlQuery As String = "SELECT Name, Address, PhoneNo " & _ "FROM CustomerTable" Try
0
974
by: dalaimanoj | last post by:
Hi experts, I have a form in which there are 4 textboxes and few command buttons like New, View, Save, Delete. I want to insert the values entered in textboxes are to be stored in an Oracle database table 'mst_users' when the Save button is clicked. I have declared the below variables in the form declaration section. Dim conn As New OleDb.OleDbConnection() Dim da As New OleDb.OleDbDataAdapter() Dim dc As New...
1
9956
by: palmah11 | last post by:
Hi, I have a Windows Application in which i am using Janus GRidEx for displying data. In this Janus Grid i have a check box column. i want a functionality if user selects checkbox for particula row(s) and then hit delete button, the dat should get deleted. For this i am using GetCheckedRows method to retrieve all checked rows. This method return an array of Janus.Windows.GridEX.GridEXRow. I want to convert this array into datarow array...
2
10260
by: Paulo | last post by:
DataRow dr = (DataRow)ds.Tables.Rows.ItemArray; Error 1 Cannot convert type 'object' to 'System.Data.DataRow' C:\Documents and Settings\Fabio\Meus documentos\Visual Studio 2005\Projects\CodBarraPalm\CodBarraPalm\Default.aspx.cs 35 26 CodBarraPalm ? why this error trying to get the contents of a row on a DataSet?
9
35802
by: myotheraccount | last post by:
Hello, Is there a way to convert a DataRow to a StringArray, without looping through all of the items of the DataRow? Basically, I'm trying to get the results of a query and put them into a listbox. Right now it is done like this:
0
8829
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8734
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8508
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7341
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6172
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5633
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4164
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1962
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.