mddohm
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 )
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 )
try dt.Rows(3) ??
You can use datatable select method
YourDataTable.Select("Type = 4"); which returns array of DataRow
YourDataTable.Select("Type
ASKER
How do I get the value of the description column?
x = 4
dt.Select("Type = " & x)("Description")
x = 4
dt.Select("Type = " & x)("Description")
Look at this below example
http://msdn.microsoft.com/ en-us/libr ary/det4aw 50.aspx#Y1 35
http://msdn.microsoft.com/
Something like this
foundRows = Your_data_table.Select("Ty pe = " & x)
Dim i As Integer
For i = 0 to foundRows.GetUpperBound(0)
Console.WriteLine(foundRow s(i)("Desc ription"))
Next i
foundRows = Your_data_table.Select("Ty
Dim i As Integer
For i = 0 to foundRows.GetUpperBound(0)
Console.WriteLine(foundRow
Next i
ASKER
x = 4
dt.Select("Type = " & x.GetUpperBound(0).ToStrin g() 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
dt.Select("Type = " & x.GetUpperBound(0).ToStrin
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for bearing with me.