473,395 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to get columns value from DataRow while DataTable Looping

Hi All,

How to get column value from datarow while datatable looping ?

Please advised !
Nov 16 '05 #1
1 25447
> How to get column value from datarow while datatable looping ?

Not sure if this is what you're looking for, but I've used this:

foreach (DataTable t in myDataSet.Tables)
{
foreach (DataRow r in t.Rows)
{
foreach (DataColumn c in t.Columns)
{
if (r[c] != null)
{
Console.WriteLine(r[c]);
}
}
}
}
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: rodrigo | last post by:
How to get get the last inserted key (value NOT column) in a specific dataTable dt right after dt.Rows.InsertAt according to code and schema below. The key is a autoincrement column. foreach...
0
by: Kelvin | last post by:
Hi All, While the existing datatable is looping, I can insert new row into datatable, but I can't insert it between datarows. All new rows will inserted into buttom row. Here is my code. Please...
2
by: Jordan Richard | last post by:
I'm just wondering if there is a faster way (better performance or fewer lines of code) to retrieve one single value from a DataRow. Here is what I'm currently doing when I just need a single...
1
by: microsoft.news.com | last post by:
is it possible to run a SELECT statement against a datatable, and if so how? this is what i have, its populating an excel document, I have my dataset, creatig a data table, now i need to group the...
4
by: Sam | last post by:
Hi, I'm adding columns to a datatable as followed. The values are from textboxes or comboboxes. The first column is properly field but then all the subsequent columns just contain "", whereas the...
2
by: Dibs | last post by:
Hi all, short question. is there anyway of changing the order of a datatable's columns? cheers, Dibs
2
by: Tom | last post by:
Hi, I have some kind of problems with an apostrophe character ('). I would like to select from DataTable DataRow containing value horses' (with an apostrophe on the end). But when I do it in an...
0
by: Maart_newbie | last post by:
Hi all, I've got a question about returning the value of a pk-column to a DataTable after inserting a row (via a data-adapter) using MySql5. Here is the SQL and code concerned: ...
3
by: ASPnewb1 | last post by:
I am currently filling a dataTable then adding this table to a dataset, setting the dataset to the Gridview's datasource. If I set the Gridview to generate columns automatically it will fill the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.