Solved

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

Posted on 2011-02-14
4
231 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
  • 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

Technology Partners: 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

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

680 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