Link to home
Start Free TrialLog in
Avatar of mddohm
mddohmFlag for United States of America

asked on

DataSet Madness

I am having a bit of a brain fart on this.  I have a table that is returned as a dataset \ datatable.  

The table is laid out like this.

Type     sysid                   DESCRIPTION
0           BLANK                BLANK      
1          OnlineTkt              Online Ticket
2          InstantTkt              Instant Ticket
4          Discount              Discount
5         Merchandise        Merchandise
6         PartnerPlay              Partner Play
7        DoubleTripler             Doubler/Tripler
9        2ndChance             Second Chance

I would expect this code to return the value dt.Rows(4)("Description") Discount, but instead return Merchandise.  Is there away I can look at this based on the Type Column versus Row number?  In other words Select Description where TYPE = x  ( which should is 4 )
Avatar of razza_b
razza_b

try dt.Rows(3) ??
Avatar of Kiran Sonawane
You can use datatable select method
YourDataTable.Select("Type = 4"); which returns array of DataRow
Avatar of mddohm

ASKER

How do I get the value of the description column?
x = 4
dt.Select("Type = " & x)("Description")
Something like this

    foundRows = Your_data_table.Select("Type = " & x)

    Dim i As Integer
   
    For i = 0 to foundRows.GetUpperBound(0)
       Console.WriteLine(foundRows(i)("Description"))
    Next i
Avatar of mddohm

ASKER

x = 4

dt.Select("Type = " & x.GetUpperBound(0).ToString() does not work....

The select will narrow this down to one row, is there an easier way to get the value of the Description column?  I need to send the datatable to another Call
ASKER CERTIFIED SOLUTION
Avatar of Kiran Sonawane
Kiran Sonawane
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mddohm

ASKER

Thanks for bearing with me.