?
Solved

DataSet Madness

Posted on 2011-09-28
8
Medium Priority
?
212 Views
Last Modified: 2012-05-12
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 )
0
Comment
Question by:mddohm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 1

Expert Comment

by:razza_b
ID: 36716124
try dt.Rows(3) ??
0
 
LVL 17

Expert Comment

by:sonawanekiran
ID: 36716137
You can use datatable select method
YourDataTable.Select("Type = 4"); which returns array of DataRow
0
 

Author Comment

by:mddohm
ID: 36716149
How do I get the value of the description column?
x = 4
dt.Select("Type = " & x)("Description")
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 17

Expert Comment

by:sonawanekiran
ID: 36716154
0
 
LVL 17

Expert Comment

by:sonawanekiran
ID: 36716163
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
 

Author Comment

by:mddohm
ID: 36716186
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
 
LVL 17

Accepted Solution

by:
sonawanekiran earned 2000 total points
ID: 36716203
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
 

Author Closing Comment

by:mddohm
ID: 36716243
Thanks for bearing with me.
0

Featured Post

AWS Certified Solutions Architect - Associate

This course has been developed to provide you with the requisite knowledge to not only pass the AWS CSA certification exam but also gain the hands-on experience required to become a qualified AWS Solutions architect working in a real-world environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question