Home All Groups Group Topic Archive Search About
Author
23 Aug 2006 2:49 PM
samoore33
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

Author
23 Aug 2006 3:15 PM
Izzy
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:
Show quoteHide quote
> 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
Author
23 Aug 2006 3:38 PM
samoore33
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:
Show quoteHide quote
> 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
Author
23 Aug 2006 4:16 PM
Izzy
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:
Show quoteHide quote
> 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
Author
23 Aug 2006 4:23 PM
samoore33
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:
Show quoteHide quote
> 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
Author
23 Aug 2006 5:27 PM
Cor Ligthert [MVP]
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