Solved

Reader.GetValues... field name?

Posted on 2007-11-19
1
567 Views
Last Modified: 2008-02-01
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
Comment
Question by:BobCSD
1 Comment
 
LVL 16

Accepted Solution

by:
McExp earned 500 total points
ID: 20316545
This should work for you: -

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

Open in new window

0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now