Solved

VB.NET - How do I retrieve a value from a particular column in a DataTable?

Posted on 2011-02-14
4
235 Views
Last Modified: 2012-05-11
Here's a basic question.  What code do I use to retrieve values from a particular column in the data row?  I want to reference the column by column name not by column index.
Dim dstPadlockRow As DataSet
Dim dr As DataRow
Dim ColumnValue As String
      
.... ' omitted code

For Each dr In dstPadlockRow.Tables(0).Rows
   ColumnValue = dr.    <------------- What do I do here?
   .... ' more omitted code
Next

Open in new window

0
Comment
Question by:jdana
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 34887199
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 250 total points
ID: 34887201
For vb.net: dr("YourFieldName")
0
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 250 total points
ID: 34887385
ColumnValue = dr.Item("YourColumnName").ToString
0
 

Author Closing Comment

by:jdana
ID: 34897359
Thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

729 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