473,399 Members | 3,832 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,399 software developers and data experts.

Search DataRow Array

I use the code below to return rows matching the state in the theState
variable. I want to know if it is possible to search through the
DataRow that I am returning with the search. I understand that that
creates a DataRow Array.

I searched through group postings and found where Cor had said
something about bulding the DataTable back, not sure what that meant of
if I could use it with this, but any help would be appreciated.

Dim t As DataTable
t = myDataSet.Tables("State")
Dim strExpr As String
strExpr = "id = '" & theState.ToString() & "'"
Dim foundRow() As DataRow
foundRow = t.Select(strExpr)

Dim taxRow() As DataRow
taxRow = myDataSet.Tables("Tax").Select("Taxes_Id = '" & foundRow(0)(3)
& "'")

Scott

Aug 23 '06 #1
5 8318
I'm a little confused as to what your trying to accomplish. Can you
provide more details as to what your trying to accomplish.
samoore33 wrote:
I use the code below to return rows matching the state in the theState
variable. I want to know if it is possible to search through the
DataRow that I am returning with the search. I understand that that
creates a DataRow Array.

I searched through group postings and found where Cor had said
something about bulding the DataTable back, not sure what that meant of
if I could use it with this, but any help would be appreciated.

Dim t As DataTable
t = myDataSet.Tables("State")
Dim strExpr As String
strExpr = "id = '" & theState.ToString() & "'"
Dim foundRow() As DataRow
foundRow = t.Select(strExpr)

Dim taxRow() As DataRow
taxRow = myDataSet.Tables("Tax").Select("Taxes_Id = '" & foundRow(0)(3)
& "'")

Scott
Aug 23 '06 #2
I am using the code I inserted below to search through a DataTable in
my DataSet. When I search through this DataTable, it returns to the
taxRow that I declare as a DataRow.

I want to know if I can search through the results of the taxRow
DataRow. In this DataSet there can be more then one tax value for each
state. For instance...

NY can have one tax value, the minimun dollar amount would be $0 and
the maximum dollar amount would be $100. For that group, the tax value
would be .0643.

Ny can have another tax value, the minimum dollar amount would be
$100.01 and the maximum dollar amount value would be $1000. For that
group, the tax value would be .09342.

When I use the code below to search through the DataSet, I would have
two rows returned for New York in the taxRow. I want to search through
the taxRow DataRow to find certain values that I may need to update.

I hope this helps.

Thanks.

Scott

Izzy wrote:
I'm a little confused as to what your trying to accomplish. Can you
provide more details as to what your trying to accomplish.
samoore33 wrote:
I use the code below to return rows matching the state in the theState
variable. I want to know if it is possible to search through the
DataRow that I am returning with the search. I understand that that
creates a DataRow Array.

I searched through group postings and found where Cor had said
something about bulding the DataTable back, not sure what that meant of
if I could use it with this, but any help would be appreciated.

Dim t As DataTable
t = myDataSet.Tables("State")
Dim strExpr As String
strExpr = "id = '" & theState.ToString() & "'"
Dim foundRow() As DataRow
foundRow = t.Select(strExpr)

Dim taxRow() As DataRow
taxRow = myDataSet.Tables("Tax").Select("Taxes_Id = '" & foundRow(0)(3)
& "'")

Scott
Aug 23 '06 #3
You could make a duplicate of your Tax table then take the rows you
selected from the first and add then to the duplicate table. Once they
are in there you could do another Table.Select("column = value")

Is this data stored in Sql Server? If so, then you might want to use
Stored Procedures to select the data your looking for.

Hope this helps,
Izzy
samoore33 wrote:
I am using the code I inserted below to search through a DataTable in
my DataSet. When I search through this DataTable, it returns to the
taxRow that I declare as a DataRow.

I want to know if I can search through the results of the taxRow
DataRow. In this DataSet there can be more then one tax value for each
state. For instance...

NY can have one tax value, the minimun dollar amount would be $0 and
the maximum dollar amount would be $100. For that group, the tax value
would be .0643.

Ny can have another tax value, the minimum dollar amount would be
$100.01 and the maximum dollar amount value would be $1000. For that
group, the tax value would be .09342.

When I use the code below to search through the DataSet, I would have
two rows returned for New York in the taxRow. I want to search through
the taxRow DataRow to find certain values that I may need to update.

I hope this helps.

Thanks.

Scott

