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 )
mddohmAsked:
Who is Participating?
 
Kiran SonawaneProject LeadCommented:
You are doing wrong.

x = 4
Dim foundRows() As DataRow
foundRows = dt.Select("Type = " & x)
Dim your_description As String
your_description = foundRows(0)("Description")
0
 
razza_bCommented:
try dt.Rows(3) ??
0
 
Kiran SonawaneProject LeadCommented:
You can use datatable select method
YourDataTable.Select("Type = 4"); which returns array of DataRow
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
mddohmAuthor Commented:
How do I get the value of the description column?
x = 4
dt.Select("Type = " & x)("Description")
0
 
Kiran SonawaneProject LeadCommented:
0
 
Kiran SonawaneProject LeadCommented:
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
0
 
mddohmAuthor Commented:
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
0
 
mddohmAuthor Commented:
Thanks for bearing with me.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.