AWestEng
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you have the same name I don't know. You can maybe try C4_1 (not shure)
ASKER
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
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
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
ASKER