[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 976
  • Last Modified:

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
0
AWestEng
Asked:
AWestEng
  • 3
  • 2
1 Solution
 
jpaulinoCommented:
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
 
jpaulinoCommented:
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
 
jpaulinoCommented:
>> 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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now