Link to home
Create AccountLog in
Avatar of AWestEng
AWestEngFlag for Sweden

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of AWestEng

ASKER

ok, so i can't use the name then.
If you have the same name I don't know. You can maybe try C4_1 (not shure)
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
>> 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