Solved

Reader.GetValues... field name?

Posted on 2007-11-19
1
571 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:Starr Duskk
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

830 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