Get item from dataset with same column name

Hi

If i have a sql query that returns a datsset that looks like this

C1 C2 C3 C4 C4

how do i get the C4 when there are two columns with same name

For Each Row In ds.Tables(0).Rows
   strC1 = Row("C1").ToString
   strC2 = Row("C2").ToString
    strC3 = Row("C3").ToString
   strC4_1 = Row(" ???").ToString
    strC4_2 = Row(" ???").ToString
Next
LVL 1
AWestEngAsked:
Who is Participating?
 
Jorge PaulinoIT Pro/DeveloperCommented:
Use the value instead of the name
strC4_1 = Row(3).ToString
0
 
AWestEngAuthor Commented:
ok, so i can't use the name then.
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
If you have the same name I don't know. You can maybe try C4_1 (not shure)
0
 
AWestEngAuthor Commented:
or is it possible to change the name on one og the columns when getting the data from the mysql server .
why they have the same name is because it's a join statment from two tables
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
>> is it possible to change the name on one og the columns
Yes, you can do:

SELECT C1,C2,C3,C4,C4 As MyColumn WHERE ...

Then use:
strC4_1 = Row("MyColumn").ToString

Thanks for the grade.
jpaulino
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.