Izzy wrote:
I'm a little confused as to what your trying to accomplish. Can you
provide more details as to what your trying to accomplish.
samoore33 wrote:
I use the code below to return rows matching the state in the theState
variable. I want to know if it is possible to search through the
DataRow that I am returning with the search. I understand that that
creates a DataRow Array.
>
I searched through group postings and found where Cor had said
something about bulding the DataTable back, not sure what that meant of
if I could use it with this, but any help would be appreciated.
>
Dim t As DataTable
t = myDataSet.Tables("State")
Dim strExpr As String
strExpr = "id = '" & theState.ToString() & "'"
Dim foundRow() As DataRow
foundRow = t.Select(strExpr)
>
Dim taxRow() As DataRow
taxRow = myDataSet.Tables("Tax").Select("Taxes_Id = '" & foundRow(0)(3)
& "'")
>
Scott
Aug 23 '06 #4
I wish it was izzy. This is in an XML doc that I am writing into a
dataset. The user is going to create this XML doc locally on their pc.

Izzy wrote:
You could make a duplicate of your Tax table then take the rows you
selected from the first and add then to the duplicate table. Once they
are in there you could do another Table.Select("column = value")

Is this data stored in Sql Server? If so, then you might want to use
Stored Procedures to select the data your looking for.

Hope this helps,
Izzy
samoore33 wrote:
I am using the code I inserted below to search through a DataTable in
my DataSet. When I search through this DataTable, it returns to the
taxRow that I declare as a DataRow.

I want to know if I can search through the results of the taxRow
DataRow. In this DataSet there can be more then one tax value for each
state. For instance...

NY can have one tax value, the minimun dollar amount would be $0 and
the maximum dollar amount would be $100. For that group, the tax value
would be .0643.

Ny can have another tax value, the minimum dollar amount would be
$100.01 and the maximum dollar amount value would be $1000. For that
group, the tax value would be .09342.

When I use the code below to search through the DataSet, I would have
two rows returned for New York in the taxRow. I want to search through
the taxRow DataRow to find certain values that I may need to update.

I hope this helps.

Thanks.

Scott

Izzy wrote:
I'm a little confused as to what your trying to accomplish. Can you
provide more details as to what your trying to accomplish.
>
>
samoore33 wrote:
I use the code below to return rows matching the state in the theState
variable. I want to know if it is possible to search through the
DataRow that I am returning with the search. I understand that that
creates a DataRow Array.

I searched through group postings and found where Cor had said
something about bulding the DataTable back, not sure what that meant of
if I could use it with this, but any help would be appreciated.

Dim t As DataTable
t = myDataSet.Tables("State")
Dim strExpr As String
strExpr = "id = '" & theState.ToString() & "'"
Dim foundRow() As DataRow
foundRow = t.Select(strExpr)

Dim taxRow() As DataRow
taxRow = myDataSet.Tables("Tax").Select("Taxes_Id = '" & foundRow(0)(3)
& "'")

Scott
Aug 23 '06 #5
Scott

I don't know where I have written to build the table back

However you have more possibilities to create a new datatable from a
filtered other one.

The most simple one is in my idea probably in VB 2005

\\\
Dim t as DataTable = myDataSet.Tables("State")
Dim strExpr as STring = "id = '" & theState.ToString() & "'"
t.rowfilter = strExpr
dim newtable as datatable = t.totable()
///

http://msdn2.microsoft.com/en-us/library/a8ycds2f.aspx

Be aware that this is a new table.

Where your original table comes from is in no way important by the way.

I hope this helps,

Cor
Aug 23 '06 #6

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

Similar topics

6
by: rodchar | last post by:
Hey all, I have an array of data rows that when I bind it to a datagrid it shows all those extra rows in addition to my fields. How do I hide those fields? I tried using the TableStyles...
10
by: Craig Keightley | last post by:
I have the following array: function showCPUs(){ //name brandID dualCore dualProcessor var cpuItem=; var cpuItem=; var cpuItem=; var cpuItem=; var cpuItem=; var cpuItem=; var cpuItem=;
3
by: Shravan | last post by:
Hi, How can I bind DataRow array to ComboBox. I tried setting DataSource -> DataRow Array DisplayMember -> ColumnName But it was showing "System.Data.DataRow" for every item in the...
2
by: Carlos K | last post by:
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...
6
by: zfareed | last post by:
<code> #include <iostream> #include <fstream> const int MAX_LENGTH = 10; using namespace std;
1
by: NiteshR | last post by:
Please Help! Hi, iv been struggling to figure this out for some time now. Im using visual studio 2005(C#). I want to declare an Array (Pre-defined) of datatype 'Datarow'. The code gets a value...
3
by: joelzn | last post by:
I have a hand built dataset where some columns come from a sql database and others are calculated and eventually I will have two different query results going into one table because its impossible...
2
by: Rohullah | last post by:
Hello I want to search number in array, i wrote the following code but it doesnt work please check it and sned me the solution....
1
by: Garima12 | last post by:
What is the benefit of creating DataTable over array of DataRow and vice versa?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
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...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.