Looping Through a Datarow

Posted on 2009-12-21
Last Modified: 2012-05-08

I'm looping through the DataRow collection of a table and getting each row out one at a time with a For Each loop.  I want to do the same thing with the columns of a DataRow object, but it's not set up that way.  What is the best way to do this?
Question by:NigelRocks
    LVL 21

    Accepted Solution

    why do you need to loop through each column?  its not set up for that because a datatable will always have the same column names for each row...

    so you just call it explicitly

    LVL 21

    Assisted Solution

    if you want to get the column Name because you don't know the name or amount of columns for the table

    see this link
    LVL 21

    Assisted Solution

    code snippet

    For Each table in dataSet.Tables
            For Each column in table.Columns

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    734 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

    22 Experts available now in Live!

    Get 1:1 Help Now