• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 577
  • Last Modified:

Reader.GetValues... field name?

I am using a reader to get the field values from a table...
        Dim memberID As String = reader.GetValue(0)
        Dim username As String = reader.GetString(1)
        Dim email As String = reader.GetString(2)

How do I use the reader.Get... to get it by the field name?

Like I'm used to using:

Dim memberID As String = rs("username")

How do I do that?

thanks!

0
Starr Duskk
Asked:
Starr Duskk
1 Solution
 
McExpCommented:
This should work for you: -

Dim username As String = reader.GetString(reader.GetOrdinal("Username"))

Open in new window

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.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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