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

Home Posts Topics Members FAQ

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.Table s("State")
Dim strExpr As String
strExpr = "id = '" & theState.ToStri ng() & "'"
Dim foundRow() As DataRow
foundRow = t.Select(strExp r)

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

Scott

Aug 23 '06 #1
5 8339
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.Table s("State")
Dim strExpr As String
strExpr = "id = '" & theState.ToStri ng() & "'"
Dim foundRow() As DataRow
foundRow = t.Select(strExp r)

Dim taxRow() As DataRow
taxRow = myDataSet.Table s("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.Table s("State")
Dim strExpr As String
strExpr = "id = '" & theState.ToStri ng() & "'"
Dim foundRow() As DataRow
foundRow = t.Select(strExp r)

Dim taxRow() As DataRow
taxRow = myDataSet.Table s("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("c olumn = 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.Table s("State")
Dim strExpr As String
strExpr = "id = '" & theState.ToStri ng() & "'"
Dim foundRow() As DataRow
foundRow = t.Select(strExp r)
>
Dim taxRow() As DataRow
taxRow = myDataSet.Table s("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("c olumn = 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.Table s("State")
Dim strExpr As String
strExpr = "id = '" & theState.ToStri ng() & "'"
Dim foundRow() As DataRow
foundRow = t.Select(strExp r)

Dim taxRow() As DataRow
taxRow = myDataSet.Table s("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.Table s("State")
Dim strExpr as STring = "id = '" & theState.ToStri ng() & "'"
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
2669
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 property but seems like it's getting overridden. Any ideas? Thanks in advance,
10
2724
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
14681
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 combobox instead of fetching the
2
1624
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 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"
6
2702
by: zfareed | last post by:
<code> #include <iostream> #include <fstream> const int MAX_LENGTH = 10; using namespace std;
1
3149
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 from a table and outputs the value to a cell in MS Excel. My code is as follow: // DataRow a = dt.Rows;
3
5599
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 for me to get all the data w/one query. The problem I need help with is getting the DataGrid to reflect changes from a sort. The foundRows DataRow array contains correctly sorted rows (verified), but I can't get the table updated in the DataGrid....
2
2059
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. ---------------------------------------------------------------------- Sub Main() Dim array As Integer() = New Integer(3) {} Dim search As Integer For i As Integer = 0 To array.GetUpperBound(0)
1
3388
by: Garima12 | last post by:
What is the benefit of creating DataTable over array of DataRow and vice versa?
0
8392
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8823
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...
1
8503
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
8603
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7320
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...
0
4151
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
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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 we have to send another system
2
1604
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.